2017/03/29

HTTrack Debian Packages

HTTrack 砍站軟體 for Linux


Install full GUI version.
[command]
apt-get update
apt-get install webhttrack

Install commandline version only.
[command]
apt-get update
apt-get install httrack


[reference]
http://debian.httrack.com/

Very good Text Editor for Linux -- Notepadqq

It's recommended to install notepadqq on your Linux if you like to use notepad++ on Windows.

[command]
sudo add-apt-repository ppa:notepadqq-team/notepadqq
sudo apt-get update
sudo apt-get install notepadqq

How to change the fonts after install Chinese language package

Before install Boshiamy input method, we must install Trad-Chinese language package first. However, the fonts would be changed to ukai/uming. Therefore, remove them could solve this problem.

[command]
sudo apt-get remove fonts-arphic-ukai
sudo apt-get remove fonts-arphic-uming


[reference]
https://www.ptt.cc/bbs/Linux/M.1408882475.A.A93.html

過於冷漠

今天在台北車站第11號車廂位置,往捷運方向的樓梯移動時,人潮眾多所以我低著頭小心翼翼地注視階梯慢慢走,發現右邊男子一直側著臉往我的方向看,便抬頭看他,結果他是直盯著我左邊的女生大腿看,女生穿著超短短裙,露出一雙纖細嫩白的美腿,難怪男子看得目不轉睛直到出了票閘還在看。 女生出了票閘後往左走,男子則是往右走向捷運站的票閘,仍不斷回頭找尋女生的蹤影,男子突然停下腳步視線看向左邊,原來女生從另一個捷運票閘進來,男子伺機跟在她身後搭上電扶梯,而我不以為意從電扶梯左側快速通過,在我排隊的位置正好可以看見電扶梯的情況,女生下電扶梯後往旁邊走幾步便停下排隊,而男子跟在其身後仍死盯著女生雙腿看,上捷運後... 我思考了一下:
剛開始是認為女生穿著過於曝露的服裝,本來就容易吸引色狼靠近,在穿這種衣服前,就要自己承擔風險,所以不予理會。
後來再想想,如果我適時的提醒女生,或許可以讓她有所警覺,但該怎麼做呢? 如何讓女生防範,然後色狼不會日後報復我?
想來想去,得到的結論,就是用手機寫上「小心色狼」的字出示給女生看,然後不要讓男子看到即可。

2017/03/26

最喜歡的Python 開發套件 with VIM

個人非常喜歡fisadev所採用的套件及配色.



[reference]
http://fisadev.github.io/fisa-vim-config/

監控CPU使用率 script

計算CPU負載的script,將第14行的 ${c...@]}改成 ${CPU[@]} ,存檔後 chmod +x 即可。


[reference]
http://www.mail-archive.com/linuxkernelnewbies@googlegroups.com/msg01690.html

在Linux Mint 安裝嘸蝦米輸入法 -- Fcitx

Linux Mint 18.1 安裝嘸蝦米輸入法

若非中文語系,務必先安裝Chinese Language Package,並選擇Fcitx為輸入法工具,再至Control Center 內的Fcitx configure將Boshiamy 加進對應的語系(例如: English)。

[command]
sudo apt install fcitx-table-boshiamy

安裝後,建議先登出,再至螢幕右下角小鍵盤(小企鵝)處切換,或開啟輸入法設定視窗檢視即可。 Ctrl + Space Bar 亦可。



[link]
嘸蝦米輸入法影音教學光碟 (附完整章節清單,可快速跳轉)

2017/03/23

Create cronjob for specific user.

It tells how to create cronjob for specific user.

Please modify /etc/crontab directly if use the user column for cronjob.

  */5 * * * * hubert /path/to/MyRoutineProc.sh  

[command]
sudo vi /etc/crontab

---------------------------------------------------------------

Please use -u option to assign cronjob for specific user.

[command]
sudo crontab -u USERNAME -e

[reference]
http://stackoverflow.com/a/30445074

Install/setup Apache Web Server

It tells you how to install and setup Apache web server via apt-get utility.

[command]
sudo apt-get install apache2

---------------------------------------------------------------

Disable default site if necessary.

[command]
sudo a2dissite default
sudo a2dissite default-ssl
sudo service apache2 reload
sudo service apache2 restart

---------------------------------------------------------------

Enable your website (e.g. hubert.cc).

[command]
sudo a2ensite hubert.cc
sudo service apache2 reload
sudo service apache2 restart

Import/Export SQL file under command line

It tells how to import/export SQL file under command line.

Import SQL file.

[command]
mysql -u USERNAME -p DATABASE_NAME < SQL_FILE_NAME
---------------------------------------------------------------

Export SQL file.

[command]
mysqldump -u USERNAME -p DATABASE_NAME > SQL_FILE_NAME

Install MariaDB on Debian or Linux

It tells how to install MariaDB via apt-get utility.

[command]
sudo apt-get install python-software-properties
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo add-apt-repository 'deb [arch=amd64,i386] http://ftp.ubuntu-tw.org/mirror/mariadb/repo/10.1/debian wheezy main'
sudo apt-get update
sudo apt-get install mariadb-server

[reference]
https://downloads.mariadb.org/mariadb/repositories/#mirror=ossplanet&distro=Debian&distro_release=wheezy--wheezy&version=10.1

Set permission (hosts.allow / hosts.deny)

It tells how to allow/deny the specific networks to access the services of Debian or Linux.

Modify hosts.allow to add white-list.

[command]
sudo vi /etc/hosts.allow

[modify]
Add the following settings.

# only allow 192.168.56.1 - 254 to access OpenSSH service
sshd: 192.168.56.0/255.255.255.0

---------------------------------------------------------------

Modify hosts.deny to add black-list.

[command]
sudo vi /etc/hosts.deny

[modify]
Add the following settings.

# deny any network to access OpenSSH service
sshd: ALL

Remove useless services

Remove useless services(e.g. avahi, cups) from Debian or Linux if necessary.

[command]
apt-get remove avahi-daemon avahi-utils cups

[reference]
https://bullyvard.wordpress.com/2012/02/05/remove-cups-avahi-daemon-and-apparmor-from-ubuntu/

Add a sudo user

It tells you how to add a sudo user.

[command]
sudo adduser hubert
sudo usermod -aG sudo hubert

Install OpenSSH

It tells you how to install OpenSSH via apt-get utility.

[command]
sudo apt-get install openssh-server

Don't forget to deny root login.

[command]
sudo vi /etc/ssh/sshd_config

[modify]
::: Before :::
PermitRootLogin yes

::: After :::
PermitRootLogin no

Boot in text mode

It tells you how to by default boot in text mode for Debian or Linux.

[command]
sudo vi /etc/default/grub

[modify]
::: Before :::
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
#GRUB_CMDLINE_LINUX="text"
#GRUB_TERMINAL=console

::: After :::
#GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="text"
GRUB_TERMINAL=console
---------------------------------------------------------------

Update grub to apply the new settings.

[command]
sudo update-grub

Reboot Debian to check result.

[reference]
http://ask.xmodulo.com/boot-into-command-line-ubuntu-debian.html