Archive

‘Linux’ 分類過的Archive

Shell script輸出有顏色的文字

2011年7月22日 Austin 尚無評論
# Color defination
txtRed=$(tput setaf 1)
txtGreen=$(tput setaf 2)
txtYellow=$(tput setaf 3)
txtBlue=$(tput setaf 4)
txtPurple=$(tput setaf 5)
txtCyan=$(tput setaf 6)
txtWhite=$(tput setaf 7)
txtReset=$(tput sgr0)

# Style defination
txtBold=$(tput bold)
txtUL=$(tput smul)

# Example
echo "${txtRed}Red text"
echo "still Red text"

echo "$txtReset"
echo "Normal text"

Reference: How to echo colored text in linux shell script

Categories: Linux, 未分類 Tags: , , , ,

Cygwin快速複製貼上

2010年12月1日 Austin 尚無評論

Step 1. 啟動Cygwin

Step 2. 開啟視窗內容
標題列按右鍵 => 內容

Step 3. 勾選快速編輯模式
選項 => 快速編輯模式 => 確定

Categories: Linux, Windows, 未分類 Tags:

Install Intel C++ Compiler on Ubuntu 9.10(64bit)

2010年3月15日 Austin 尚無評論

安裝相關套件:

# 必要套件
sudo apt-get install gcc build-essential g++ rpm

# this is only required on 64bit Ubuntu/Debian systems
sudo apt-get install ia32-libs

# For use the Intel IDB graphical debugger
sudo apt-get install openjdk-6-jre-headless

Ubuntu 9.10後改用libstdc++6,而Install Intel C++ Compiler需要libstdc++5,所以要另外安裝。先到http://packages.debian.org/stable/base/libstdc++5下載adm64的版本用dpkg安裝,再下載i386解開,並取出函式庫

# 下載並adm64的版本
wget http://debian.linux.org.tw/debian/pool/main/g/gcc-3.3/libstdc++5_3.3.6-18_amd64.deb
sudo dpkg -i libstdc++5_3.3.6-18_amd64.deb

# 下載i386並解開
wget http://debian.linux.org.tw/debian/pool/main/g/gcc-3.3/libstdc++5_3.3.6-18_i386.deb
dpkg --extract libstdc++5_3.3.6-18_i386.deb ./

# 出函式庫
cd usr/lib
sudo cp libstdc++.so.5.0.7 /usr/lib32
cd /usr/lib32
sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5

然後就可進入Install Intel C++ Compiler的安裝了,裝完之後把下面指令加入到.bashrc即可直接使用icc

source /opt/intel/Compiler/11.1/069/bin/iccvars.sh intel64

 

參考資料:Using Intel Compilers for Linux with Ubuntu

Categories: C/C++, Linux Tags: , , , ,

vsftp Virtual User對MySQL認證 – 建立使用者

2009年4月14日 Austin 尚無評論

假設現在要建立一個使用者帳號test密碼testpss
並將登入後的根目錄指定到/xxx/abc

vsftp的帳號是存在vsftp這個資料庫內的users這個table
帳號的欄位是username,密碼是password
user_config_dir=/etc/vsftpd/vsftpd_user_conf/

Step 1. 建立帳號
進入資料庫執行下列語法

閱讀全文…

Categories: Linux, MySQL, 未分類 Tags: , , ,

X Client by putty + Xming

2009年3月24日 Austin 尚無評論

Xming:官方網站
Public Domain Releases:Xming 6.9.0.31Xming-fonts 7.4.0.3
Website Releases:Xming 7.4.0.3(See Donations for how to obtain a donor password)

Step 1. 下載及安裝
基本上裝Xming就可以跑了,不過最好還是要裝Xming-fonts比較不會有些字出不來

Step 2. 啟動XLaunch
開始 => 程式集 => Xming => XLaunch
然後一直下一步就對了

閱讀全文…

Categories: Linux, 未分類 Tags: , , , ,

Apache頻寬限制 by mod_bw

2009年1月21日 Austin 尚無評論

官方網站:Ivn Systems/Software

[/bash]
# 要先安裝apache-devel or httpd-devel
wget http://www.ivn.cl/apache/files/source/mod_bw-0.8.tgz
tar -zxvf mod_bw-0.8.tgz
cd mod_bw
/usr/sbin/apxs -i -a -c mod_bw.c
[bash]

下面是頻寬設定
vi /etc/httpd/conf.d/bw.conf

# 啟動頻寬限制
BandWidthModule On
ForceBandWidthModule On

# BandWidth [From] [bytes/s]
Bandwidth all 409600

# MinBandWidth [From] [bytes/s]
MinBandwidth all 102400

連線數*MinBandWidth < BandWidth時,每個連線的速度會均分BandWidth
連線數*MinBandWidth < BandWidth時,每個連線的速度會等於MinBandWidth
一次載1個檔400kb、一次載2個檔200kb、一次載5個檔100kb

快速建置Ubuntu Desktop(with Lazybuntu)

2009年1月9日 Austin 尚無評論

Lazybuntu 懶人包
先去下載最新版本,抓回來解開執行就對了
我只多勾了 網路應用=>IE4Linux
其他的視情況而定,不過預設選項就差不多ok了
選完之後按下套用就會自動開始安裝了
過程會有跳出幾個視窗會問是否套用到全部使用者等等…
還有java的license要按個OK
其他的就是等他跑囉!

上面跑完會出現 Lazybuntu 安裝完畢的藍色字樣
接著執行我自己的Ubuntu Installation

wget http://blog.gclin.org/wp-content/uploads/2008/11/ubuntu_installation_v02.tgz
tar -zxf ubuntu_installation_v02.tgz
sudo ./ubuntu_installation_v0.2/install.sh
# 等跑完記得看一下setting.txt檢查是否有要改的設定

Joomla安裝後要開放權限的目錄

2008年12月9日 Austin 尚無評論

最簡單的方式是從FTP直接把檔案屬性設成777
不過比較好的方式:
Linux是把Group指給web server再把group加上寫入的權限
Windows是在目錄安全性增加IUSER_xxxxxxx(IIS)這個使用者,並給完全控制

要改權限的目錄列表:

administrator/backups/
administrator/cache/
administrator/components/
administrator/language/
administrator/modules/
administrator/templates/
cache/
components/
images/
language/
media/
modules/
plugins/
tmp/
templates/

Categories: Joomla, Linux, 未分類 Tags: ,

在Ubuntu上安裝AWStats

2008年11月14日 Austin 尚無評論

What is AWStats
AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. This log analyzer works as a CGI or from command line and shows you all possible information your log contains, in few graphical web pages. It uses a partial information file to be able to process large log files, often and quickly. It can analyze log files from all major server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers.

閱讀全文…

Ubuntu Installation v0.2

2008年11月7日 Austin 尚無評論

ubuntu_installation_v0.2

wget http://blog.gclin.org/wp-content/uploads/2008/11/ubuntu_installation_v02.tgz
tar -zxf ubuntu_installation_v02.tgz
sudo ./ubuntu_installation_v0.2/install.sh

閱讀全文…