- cp old profile to firefox user directory, say, /home/chiao/snap/firefox/common/.mozilla/
- In terminal, run:
MOZ_ALLOW_DOWNGRADE=1 firefox -P - close firefox and open firefox (no need in terminal)
- Done
2024年8月13日 星期二
old firefox profile to new firefox
2024年8月12日 星期一
Stuck at "press Ctrl-c to cancel the checks in progress on the filesystem"
Check /etc/fstab. Some line might cause this problem. For example, if some partition is deleted, but it is still in fstab, then ubuntu is keeping checking such non-exist partition.
2024年6月26日 星期三
id and id $USER show different groups
I set my primary group as root in /etc/passwd, and I always do this when install a new system. I also add myself to other groups,eg. sudo, lp, dialout ... However, the id only shows I am in root group and no other groups shown.
So I change my primary group from root to chiao voila the problem is solved! The id and id chiao show the same groups. Futhermore, I can use thonny directly.
2024年6月24日 星期一
pico w micropython custom module
The custom module, say my.py, must be saved in pico w rather than computer. Otherwisr, micropython will complain not find import module.
I think this is due to the runtime module must be imported from pico w device.
2024年5月20日 星期一
gpio BCM and BOARD mode
- GPIO.setmode(GPIO.BOARD)
pin numbers are as in board,1,2...40 sequentially. - GPIO.setmode(GPIO.BCM)
pin numbers are as defined names as GPIO 14, GPIO 15 ... - For example, pin 16 in BOARD mode is the pin GPIO 23 in BCM mode
gpio output vs input
An output pin that is set high can push out (source) current, or when set low it can pull in (sink) current. An input does neither, it ideally needs no current to flow to sense if the input is high or low.
2024年5月9日 星期四
fcitx 4 add boshiamy
- sudo apt install fcitx-tools fcitx-table-boshiamy
- fcitx 設定法設定 add 嘸蝦米
- For my own codes, run:
#!/bin/bash
txt2mb boshiamy_my.txt boshiamy_my.mb
cp -f boshiamy_my.mb /home/chiao/.config/fcitx/table/
sudo cp -f boshiamy_my.mb /usr/share/fcitx/table/
cd /home/chiao/.config/fcitx/table
ln -sf boshiamy_my.mb boshiamy.mb
cd /usr/share/fcitx/table/
sudo ln -fs boshiamy_my.mb boshiamy.mb
echo ""
echo " Restart fcitx "
echo ""
2024年5月7日 星期二
Install windows 11 without login microsoft
cf: https://www.makeuseof.com/windows-11-set-up-without-internet-connection/
- Make sure your computer is not connected to the Internet.
- Enter your product key. If you don't have a product key, click the
I don't have a product key
link in the bottom right corner. - Once in the Let’s connect you to a network screen, press Shift + F10 to launch the Command Prompt.
- In the Command Prompt window, type
OOBE\BYPASSNRO - Upon successful execution, your system will restart and relaunch the OOBE dialog.
- Click on I don’t have Internet option
- Next, click on Continue with limited setup.
2024年5月6日 星期一
2024年5月3日 星期五
mycodes
adh 伴隨矩陣
ahp 層級分析法
alt 方案
au 真理大學
aug 增廣矩陣
chia 喬國平
cofa 餘因子
cri 準則
deci 決策分析
det 行列式
eig 特徵值
eiv 特徵向量
elem 元素
elm 基本矩陣
elro 基本列運算
ext 擴充原理
fahp 模糊層級分析法
flow 流程圖
fuzz 模糊集合
gau 高斯消去法
gau 高斯喬丹消去法
goo 如圖
goo 如此
ifs 區間二型直覺模糊集合
imei 工業管理與經營資訊學系
lcom 線性組合
ldep 線性相關
lina 線性代數
lind 線性獨立
lp 線性規劃
lsys 線性系統
mem 隸屬度函數
mous 滑鼠
pcm 成對比較矩陣
pivo 軸元素
pj 平面
rect 矩形
ref 列梯形矩陣
rref 列簡梯形矩陣
rz 微積分
uqll 電腦繪圖
user 使用者
vdm 矩陣
zya 等角
zya 等角圖
2024年5月2日 星期四
2024年4月30日 星期二
add user defined layouts in lyx for windows
Put into:
c:\Users\chiao\AppData\Roaming\LyX2.3\layouts\
2024年4月20日 星期六
2024年4月16日 星期二
2024年4月8日 星期一
Uninstall mathematica
cf: https://support.wolfram.com/12473
Remove the subdirectories:
- /usr/local/Wolfram/Mathematica/
- /usr/share/Mathematica/
- ~/.Mathematica/
- ~/.Wolfram/
- ~/.cache/Wolfram
2024年4月6日 星期六
clip video ffmpeg
ffmpeg -i a.mp4 -ss 00:10:57 -to 00:23:00 -c:v copy -c:a copy output2.mp4
Use kdnlive:
2024年4月4日 星期四
2024年4月2日 星期二
Clone 教學網頁
- Rename drupal0_from_9 database to drupal10_from_9_pi4_20240402
- Using command line mysql instead of phpmyadmin to clone draupal0_from_9 database from kpci7 to pi4
- Using sudo to clone public_html/drupal10_from_9 from kpci7 to pi4
- In pi4 phpmyadmin, update the drupal10_from_9 database privileges for drupaladmin
2024年3月30日 星期六
Save export matplotlib image from jupyter to pdf
- Right click image
- Click 在新頁中開始圖片
- Click 新頁
- Ctrl-p to print to pdf or printer
2024年3月29日 星期五
inside ubuntu run clonezilla
sudo clonezilla
2024年3月25日 星期一
shred wipe all data in ubuntu
sudo shred -vfz /dev/sdX
- -n , --iterations=N. Instead of the default (3) times, overwrite the data N times.
- -z , --zero. Add a final overwrite with zeros to hide shredding.
- -f , --force. Force the permissions to allow writing if necessary.
- -v , --verbose. Show progress in detail.
- -u , --remove. Truncate and remove file after overwriting.
2024年3月23日 星期六
mkLectNote_clean_tex.sh
#!/bin/bash
TeXfile=$1
LyXfile="${1%.*}.lyx"
sed -i -e '0,/\\maketitle$/d' -e '/^\\end{document}/d' -e '/hypertarget/d' -e 's/\\label.*$//' -e 's/\\section/\\chapter/g' -e 's/\\subsection/\\section/g' -e 's/\\subsubsection/\\subsection/g' -e 's/\\textgreater/>/' $TeXfile
sed -i '1 i\\\\def\\mylabel#1{\\label{#1}}' $TeXfile
#sed -i 's/\/\\/g' $TeXfile
jupyter export latex missing label workaround
In jupyter lab, use \mylabel instead of \label e.g
<img src="if.png" alt="if example flowchart" style="width: 400px;"/>
\begin{figure}
\centering
\includegraphics{if.png}
\caption{if 流程圖}
\mylabel{fig:if 流程圖}
\end{figure}
After export to LaTeX, run
/home/chiao/scripts/mkLectNote_clean_tex.sh chapterXX.tex
2024年3月20日 星期三
jupyter lab traditional Chinese
pip install jupyterlab-language-pack-zh-TW
2024年3月8日 星期五
slide show jpeg files, feh
#!/bin/bash
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <delay sec.> <subdirerory>"
exit
fi
feh -r -d -Z -D ${1} #{2}
2024年3月3日 星期日
Spyder 正體中文
- Download Chinese po file here: http://here.vixual.net/files/python/spyder/Spyder-v5.4.3-zh_TW-20231113.zip
- Copy add_traditional_Chinese.py (below) and Spyder-v5.4.3-zh_TW-20231113.zip to the user desktop.
- Run the script add_traditional_Chinese.py (Spyder or Python IDLE).
- Inside Spyder, Tools -> Preferences -> Application (2nd option on left panel) -> Advanced settings (right panel). Select 正體中文 in Language.
- Restart Spyder.
Save the following codes to add_traditional_Chinese.py:
import zipfile
def unzip_and_copy(zip_file, destination):
# Unzip the file
with zipfile.ZipFile(zip_file, 'r') as zip_ref:
zip_ref.extractall(destination)
def edit_base_file(base_file):
# Read the contents of the base file
with open(base_file, 'r', encoding='utf-8') as f:
lines = f.readlines()
# Find the index where to insert the new line
insert_index = -1
for i, line in enumerate(lines):
if "简体中文" in line:
insert_index = i + 1
break
if insert_index != -1:
# Insert the new line
lines.insert(insert_index, " 'zh_TW': u'正體中文',\n")
# Write the modified content back to the file
with open(base_file, 'w', encoding='utf-8') as f:
f.writelines(lines)
print("File edited successfully.")
else:
print("Line containing '简体中文' not found.")
if __name__ == "__main__":
# Set paths
desktop_path = os.path.join(os.getenv('USERPROFILE'), 'Desktop')
zip_file = os.path.join(desktop_path, 'Spyder-v5.4.3-zh_TW-20231113.zip')
unzip_destination = os.path.join(os.environ['USERPROFILE'], 'anaconda3', 'Lib', 'site-packages', 'spyder', 'locale')
base_file = os.path.join(os.environ['USERPROFILE'], 'anaconda3', 'Lib', 'site-packages', 'spyder', 'config', 'base.py')
# Step 1: Unzip and copy files
unzip_and_copy(zip_file, unzip_destination)
# Step 2: Edit base.py
edit_base_file(base_file)
2024年2月24日 星期六
disable onedrive service for user
systemctl --user stop onedrive
systemctl --user disable onedrive
delete the symbolic linksudo rm /etc/systemd/user/default.target.wants/onedrive.service which is linked from /usr/lib/systemd/user/onedrive.service 2024年2月23日 星期五
sync onedrive
if [ "$#" -lt 1 ]; then
# echo "Usage: $0 <upload_path>"
echo "Usage: $0 <full local directory> "
echo "e.g. $0 /home/chiao/Python"
exit
fi
SUBDIR=$(basename "$1")
ROOTPATH=$(dirname "$1")
read -p "Start dryrun (press y or n) ? " yn
case $yn in
# [Yy]* ) echo "Start dryrun (not really uploading) ..." ;onedrive --synchronize --verbose --resync --dry-run;;
# [Yy]* ) echo "Start dryrun (not really uploading) ..." ;onedrive --syncdir ${1} --synchronize --skip-symlinks --verbose --dry-run --resync;;
[Yy]* ) echo "Start dryrun (not really uploading) ..." ;onedrive --syncdir ${ROOTPATH} --single-directory ${SUBDIR} --synchronize --skip-symlinks --verbose --dry-run --resync;;
# [Yy]* ) echo "Start dryrun (not really uploading) ..." ;echo "Testing dryrun";;
esac
read -p "Strat uploading? (press y or n) " yn
case $yn in
# [Yy]* ) echo "-----------------------------------------------------------";START=$(date +%F\ %T);onedrive --synchronize --verbose --resync; echo "Start at: $START"; echo "End at: $(date +%F\ %T)"; echo "-----------------------------------------------------------";;
# [Yy]* ) echo "-----------------------------------------------------------";START=$(date +%F\ %T);onedrive --syncdir ${1} --synchronize --skip-symlinks --verbose --resync; echo "Start at: $START"; echo "End at: $(date +%F\ %T)"; echo "-----------------------------------------------------------";;
[Yy]* ) echo "-----------------------------------------------------------";START=$(date +%F\ %T);onedrive --syncdir ${ROOTPATH} --single-directory ${SUBDIR} --synchronize --skip-symlinks --verbose --resync; echo "Start at: $START"; echo "End at: $(date +%F\ %T)"; echo "-----------------------------------------------------------";;
# [Yy]* ) echo "-----------------------------------------------------------";START=$(date +%F\ %T); echo "Testing";echo "Start at: $START"; echo "End at: $(date +%F\ %T)"; echo "-----------------------------------------------------------";;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
2024年1月27日 星期六
bash check number of input arguments
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <arg1>"
exit
fi
2024年1月20日 星期六
after composer update error "The website encountered an unexpected error. Try again later"
- Edit settings.php, set $settings['update_free_access'] = FALSE; to TRUE
- Browse http://192.168.1.14/~chiao/drupaldam10_from_9/dam/web/update.php
- update the database
- Set $settings['update_free_access'] to = FALSE
-
cf: https://ubuntuhandbook.org/index.php/2022/01/default-torrent-app-magnet-links-ubuntu/ Set “QBittorrent” as default app for magnet link,...
-
cf: https://stackoverflow.com/questions/54184707/warning-continue-targeting-switch-is-equivalent-to-break-did-you-mean-to-u Error while...
-
Put the lines at the first: #!/usr/bin/env python # coding: utf-8