2012年8月7日

Automatically append version information to the version string

http://blog.lexical.tw/2010/09/configlocalversionautogit-describe.html
http://tw.myblog.yahoo.com/blue-comic/article?mid=-2&prev=715&l=a&fid=1

2012年6月6日

FreeRADIUS Installation on Ubuntu

1. Install Radius Server

sudo apt-get install freeradius

2. configure Radius Server

- configuration file path /etc/freeradius/

radiusd.conf (FreeRADIUS system configuration file)

clients.conf (client authentication configuration file)

client
{
secret =
shortname =
}

client 192.168.1.100{
secret = tseting123
shorename = private-network-1
}

users (cient)
testing Cleartext-Password := "password"



3. start Radius Server

sudo /usr/sbin/freeradius -X



1. 要產生憑證前先確認自己的linux上已經有裝好了openssl

#cd /usr/lib/ssl/misc/

#./CA.pl -newca

Enter PEM pass phrase: 12345 (自行輸入憑證密碼)

Country Name (2 letter code) [AU]:TW

State or Province Name (full name) [Some-State]:Taipei

Locality Name (eg, city) []:Taipei

Organization Name (eg, company) [Internet Widgits Pty Ltd]:ABC

Organizational Unit Name (eg, section) []:DEF

Common Name (eg, YOUR name) []:HIJ

Email Address []:e@e.e

2. 伺服器端認證檔案

#openssl req -new -nodes -keyout srv_key.pem -out srv_req.pem -config ../openssl.cnf

#openssl ca -config ../openssl.cnf -policy policy_anything -out srv_cert.pem -infiles ./srv_req.pem

#cat srv_key.pem srv_cert.pem > srv_keycert.pem

3. 客戶端認證檔案

#openssl req -new -keyout cli_key.pem -out cli_req.pem -config ../openssl.cnf

#openssl ca -config ../openssl.cnf -policy policy_anything -out cli_cert.pem -infiles ./cli_req.pem

#openssl pkcs12 -export -in cli_cert.pem -inkey cli_key.pem -out cli_cert.p12 -clcerts (for XP certificate format)

4. 產生兩個使用tls憑證需要用到的檔案

#openssl dhparam -check -text -5 512 -out dh

#dd if=/dev/urandom of=random count=2

5. 把上述的伺服器端檔案copy到/usr/local/etc/raddb/certs

6.

radiusd.conf: (mark了三行,下面的紅色井字號為mark)

#$INCLUDE sql.conf

#INCLUDE sql/mysql/counter.conf

#$INCLUDE sqlippool.conf

clients.conf:

client 192.168.1.1 {
secret = sodisgood
shortname = sod-ap
}

eap.conf: (修改了一些部分,並且添加了tls憑證部分)

default_eap_type = tls (原本是md5)

private_key_password = 12345 (產生憑證時輸入的密碼)

private_key_file = ${certdir}/srv_keycert.pem (當時後產生的伺服器憑證)

certificate_file = ${certdir}/srv_keycert.pem (同上)

CA_file = ${cadir}/cacert.pem (這個檔案會在demoCA裡面)

dh_file = ${certdir}/dh (tls需要用到的檔案)

random_file = ${certdir}/random (同上)

7. start server

#radiusd -X & (-X是debug mode,&是背景執行)


Ref: http://tec1021.pixnet.net/blog/post/28639573-%E8%BC%95%E9%AC%86%E6%9E%B6%E5%A5%BDradius%E4%BC%BA%E6%9C%8D%E5%99%A8~

2011年12月23日

C Language - FILE

#include
FILE *fopen(const char *文件陀螺, 表示打开方式的字符串);

表示打开方式的字符串有几个需要注意一下:

"w"与"w+" :
这两个方式打开文件时,蕤文件不存在会创建文件,
"w"只能写文件,"w+"能够读写文件.

"r"与"r+"
若文件不存在,则打开失败(不会创建新文件)
"r"只能读文件,"r+"能够读写文件.


"w+"与"r+"都能读写文件,它们的区别是,"w+"在文件不存在时会创建文件,而"r+"在文件不存在时,不会创建文件.
――――― 分隔线 ―――――

fseek()
移动读和写文件时的文件指向位置,注意:第一个位置号是0而不是1

2011年12月2日

WDS - Bridge and Repeater

WDS的目的是延伸無線網路,它有分bridge和repeater二種,首需要二台相同品牌,相同機種的AP(建議)
brideg是指LAN1-->AP1-->Wireless-->AP2-->LAN2,AP1與AP2分別接到區域網路(有線)中,AP1/AP2中間是用無線接起來的,此時無線網路只有AP1到AP2中,其他NB不能利用無線連線
repeater是指LAN-->AP1-->Wireless-->AP2-->Wireless,AP1/路AP2利用無線連起來外,AP1/AP2也提供無線網給NB用,只是在AP2提供的無線網路速度會減半

2011年4月11日

SVN

Changelog Between Two Tags in Subversion
#svn log -v -r42:79 file:///dev/svn/trunk


Merge branch test
#svn merge --dry-run -r OLD_REV:NEW_REV {branch path}
Merge branch
#svn merge -r OLD_REV:NEW_REV {branch path}
#svn commit -m "LOG"

Ref:http://svnbook.red-bean.com/en/1.1/ch04s04.html


new revision: 888
old revision: 777
#svn merge -r 888:777
==> rollback from 888 revision to 777 revision
Ref: http://stwei.blogspot.com/2010/06/howto-svn-rollback.html

2011年2月14日

Makefile

$?: 代表已被更新的 dependencies 的值。也就是 dependencies 中,比 targets 還新的值。
$@: 代表 targets 的值。
$<: 代表第一個 dependencies 的值。
$*: 代表 targets 所指定的檔案,但不包含副檔名。


* make -k: 會讓make在遇到錯誤的時候仍然運行,而不會停在第一個問題
* make -n: 只印出將會進行的工作,而不會真的去執行
* make -f makefile_name: 告訴make需要用那個makefile檔案。當你的make檔不是叫makefile的時候,需要自行透過-f加上你檔案名字,make才找的到你的makefile



Ref:
http://tetralet.luna.com.tw/index.php?op=ViewArticle&articleId=185&blogId=1
http://kevincrazy.pixnet.net/blog/post/29780477
http://hsian-studio.blogspot.com/2008/09/makefile_08.html

2010年11月18日

Allowing Root Logins to Telnet and FTP Services

只要編輯/etc/securetty即可
加入以下就可以讓10個session以root telnet登入
pts/0
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
pts/7
pts/8
pts/9

Ref: http://www.idevelopment.info/data/Unix/Linux/LINUX_TelnetFTPAsRoot.shtml

2010年9月12日

如何清除網路芳鄰的記憶密碼

http://blog.roodo.com/horoyang/archives/7435049.html

2010年8月16日

stdout stderr

1 - denotes stdout ( standard output )
2 - denotes stderr ( standard error )
/dev/null . apparently is null , nothing , empty , zero etc , etc .

2>/dev/null - redirect stderr to nothing , it turns stderr off.

>/dev/null 2>&1 also can write as 1>/dev/null 2>&1 - stdout redirect to /dev/null (no stdout) ,and redirect stderr to stdout (stderr gone as well) . end up it turns both stderr and stdout off

a little practice may help to undstand above .
#ls /usr /nothing
#ls /usr /nothing 2>/dev/null
#ls /usr /nothing >/dev/null 2>&1

2010年3月7日

WinXP 網芳 密碼

刪除
net use * /del /y
管理
control userpasswords2

2010年2月10日

CVS Command

Root:
#export CVSROOT=:pserver:[user name]@[server]:/share/service/cvs

Checkout:
#cvs checkout -d [folder name] -r [tag] "[server code path]"

Commit:
#cvs commit -m "[log]"

Branch:
#cvs tag -b [branch name]

Checkout Branch:
#cvs checkout -d [folder name] -r [branch name] "[server code path]"

Look Up Version:
#cvs status -v

Look Up Log:
#cvs log -S -d "2005/10/1<2005/10/3">
/*To show the headers of files in the current directory created after October 1, 2005 through the present time*/

Add Tag:
#cvs tag tag_name

checkout by tag:
#cvs co -r tag_name output_path

checkout by date:
#cvs checkout -D "mm/dd/yyyy hh:mm" -d [folder name] "[server code path]"

look changelog
#cvs2cl.pl -r
#vim ChangeLog

UBOOT-gd

gd指標在需要使用它的函數中定義(用DECLARE_GLOBAL_DATA_PTR)為一各區域變數
因為在uboot中用一個固定的暫存器來存放這個指標,所以即使是區域變數,但是他再所有使用到他的地方都是一樣的值,這個值在board_init_f中初始化,指向CFG_GBL_DATA_ADDR

2009年11月12日

Inter Integrated Circuit ( I2C )

http://tw.knowledge.yahoo.com/question/question?qid=1506122504420
http://tw.knowledge.yahoo.com/question/question?qid=1306033007425
http://www.ti.com.tw/articles/detail.asp?sno=74

2009年10月29日

checksum

http://gd.tuwien.ac.at/languages/c/cref-mleslie/CONTRIB/SNIP/checksum.c

Point to Function, size_t

http://bbs2.nchu.edu.tw:8000/gemmore/programming&F0TASFN1&4

2009年6月20日

Typedef Function Pointer

http://phorum.study-area.org/index.php?topic=21728.0
http://squall.cs.ntou.edu.tw/cpp/94spring/lab03/Lab3-2.html
http://www.programmer-club.com.tw/ShowSameTitleN/c/25059.html
http://caterpillar.onlyfun.net/Gossip/CGossip/FunctionPointer.html

2009年5月6日

Linux Shell 下的輸出重定向

Linux Shell 環境中支持輸入輸出重定向,用符號<和>來表示。0、1和2分別表示標準輸入、標準輸出和標準錯誤信息輸出。同時,還可以在這三個標準輸入輸出之間實現重定向,比如將錯誤信息重定向到標準輸出,可以用 2>&1來實現。Linux下還有一個特殊的文件/dev/null,它就像一個無底洞,所有重定向到它的信息都會消失得無影無蹤。如果想要正常輸出和錯誤信息都不顯示,則要把標準輸出和標準錯誤都重定向到/dev/null, 例如:
# ls >/dev/null 2>&1
注意:此處的順序不能更改,否則達不到想要的效果,此時先將標準輸出重定向到 /dev/null,然後將標準錯誤重定向到標準輸出,由於標準輸出已經重定向到了/dev/null,因此標準錯誤也會重定向到/dev/null,於是一切靜悄悄.

Reference
http://blog.daviesliu.net/2005/08/31/200811/

2008年11月12日

[Linux] Install Vmware-tools on Fedora Core 8

Step 1. Install gcc
#yum install gcc

Step 2. Install kernel-devel
#yum install kernel-devel

Step 3. Check if the version number of kernel and the version number of kernel-devel are the same
#uname -r
#rpm -q kernel-devel

Step 4. Upgrade kernel and kernel-devel if their version number showed in in Step 3. are different
#yum -y upgrade kernel kernel-devel
Go to Step 3.

Step 5. Reboot
#init 6

Step 6. Put vmware-tools in running FC8
Removable Devices > CD-ROM > Edit -->
Select Auto detect and check Legacy emulation
VM > Install VMware Tools Install

Step 7. Install vmware-tools
#mount /dev/cdrom /mnt
#cp /mnt/VMwareTools-*.tar.gz /tmp
#cd /tmp
#tar -zxvf VMwareTools-*.tar.gz
#cd vmware-tools-distrib
#./cd vmware-install.pl
...


Reference
http://163.23.24.147/ya/read-287.html
http://hi.baidu.com/sinauc/blog/item/2d393754243636c2b745ae24.html