Ubuntu 管理心得

搜尋此網誌

2022年5月18日 星期三

中文節名 section 亂碼

在 hyperref 前加上 unicode option, e.g

 \usepackage[unicode,pdftex]{hyperref}

cf: https://www.twblogs.net/a/5e4f26dcbd9eee101df702ee

2022年5月12日 星期四

Disable Spyder help hover

Tools > Preferences > Completion and linting > Introspection

Deactivate the option: "Enable hover hints"

2022年5月11日 星期三

Boshiamy for ibus cache and restart

  1. Use vim to edit liu_LA.txt. DO NOT use kate.
    Make sure press tab following the Chinese chars, e.g.

    elm     基本矩陣        100
     
  2. ibus-table-createdb -s liu_LA.txt -n liu_LA.db 
  3. sudo cp -f liu_LA.db /usr/share/ibus-table/tables/ 
  4. /bin/rm -rf ~/.local/share/ibus-table ~/.config/ibus ~/.cache/ibus ~/.cache/ibus-table
  5. Run ibus-setup to delete 嘸蝦米:
  6. Then, logout and login (It needs to do this!)


2022年5月4日 星期三

ubuntu 22.04 need php fpm

 Otherwise, the html lines inside php file would have error.

sudo apt install php8.1-fpm
sudo a2enconf php8.1-fpm
sudo systemctl reload apache2

clonezilla to small disk

Expert mode: 

  1. select -icds
  2. select -k1 (next window)

2022年5月2日 星期一

Array and string offset access syntax with curly braces is no longer supported

cd /usr/share/php/Spreadsheet/Excel/Writer/
Edit Parser.php, change all $xxx{yyy} to $xxx[yyy]
Inside vim, search, eq, $col_ss{$i}, using this
/\$.*{.*}
then relplace { and } with [ and ], using 
qqf{r[f}r]
then / -> enter -> @q

cd /usr/share/php
Edit OLE.php, change all $xxx{yyy} to $xxx[yyy]

2022年4月28日 星期四

 矩陣相乘,例如:

 

中間的dot, 就是鍵盤上的小數點,不是 LaTeX 的 \cdot。

叫用 Mathematica  執行,Alt-M Q.

2022年3月25日 星期五

Force win10 bootup check disk

Open cmd with administrator and type

 CHKDSK /f /r /x C:

Reboot win10 would check C:/ drive. 

2022年3月24日 星期四

anacron process time schedule hourly

 Edit /lib/systemd/system/anacron.timer, change the line:

    OnCalendar=*-*-* 02..23:30

It means anacron will process the cron jobs at 2am to 11:30pm only.

2022年3月18日 星期五

LaTeX 中文 chpater 章 編號

\usepackage{titlesec, titletoc}
\usepackage{CJKnumb}
 

\titleformat{\chapter}{\Huge\bfseries}{第\CJKnumber{\thechapter}章}{1em} {}

2022年2月17日 星期四

Matplotlib 顯示中文

 cf: https://mathsyouth.github.io/2019/06/12/macos-matplotlib

  1. Run shell command:
    fc-list :lang=zh

    to find the fonts pathes, e.g. /usr/share/fonts/truetype/bkai00mp.ttf
  2. Follow the python codes below:
    import numpy as np
    import matplotlib.pyplot as plt
    from matplotlib import rcParams
    from matplotlib.font_manager import FontProperties
    rcParams['axes.unicode_minus']=False
    myfont_kai=FontProperties(fname='/usr/share/fonts/truetype/bkai00mp.ttf', size=15)
    myfont_ming=FontProperties(fname='/usr/share/fonts/truetype/arphic-bsmi00lp/bsmi00lp.ttf',size=12)
    x=np.linspace(0,2*np.pi,100)
    plt.plot(x,x)
    plt.title("準則", fontproperties=myfont_kai)
    plt.ylabel("隸屬度", fontproperties=myfont_ming)

2022年2月12日 星期六

Install LAMP server

 cf: https://upcloud.com/community/tutorials/installing-lamp-stack-ubuntu/

 

  1. sudo apt update
  2. sudo apt install apache 
  3. sudo systemctl status apache2
  4. sudo apt install php7.4 php7.4-mysql php-common php7.4-cli php7.4-json php7.4-common php7.4-opcache libapache2-mod-php7.4
  5. sudo systemctl restart apache2
  6. sudo apt install mariadb-server mariadb-client
  7. sudo systemctl status mariadb
  8. sudo mysql_secure_installation
    As you have no root password set for MariaDB you should simply press Enter when prompted, pressing Y on the next question to then set a root password (keep this safe and secure!) With that set, you can press Enter for the remaining questions as the defaults for each of these will help to secure your new installation.
  9. mysql_secure_installation

    https://mariadb.com/kb/en/mysql_secure_installation/
  10. Run mysql_secure_installation
  11. cf: https://kpchiaoo.blogspot.com/search?q=mysql
    If can't access mysql as mysql user root from normal user account but can access mysql without mysql root password from ubuntu root accout, then follow the lines below (the parentheses are comments):
    cf: https://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04/801950
        (1). su - (get into ubuntu root account)
        (2). mysql -u root (get into mysql, should be no need password)
        (3). select User,host,plugin from mysql.user;
        (4). update mysql.user set plugin = 'mysql_native_password' where User='root';
        (5). select User,host,plugin from mysql.user; (plugin column should be changed)
        (6). SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new password');
    or for mysql 8.0 in ubuntu 20.04
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpassord' 
        (7). flush privileges;
  12. sudo a2enmod userdir
  13. sudo a2enmod rewrite
  14. sudo vim php7.4.conf Commnent out the following lines:
    #<IfModule mod_userdir.c>
    #    <Directory /home/*/public_html>
    #        php_admin_flag engine Off
    #    </Directory>
    #</IfModule>
     
  15. sudo apt install phpmyadmin
  16. cf: https://stackoverflow.com/questions/42490647/phpmyadmin-installation-error-1045-acces-denied-using-password-no
    $ mysql -u root -p
    mysql> create database phpmyadmin;
    mysql> create user 'phpmyadmin'@'localhost' identified by 'some_passwd';

    mysql> grant all privileges on phpmyadmin.* to 'phpmyadmin'@'localhost'
  17. cd  /usr/share/phpmyadmin/sql
    $ mysql -u phpmyadmin -p phpmyadmin < create_tables.sql
  18. Edit /etc/php/7.4/apache2/php.ini
    post_max_size = 200M
    upload_max_filesize = 200M
  19. Edit /etc/apache2/apache2.conf, add the lines:
    <Directory /home/chiao/public_html/drupal9/web>
    Options FollowSymLinks
    AllowOverride AuthConfig FileInfo Indexes Limit Options=All,MultiViews
    </Directory>
  20. sudo systemctl restart apache2

 

2022年2月6日 星期日

install pear php-pear spreadsheet

  1. sudo apt install php-pear
  2. Goto https://pear.php.net/package/OLE to see what OLE version is now. Say, 1.0.0RC3 (beta) was released on 2017-06-20
  3. sudo pear install OLE-1.0.0RC3
  4. Goto https://pear.php.net/package/Spreadsheet_Excel_Writer to see what SpreadSheet version is now. Say, 0.9.4 (beta) was released on 2017-05-24
  5. sudo pear install Spreadsheet_Excel_Writer-0.9.4
  6. Done

nmcli set static IP

  1. 執行: sudo  nmcli connection show 會出現下列:
    NAME            UUID                                  TYPE      DEVICE
    有線連線 1      7b62be74-2e0d-32e4-a08e-37a47c33d699  ethernet  eth0
    chiao-dlink842  710e0af6-9b51-455d-9b11-aac2091a2c87  wifi      --   
  2. 修改為 192.168.1.12 IP, 指令如下:
    sudo nmcli connection modify "有線連線 1" ipv4.addresses 192.168.1.12/24 ipv4.gateway 192.168.1.1 ipv4.gateway 192.168.1.1 ipv4.method manual
  3. sudo systemctl restart NetworkManager

eth0 ethernet 不受管理

cf: https://superuser.com/questions/1429490/unmanaged-network-manager-in-ubuntu

 

This works for my ubuntu 20.04.3 at pi4.

As root, edit /etc/NetworkManager/NetworkManager.conf to match the following. You can use the command sudo nano /etc/NetworkManager/NetworkManager.conf to do so.

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=true

[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:gsm,except:type:cdma,except:type:wwan,except:type:ethernet,except:type:vlan

[device]
wifi.scan-rand-mac-address=no

2022年2月1日 星期二

update FAHPShowMembershipForm.php

Edit line 43:

 #        '#prefix' => '<div class=image><img src=/~chiao/drupal9/web/tmp/test_ranking.png>',
        '#prefix' => '<div class=image><img src=tmp/test_ranking.png>',

Line 48:

#        '#prefix' => '<div class=image><img src=/~chiao/drupal9/web/tmp/test.png>',
        '#prefix' => '<div class=image><img src=tmp/test.png>',

2022年1月30日 星期日

Install drupal from scratch

cf: https://www.drupal.org/docs/installing-drupal


  1. cd public_html; mkdir drupaldam
  2. composer create-project drupal/recommended-project drupaldam  && cd drupaldam
  3. Enter phpmyadmin;
    (1). create database 'drupaldam' with utf8mb4_general_ci

    (2). drupaladmin 指定 drupaldam 資料庫權限:
  4. cd ~/public_html; sudo chown -R www-data.www-data drupaldam
  5. Visit site in browser:
    http:kpchiao.sino.tw:8080/~chiao/drupaldam/web/core/install.php
    At
    資料庫設定:
  6. Finish the next two pages.
  7. cd ~/public_html/drupaldam/web/sites/default; sudo chmod 0400 settings.php; sudo chown -R www-data.www-data settings.php files
  8. Done.

For drupal having “htaccess: Options not allowed here” error

Edit /etc/apache2/mods-available/userdir.conf, add Options in AllowOveride, namely,

AllowOverride FileInfo AuthConfig Limit Indexes Options

 

 

網誌存檔