Posts

Showing posts from May, 2008

Linux 文件亂碼轉換

iconv -f gbk -t utf8 文件.txt > 文件.txt.utf8

"真" 加菲貓

四川震區 急需 260 萬頂帳篷

Subject: 急需 260 萬頂帳篷 - 懇請廣大發佈商立即幫助發佈四川震區求助資訊!From: adsense-noreply-zhs@google.comDate: 17/5/2008 23:53今天早些時候,穀歌接到來自四川震區政府和攝製組的求助資訊,由於一直下雨,綿陽北川地區的大量災民情況非常堪憂,現在急需可以讓災民避雨的60萬頂帳篷!根據下午四川政府最新發佈的資訊,全省急需帳篷總共260萬頂!借助網路的力量,讓更多的人瞭解災區的求助資訊,協助災區的同胞最大限度地得到幫助,是我們AdSense小組每一位成員最大的心願和義不容辭的責任。為此,我們懇請廣大發佈商在看到這一消息時,請立即在您的網站上説明發佈這一資訊,使得我們災區同胞能夠少度過一個冰冷潮濕的夜晚,多一份溫暖。一個網站的力量有限,聯合起來力量無窮。您的幫助和努力對災區人民是莫大的希望。在此,我們衷心希望所有的發佈商和我們聯合起來,充分發揮我們手中互聯網的力量,為抗震救災出一份力!我們今後還會不斷發佈來自災區的求助資訊,如果您願意和我們攜手幫助災區同胞抗震救災,重建家園,請您註冊 Google AdSense 抗震愛心聯盟 https://spreadsheets.google.com/a/google.com/viewform?key=psN9iO-vpoNkmBZ20KeBkEQ,我們會在需要的時候第一時間與您聯絡。另外,也請您放心,您所提供的聯繫方式將僅作為抗震救災聯繫所有,我們將嚴格保護您的資訊隱私。最後,我們對您的幫助表示由衷的敬佩和感謝!Google AdSense 小組敬上

Solaris 10 - boot from the CLI instead of the GUI

svcadm disable graphical-login/cde-login:default

*The problem with doing it that way is you then can't use your Solaris host to run SunRay thin clients. If you need to use the box as a SunRay server, you'll have to remove the reference to the :0 display somewhere in /etc/dt/config/Xconfig, IIRC.

Linux - Use Windows boot loader to boot Fedora (boot.ini)

Partition Allocation
/dev/sda1 20G - Windows XP (NTFS)
/dev/sda2 88G - Data (NTFS)
/dev/sda3 10G - Fedora 9 (ext3)
/dev/sda4 2G - SWAP (swap)

1. install Windows XP
create C:\ with 20G
create D:\ with 88G
install Windows on C:\

2. Install Fedora 9
create \ paratition on /dev/sda3
create SWAP partition on /dev/sda4
install GRUB on /dev/sda3
install Fedora on /dev/sda3

3. Create Linux boot configuration file
CD boot
type "linux rescue" or Select "Rescue installed program"
choose language "English"
choose keyboard "US"
Setup Network "No"
Rescue "Continue"
type "chroot /mnt/sysimage"
type "dd if=/dev/hda1 of=/grub.lnx bs=512 count=1"

Insert USB disk
type "fdisk –l" to list out the inserted USB
type "cd /mnt"
type "mkdir usb"
type "mount /dev/sda1 /mnt/usbdisk"
type "cp /grub.lnx /mnt/usbdisk"
type "umount /mnt/usbdisk"

Reboot into Windows XP

4. Edit Windows Boot menu
copy grub.ln…

支持人民解放軍,抗洪,抗冰,抗震,他們都是沖在第一線的,大家不要再詆毀,批評他們了

Windows password cracker

Ophcrack is a free Windows password cracker based on rainbow tables. It is a very efficient implementation of rainbow tables done by the inventors of the method. It comes with a Graphical User Interface and runs on multiple platforms.

溫家寶總理 加油! 這是命令 :)

【星島網訊】國家總理溫家寶12日趕赴四川災區,有媒體記者在都江堰搶救現場直播,全程記錄溫家寶指揮抗災的過程。

  直播中數次提到溫家寶在搶救現場的行動和話語,溫家寶看到災情後痛哭不已,還曾摔倒導致手臂受傷出血。溫家寶還在電話裡指揮救援人員,“我不管你們怎麼樣,我只要這10萬群眾脫險,這是命令。”溫家寶在和登機部隊官員說話時表示,“我就一句話,是人民在養你們,你們自己看著辦

笨小偷

Falling

Inside box

Linux - Use Proxy Server To Access Internet at Shell Prompt

Set http_proxy shell variable
$ export http_proxy=http://server-ip:port/
$ export http_proxy=http://127.0.0.1:3128/
$ export http_proxy=http://proxy-server.mycorp.com:3128/

Setup proxy variable for all users?
# vi /etc/profile
Add the following information:
export http_proxy=http://proxy-server.mycorp.com:3128/

If password protected proxy server?
$ wget --proxy-user=USERNAME --proxy-password=PASSWORD http://path.to.domain.com/some.html

Lynx has following syntax:
$ lynx -pauth=USER:PASSWORD http://domain.com/path/html.file

Curl has following syntax:
$ curl --proxy-user user:password http://url.com/

Dream Computer Sun S20

Image

Such a stupid and dirty design!

Image
http://www.designodoubt.com/entry/Jelly-click-_-mouse-for-laptop

手冩 online 英漢雙向詞典

死神

Crazy Japan (1)

MySQL convert latin1 to utf-8

1. Backup database
mysqldump -h mydomain -u root -p --default-character-set=latin1 database > database.sql
2. In phpMyadmin, change MySQL charset as UTF-8 Unicode (utf8)
3. In phpMyadmin, change MySQL MySQL connection collation as utf8_general_ci
4. edit database.sql, replace "DEFAULT CHARSET=latin1" to "DEFAULT CHARSET=utf8"
5. Import database.sql
mysql -u root -p new_database < database.sql

Easy to eject USB disk

Image
USB Disk Ejector

A program that allows you to quickly remove USB devices in Windows. It was originally designed to remove only USB pen drives but will now eject any USB device. It can be run as a non-visual command line program or a normal gui program. Its very useful if you have a USB flash/pen drive, especially if you use a menu such as PStart or the Portable Apps launcher.

MIT OpenCourseWare / 麻省理工學院 開放式課

麻省理工學院 開放式課
MIT OpenCourseWare

這是一個免費、開放的教育資源,供給全世界各地的機構、學生和自學者使用。開放式課程系統代表麻省理工學院提升知識和教育水準的願景,並且為二十一世紀的世界服務。這個網站的目的正與麻省理工學院對於追求卓越、創意和領導的價值觀不謀而合。

麻省理工學院的「開放式課程網頁」:

* 是麻省理工學院教材的網路版。
* 不需要任何註冊。
* 並非是給予學位或是證照的網站。
* 並不提供麻省理工學院入學申請。

MIT OpenCourseWare (OCW) is a web-based publication of virtually all MIT course content. OCW is open and available to the world and is a permanent MIT activity.

What is MIT OpenCourseWare?
MIT OpenCourseWare is a free publication of MIT course materials that reflects almost all the undergraduate and graduate subjects taught at MIT.

* OCW is not an MIT education.
* OCW does not grant degrees or certificates.
* OCW does not provide access to MIT faculty.
* Materials may not reflect entire content of the course.

Linux - atime ctime mtime

文件的 Access time : atime 是在讀取文件或者執行文件時更改的。

文件的 Modified time : mtime 是在寫入文件時隨文件內容的更改而更改的。

文件的 Create time : ctime 是在寫入文件、更改所有者、許可權或鏈結設置時隨 Inode 的內容更改而更改的。

因此,更改文件的內容即會更改 mtime 和 ctime,
但是文件的 ctime 可能會在 mtime 未發生任何變化時更改 - 在許可權更改,但是文件內容沒有變化的情況下。


ls -lc filename 列出文件的 ctime

ls -lu filename 列出文件的 atime

ls -l filename 列出文件的 mtime

Linux - Check The Health of Adaptec RAID array

# /usr/StorMan/arcconf getconfig 1

Solution for Vista unable to connect to XP sharing

METHOD 1: Through Local Security Policy:
NOTE: This feature is for Vista Business, Ultimate, and Enterprise versions
only. For Vista Home Basic and Home Premium see METHOD 2 below.

1. Open Administrative Tools.
NOTE: In Start Menu or Control Panel (Classic View).
2. Click Local Security Policy.
3. In the left pane, click the triangle next to Local Policy.
4. In the left pane, click Security Options.
5. In the right pane near the bottom, click Network security: LAN manager
authentication level.
6. Click the drop down box, and click Send LM & NTLM - use NTLMv2 session
security if negotiated.
7. Click OK.
8. Restart the computer.


METHOD 2: Hack the Registry:
NOTE: This is for Vista Home versions.

1. Open the Start Menu.
2. In the white line (Start Search) area, type regedit and press Enter.
3. Click Continue for UAC prompt.
4. In regedit, go to: -HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Lsa
5. In the right pane, right click LmCompatibilityLevel and click Modify.
NOTE: If it doesn't alread…

Linux - use multiple screens on one terminal

# Install screen
yum install screen

# Start screen session. You can name your window/session (1 is name of session)
screen -S 1

# Create new session
# first hit CTRL+a, releases both keys and press c

# Switching between sessions
# first hit CTRL+a, releases both keys and press n

# list all sessions
# first hit CTRL+a, releases both keys and press "

# switch to window by number
# first hit CTRL+a, releases both keys and press '

# help manual
# first hit CTRL+a, releases both keys and press ?

Ctrl+a c --- new window
Ctrl+a n --- next window
Ctrl+a p --- previous window
Ctrl+a " --- select window from list
Ctrl+a Ctrl+a --- previous window viewed

Ctrl+a :resize --- resize region
Ctrl+a :fit --- fit screen size to new terminal size
Ctrl+a :remove --- remove region
Ctrl+a tab --- Move to next region

Ctrl+a d --- detach screen from terminal, Start screen with -r option to reattach
Ctrl+a A --- set window title
Ctrl+a x --- lock session, Enter user pa…

Linux - Spindown (spin down idle disks)

Spindown is a daemon to spin down idle disks and thus save energy and give the disks a longer lifetime. It also works with USB disks and hot-swappable disks because it uses the device ID to identify the disk instead of the device name (such as hda or sdb). This means that it doesn't matter if the disk is swapped while the daemon is running.

Installation

$ tar xvzf spindown-x.x.x.tar.gz
$ cd spindown-x.x.x.tar.gz
$ make
# make install
# mv /etc/spindown.conf.example /etc/spindown.conf

Configuration

# ls -l /dev/disk/by-id/ #---- find out HDD id


# vi /etc/spindown.conf

[General]
cycle-time = 60
idle-time = 3600

[Disk 1]
name = hda
spindown = 1

[Disk 2]
name = sda
spindown = 1
command = --pc=2

#---- use command " sg_start --stop --pc=2 /dev/hda " to test the command parameter

Usage

# /etc/init.d/spindown start

# /etc/init.d/spindown status

# spindownd --help

使用 Apache htaccess 插入Header/Footer

當看到一卡車的檔案, 每個檔案都要進去裡面加個 include 或某些資料, 想到就很辛苦~ 另一種做法就是用 Apache .htaccess 的功能, 就可以快速達到這點~ .htaccess 是對整個目錄以下的做動作, 所以下述參數會對此目錄的所有檔案都加上 header.php. php_value auto_prepend_file / auto_append_file 設定 php_value auto_prepend_file "header.php" # 在每個檔案的最上方(前方), 都把 header.php 的內容插入php_value auto_append_file "footer.php" # 在每個檔案的最下方(後方), 都把 footer.php 的內容插入其它常用設定DirectoryIndex index.html index.htm index.php # 此目錄下如果沒輸入檔名, 預設搜尋順序AddType application/x-httpd-php .html .htm # 讓 .html .htm 都經過 php parserphp_value default_charset utf-8 # 預設編碼吐 UTF-8

Linux - create large dummy files

dd if=/dev/zero of=filename bs=1M count=1 seek=50

it should create a 51Mb file by writing 1Mb of data but seeking 50meg into a file first.

甩尾