2021-07-03

awk 九九乘法表 ( awk 9x9 )

2021-07-03 modify / 2020-05-01

awk 九九乘法表  ( 9×9 table )

  • 執行
     awk -f awk_m_table.awk 
    program : awk_m_table.awk
    # prg : awk_m_table.awk
     
    # url : http://www.polish.url.tw/ach5/ach5.html#awk
     
    BEGIN{ #←awk of Multiplication Table example
       printf " *    1  2  3  4  5  6  7  8  9\n";
       printf "---+--+--+--+--+--+--+--+--+---\n";
       for( i=1; i<=9; i++ ){
          printf "%2s |",i;
          for( j=1; j<=9; j++ ){
             array[i, j] = i * j;
             printf " %2s",array[i,j];
          }
          printf "\n";
       }
    }
  • output

sshfs 掛載 (sshfs mount)

 

2021-07-03

sshfs : 透過 SSH 協定掛載遠端硬碟(Linux、 Mac OS X、 Windows)

  • 安裝 ( install )
    sudo apt install sshfs 
  • 掛載 ( mount ) , 要先有掛載目錄, 先建目錄
    mkdir /local/mountpoint/ 

    掛載

    sshfs user@remote-host:/remote/dir /local/mountpoint 
  • 卸載 ( umount )

2021-06-17

md5sum 檢查

 2021-06-16 

md5sum 是一種總合(sum)的檢查方式,這類常見的檢查有 md5sum 、 sha256 、 sig 、 zsync 。

  • md5sum : 以 RFC 1321 的 128 位元 MD5 雜湊值(或校驗 )描述檔 ,來計算校驗所檢查檔案的完整性。( MD5演算法缺陷 )
  • sha256 : 32 位元安全雜湊演算 ( Secure Hash Algorithm )。
  • sig : 利用 .sig 副檔名的簽名檔 ( Signature File ) ,來驗證資料完整性。
  • zsync : 差異比較,以僅下載缺失或過期的部分。



 

2021-06-10

xrandr - 雙螢幕解析度切換

2021-06-10 
  • 雙螢幕 : 開機前先接好螢幕,才會自動抓到
  • 查詢硬體
    xrandr 

dir_colors - 終端機下檔案目錄顯示顏色

2021-06-09 

  • Debian 系的 Linux (Ubuntu、MintLinux、AntiX、MX Linux..) 都没 /etc/DIR_COLORS 這個檔,可以自行建立,或是建立 ~/.dircolors ( Centos 是在 ~/.dir_colors )
  • 輸出預設值可以導入到 ~/.dircolors (注意會覆蓋 ~/.dircolors)
    dircolors --print-database > ~/.dircolors
    或 
    dircolors -p > ~/.dircolors 

2017-04-24

Debian Apache2.4 簡潔網址2-Clean URLs(2)

2017-04-24

Apache 2.4.10 簡潔網址2 (Clean URLs 2)
 
Apache 2 版本 : 2.4.10
Debian 版本 : 8.7 jessie ( stable )

  • apache2 加上 mod_rewrite 模組
    sudo a2enmod rewrite
  • < DoukWiki Dir > /conf/local.php 設定
    $conf['basedir'] = '/home/username/dokuwiki/';
    $conf['baseurl'] = '/';
    $conf['userewrite'] = '1'; //使用 apache 的 mod_rewrite 提供簡潔網址模式
    $conf['useslash'] = 1;
  • dokuwiki ( < DoukWiki Dir > ) 目錄下 .htaccess 檔
    RewriteEngine on
    
    RewriteBase /~username/dokuwiki/
  • 重起動 apache2
    sudo /etc/init.d/apache2 restart
      或
    sudo service apache2 restart

----
相關 - Debian Apache2 簡潔網址-Clean URLs (2010-04-27)


2016-10-28

合併兩文字檔成一檔(兩欄)

合併兩文字檔成一檔 ( 兩欄 ) ( paste )

2016-10-28

  • 檔案1(f1.txt)
    abc
    123
    def
    456
  • 檔案2(f2.txt)
    0000
    1111
    2222
    3333
    4444
  • 指令(command) ( -d “,” 以逗號為分隔,預設為 Tab )