Ubuntu 管理心得

搜尋此網誌

2024年1月27日 星期六

bash check number of input arguments

#!/bin/bash
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"

  1. Edit settings.php, set $settings['update_free_access'] = FALSE; to TRUE
  2. Browse http://192.168.1.14/~chiao/drupaldam10_from_9/dam/web/update.php
  3. update the database
  4. Set $settings['update_free_access'] to = FALSE

2024年1月19日 星期五

聯想詞的設定

Edit boshiamy_my.txt, add two codes, e.g.
vdm 矩陣
rect 矩形
Key in "vdf" for 矩, then it will show two codes:
0: 形, 1:陣
to be selected. 


Engineering Graphics Lecture Notes, mkEngGraLectureNotes.sh

#!/bin/bash
docxfile=$1
TeXfile=$2
LyXfile="${2%.*}.lyx"
pandoc --extract-media ./ $docxfile -o $TeXfile
sed -i -e '/hypertarget/d' -e 's/\\label.*$//' -e 's/includegraphics\[width=.*\]/includegraphics/' -e '/includegraphics{/i \\\\begin\{figure\}\n\\begin\{centering\}' -e '/includegraphics{/a \\\end\{centering\}\n\\caption\{\}\n \\\end\{figure\}' -e 's/\\textgreater/>/' $TeXfile
#sed -i 's/\/\\/g' $TeXfile
echo " \\end{document}" >> $TeXfile

cat > tmpfile << EOF
\\documentclass[10pt,a4paper]{extarticle}
\\usepackage[utf8]{inputenc}
\\usepackage{amsmath}
\\usepackage{amsthm}
\\usepackage{fontspec}
\\setmainfont[Mapping=tex-text]{Noto Serif CJK TC}
\\setsansfont[Mapping=tex-text]{Noto Serif CJK TC}
\\setmonofont{Noto Serif CJK TC}
\\usepackage{float}
\\usepackage{graphicx}
\\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false]
 {hyperref}

\\makeatletter

\\pdfpageheight\\paperheight
\\pdfpagewidth\\paperwidth
\\theoremstyle{definition}
\\newtheorem{example}{\\protect\\examplename}

\\@ifundefined{date}{}{\\date{}}
\\makeatother

\\providecommand{\\examplename}{範例}

\\begin{document}

\\renewcommand{\\footrulewidth}{0.4pt}
\\thispagestyle{empty}\\tableofcontents{}
\\pagebreak{}
\\renewcommand{\\footrulewidth}{0.4pt}
\\thispagestyle{empty}\\tableofcontents{}
\\pagebreak{}
EOF
cat $TeXfile >> tmpfile
mv -f tmpfile $TeXfile
tex2lyx -f $TeXfile

2024年1月18日 星期四

window dialog using zenity with buttons

zenity --question --width=100 --ok-label="Shutdown anyway" --cancel-label="Cancel" --title="Shutdown reminder" --text="Shutdown now?"
status="$?"
if [ "$status" = 0 ]; then
    zenity --info --width=100 --title="Cancel Shutdown" --text="Cancel Shutdown"
fi
else
  gnome-session-quit --power-off
fi

find hiddent subdir

find ~/.\.* -iname "xxx"
grep -ri dynwall .[^.]*
 

Compress with tar 7z

tar --one-file-system -cf - <dirs> | 7z a -mx=9 -mmt=2 -p -si `date +<filename>%Y%m%d_bsun.tar.7z`


2024年1月12日 星期五

software update pop up notification turn off

cf: https://askubuntu.com/questions/1237825/how-to-turn-off-software-updater-pop-up-notification

  1. gsettings set com.ubuntu.update-notifier no-show-notifications true
  2. Or use dconf-editor. Go to /com/ubuntu/update-notifier, and unclick  no-show-notification to false.

Check with:

 gsettings get com.ubuntu.update-notifier no-show-notifications

If shows true, done.

2024年1月8日 星期一

Test video nouveau driver nvidia graphic card

glmark2 -b ideas:duration=10.0:speed=.5 --fullscreen
glmark2 -b :duration=5.0 -b build -b shadow -b shading -b jellyfish --fullscreen

[Scene] buffer
[Scene] build
[Scene] bump
[Scene] clear
[Scene] conditionals
[Scene] desktop
[Scene] effect2d
[Scene] function
[Scene] ideas
[Scene] jellyfish
[Scene] loop
[Scene] pulsar
[Scene] refract
[Scene] shading
[Scene] shadow
[Scene] terrain
[Scene] texture

[Option] speed
    Description  : Time coefficient (1.0 is "wall clock" speed, <1.0 is slower, >1.0 is faster).  A special value of "duration" computes this as a function of the "duration" option
    Description  : Enable random rotation speeds


2024年1月5日 星期五

My boshiamy fcitx

cf: https://newtoypia.blogspot.com/2021/09/fcitx.html
  1. Adding new codes into /download/Boshiamy/boshiamy_my.txt
  2. sudo apt install fcitx-tools
  3. txt2mb boshiamy_my.txt boshiamy_my.mb
  4. cp boshiamy_my.mb /home/chiao/.config/fcitx/table/
  5. sudo cp boshiamy_my.mb /usr/share/fcitx/table/
  6. cd /home/chiao/.config/fcitx/table
  7. mv boshiamy.mb boshiamy_orig
  8. ln -s boshiamy_my.mb boshiamy.mb
  9. cd /usr/share/fcitx/table/
  10. sudo mv boshiamy.mb boshiamy_orig
  11. sudo ln -s boshiamy_my.mb boshiamy.mb
  12. im-config, select fcitx as new input method
  13. logout, then login
  14. Done
 
 

網誌存檔