Typst 目前并不支持 PostScript 甚至 PDF, 若文档需要插入 PGPLOT 绘制的 .ps 图, 需要转换. 以下探索了一种 看起来 无损 转换为 SVG 的方法.
Typst does not support PostScript and even PDF for now, if need insert .ps figure plotted by PGPLOT in document, it nees convert. Here discovered a method to convert PS to SVG that seems losslessly.
for f in *.ps; do eps2eps $f $f.eps; gs -dBATCH -dEPSFitPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=$f.eps.pdf $f.eps qpdf $f.eps.pdf --rotate=180 -- $f.eps.rotated.pdf inkscape --export-type=svg --export-area-drawing $f.eps.rotated.pdf rm $f.eps $f.eps.pdf $f.eps.rotated.pdf done
注意很多其它方法会导致内部位图被降采样.
Notice that many other methods may downsample internal rastered image.
注意对不同软件绘制的图, 需要旋转的度数不同 (例如 PulsarX 180 度, PRESTO 与 DSPSR/PSRCHIVE 90 度).
Notice...
• • • >>
目标 Target
当 sudo 检测到异常时, 自动产生记录并提醒管理员; 机器上没有邮件服务器.
When sudo detects abnormal incidents, auto generate record and notify admin; no mail server on machine.
思路 Idea
graph TD
sudo --"postfix"--> mail
mail --if local--> local(( ))
local --> Thunderbird[Thunderbird old version]
local --> dovecot
mail --if remote--> remote(( ))
remote --> rsync[rsync file to local] --> local
步骤 Steps
1. postfix
需要有一个程序来接收 sudo 产生的邮件, 这里选择 postfix.
There should be some program to receive mail generated by sudo, here we choose postfix.
安装 postfix; 由于没有邮件服务器, 在此方案中配置为本地模式; 其它配置保持默认.
Install postfix; as there is no mail server, here configure it as local mode; other settings remain default.

2. sudo
编辑 /etc/sudoers.d/mail-sysadmin
并输入下面的内容, 注意将 admin 替换为你需要的用户.
Edit /etc/sudoers.d/mail-sysadmin
and input the following lines, note: replace admin with user you want.
• • • >>
Problem
When running llama.cpp on RHEL9-like OS, it is noticed that a large portion of time is single-threaded, which is unexpected.
Attaching with GDB shows that it is running sgemm
provided by OpenBLAS; but OpenBLAS should run with multiple threads.
Analyze
Search engine gives this post: Red Hat Bugzilla – Bug 1589823 - The OpenBLAS package that comes with RHEL does not have multithreading capabilities
Don’t use the sequential library if you want the parallel one. Use -lopenblaso for OpenMP and -lopenblasp for pthreads.
This behavior is different from Debian-like OSs. e.g. in Ubuntu 24.04, the OpenBLAS variant used is mananged by update-alternatives
, and only libopenblas.so
is provided.
Moreover, CMake checks libopenblas.so
only: FindBLAS.cmake @ 321b71c, line 751-805
Solution
Not sure whether package policy or FindBLAS should change. An issue is reported: cmake/cmake#26659.
Workaround...
• • • >>
Problem
For debugging RFSoC booting from SD card, the FSBL_DEBUG
is helpful (See official doc, search for “debug”).
Some of Q&As e.g. “How to enable FSBL customization in petalinux”, and even official doc “Zynq UltraScale+ MPSoC Software Developer Guide (UG1137)”, give a method:
mkdir -p <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/fsbl_%.bbappend
File content:
#Enable appropriate FSBL debug flags YAML_COMPILER_FLAGS_append = " -DFSBL_DEBUG"
However this doesn’t work in recent versions of Petalinux, e.g. 2024.1.
Analyze
It is easily noticed that other .bbappend files uses a different syntax, e.g. recipes-bsp/u-boot/u-boot-xlnx_%.bbappend
has a line like:
SRC_URI:append = " file://platform-top.h file://bsp.cfg"
So the fsbl_%.bbappend
should be
# Enable appropriate FSBL debug flags YAML_COMPILER_FLAGS_append = " -DFSBL_DEBUG "
But this still not working,
• • • >>
Intro
Recently Rusticl has implemented shared virtual memory (SVM), see Karol Herbst’s post & related Phoronix news.
This enables SYCL on Rusticl on e.g. RadeonSI, which may be compared to SYCL on ROCm; before that, let’s take a first-time look.
Although for now Rusticl on RadeonSI has only coarse-grained SVM but AdaptiveCpp requires fine-grained SVM (author thought it isn’t too strict, see AdaptiveCpp#1113), it is possible to emulate USM upon coarse-grained SVM using intel/opencl-intercept-layer.
Build
Firstly, download source code.
git clone https://gitlab.freedesktop.org/karolherbst/mesa.git -b rusticl/svm/coarse cd mesa
Build MESA with Rusticl enabled:
meson setup build -Dprefix="/media/build-cache/mesa-install" -Dgallium-rusticl=true -Dllvm=enabled -Dgallium-opencl=icd -Drust_std=2021 -Dgallium-drivers="radeonsi,virgl,svga,swrast,iris,crocus,i915,zink" ninja ninja install
Note, for now MESA requires LLVM 19, and meson may select corrent Clang...
• • • >>
Ref: https://leosaa.medium.com/build-the-latest-kernel-package-for-debian-85b09ec6af88
cp -v /boot/config-$(uname -r) .config
make menuconfig
make olddefconfig
Disable signing keys and debug:
scripts/config --disable SYSTEM_TRUSTED_KEYS
scripts/config --disable SYSTEM_REVOCATION_KEYS
scripts/config --disable DEBUG_INFO
scripts/config --enable DEBUG_INFO_NONE
Note, currently rust support requires MODVERSION to be disabled,
double check if Rust supports is shown in menuconfig.
Check setup of rust by:
make -j`nproc` LOCALVERSION=-rust LLVM=-19 rustavailable
where -19
is version of Clang used.
Then build:
make -j`nproc` LOCALVERSION=-rust LLVM=-19 bindeb-pkg
当导入数据到 CASA (Common Astronomy Software Applications) 时,
若台站不在 CASA 数据库中, 会得到如下报错:
RuntimeError: Exception: Telescope 21CMA is not recognized by CASA.
... thrown by casacore::MPosition casacore::MSMetaData::getObservatoryPosition(casacore::uInt) const at File: /source/casa6/casatools/casacore/ms/MSOper/MSMetaData.cc, line: 3305
从报错位置 MSMetaData.cc#L3305 可以追踪到 MeasTable.cc#L2905, MeasTable.cc#L2863, 得到关键词 “Observatories”,
“measures.observatory.directory”, “geodetic”.
经过一些搜索后注意到该文件是 casacore 下载得到的, 通常位于 ~/.casa/data/geodetic/Observatories
, 并且是类似 measurement set 的结构, 那么可用 Table 相关函数编辑.
注意 CASA 启动会加载该文件, 也就是加上读锁, 然后就无法获得写锁 (会死锁, 表现为程序卡死), 可以复制一份为 Observatories-bak
作为备份, 再复制一份为 Observatories-edit
编辑.
在 CASA 中使用
browsetable(tablename="/home/user/.casa/data/geodetic/Observatories-edit")
编辑加入台站参数即可. 记得退出 CASA 之后把 Observatories-edit
改回 Observatories
.
需求: 用 ASCII 字符作为用户文件夹的名称, 使得命令行比较方便, 并且其他位置 (比如用户界面) 的语言维持现状.
Motivation: use ASCII characters for user folder names (thus easier when using command line) while keeping other language settings (UI text, etc.)
解决方案:
Solution:
export LC_ALL=en_US.utf8
xdg-user-dirs-gtk-update
After upgrading from 22.04 to 24.04 through do-release-upgrade
,
GNOME keyring no longer manages ssh
key passwords when using Plasma.
(Still working on GNOME).
After some digging, it is noticed that SSH_ASKPASS
is set to /usr/bin/ksshaskpass
and didn’t find where it is set; however ssh-askpass isn’t working properly.
As said in https://wiki.archlinux.org/title/KDE_Wallet#Using_the_KDE_Wallet_to_store_ssh_key_passphrases,
will use this script in .bash_profile
as a workaround:
# https://wiki.archlinux.org/title/KDE_Wallet#Using_the_KDE_Wallet_to_store_ssh
if [ "$SSH_ASKPASS" == "/usr/bin/ksshaskpass" ]; then
export SSH_ASKPASS_REQUIRE=prefer
fi
• • • >>
本文假定安装软件到 $PREFIX
, 比如 PREFIX=/opt/$NAME
. 当然也可将不同软件安装到同一目录, 例如 PREFIX=$HOME/pulsar_software
. 以下内容中请把 $PREFIX
替换为你想要的值.
This article assumes installing software into $PREFIX
, e.g. PREFIX=/opt/$NAME
. Of course you can install into same directory, e.g. PREFIX=$HOME/pulsar_software
. Please replace $PREFIX
with the value you want in the following content.
本文以类 Debian 环境为例, 使用其他包管理器的用户可自行搜索软件包名. 对于 RHEL, 通常 -dev
-> -devel
.
This article uses Debian-like environment. Users with other package managers may search for package name by yourself. For RHEL, usually -dev
-> -devel
.
如有任何问题或评论, 可在 https://github.com/fxzjshm/fxzjshm.github.io/issues 提出.
If you have any question or comment, consider post it at https://github.com/fxzjshm/fxzjshm.github.io/issues.
相关环境变量 | Useful environment variables
PATH
LD_LIBRARY_PATH
LIBRARY_PATH
CPATH
构建需要的软件 | Dependencies of building
• • • >>