星期四, 1月 17, 2013

Raspberry Pi 筆記

第一步,更新:
sudo apt-get update
sudo apt-get upgrade -y

安裝並轉用 vim:
sudo apt-get install vim
sudo update-alternatives --config editor

設定 reverse tunnel:
sudo apt-get install autossh
# allow connect to SSH via port 65522 on server.tld
autossh -NfR 65522:localhost:22 user@server.tld
# add the above line with @reboot prefix in crontab
crontab -e

安裝 VNC:
sudo apt-get install tightvncserver
# run it once to set password
tightvncserver
# start vnc server with display 0 at 1920x1080 resolution
vncserver :0 -geometry 1920x1080 -depth 24

安裝 Firefox:
sudo apt-get install iceweasel

安裝 Chrome:
# Install ttf fonts
sudo apt-get install ttf-mscorefonts-installer ttf-wqy-zenhei
# Install Chromium (Open Source version of Chrome)
sudo apt-get install chromium-browser

播放 MP3:
sudo apt-get install alsa-utils ntpdate mpg123 python-virtualenv libshout3 libshout3-dev pkg-config python-dev
sudo modprobe snd_bcm2835
sudo amixer cset numid=3 1
mpg123 filename.mp3

設立 AirPrint:
sudo apt-get install avahi-daemon avahi-discover libnss-mdns cups cups-pdf python-cups
sudo usermod -aG lpadmin pi
# add "Allow from @Local" to Location section of / , /admin and /admin/conf
sudo vim /etc/cups/cupsd.conf
# add mine types for AirPrint
sudo echo '#
# "$Id: $"
#
# AirPrint type
image/urf urf string(0,UNIRAST<00>)
#
# End of "$Id: $".
#
' | sudo tee /usr/share/cups/mime/airprint.types > /dev/null
sudo echo '#
# "$Id: $"
#
# AirPrint
# Updated list with minimal set 25 Sept
image/urf application/pdf 100 pdftoraster
#
# End of "$Id: $".
#
' | sudo tee /usr/share/cups/mime/airprint.convs > /dev/null
sudo service cups restart
### go to https://raspberrypi:631/ and setup the printer
# download and run the airprint-generate script
wget https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py
chmod 0755 airprint-generate.py
sudo ./airprint-generate.py -d /etc/avahi/services
sudo service avahi-daemon restart

設定時區:
sudo dpkg-reconfigure tzdata

播放 H.264 / MP4 影片:
omxplayer filename.mp4

### Key bindings
# Key   Action
#  1    Increase Speed
#  2    Decrease Speed
#  j    Previous Audio stream
#  k    Next Audio stream
#  i    Previous Chapter
#  o    Next Chapter
#  n    Previous Subtitle stream
#  m    Next Subtitle stream
#  s    Toggle subtitles
#  q    Exit OMXPlayer
# Space Pause/Resume
#  p    Pause/Resume
#  -    Decrease Volume
#  +    Increase Volume
# Left  Seek -30
# Right Seek +30
# Down  Seek -600
#  Up   Seek +600

暫停/繼續一個 process:
kill -STOP <pid>
kill -CONT <pid>

(將會持續更新...)

星期一, 1月 14, 2013

不用任何外置裝置在 MacBook Air 上重裝 Window 7

標題很長,但因為我的處境太奇怪,所以只好寫成這樣...
方法主要根據 SevenForums 上的 How to Install Windows 7 FAST without a DVD or USB Device,再加上幾個步驟。

我的處境:
  • 電腦: Apple MacBook Air
  • 沒有光碟機
  • 沒有 USB Disk
  • 主系統: Mac OS X 10.8
  • BOOTCAMP 系統: Windows 8
使用軟件:
目的: 移除超難用而且兼容性太低的 Windows 8,重新安裝 Windows 7

步驟:
  1. 在 OS X 上,使用 vmware-rawdiskCreator 製成一個指向 BOOTCAMP 硬碟分割的 vmdk 檔案 
  2. /Applications/VMware\ Fusion.app/Contents/Library/vmware-rawdiskCreator create /dev/disk0 1 "/Users/howang/Desktop/bootcamp" ide
    
  3. 修改我原有的 Windows XP VM(虛擬機) 的 VMware 設定檔 (vmx 檔),為 VM 加入 BOOTCAMP 硬碟
  4. ide0:0.present = "TRUE"
    ide0:0.fileName = "/Users/howang/Desktop/bootcamp.vmdk"
    
  5. 啟動 Windows XP VM,在 VMware 中掛載 Window 7 的 ISO 檔
  6. 在 XP 中格式化 BOOTCAMP 硬碟分割
  7. 根據 How to Install Windows 7 FAST without a DVD or USB Device 的方法,使用 ImageX 工具把 Windows 7 的 install.wim 套用到 BOOTCAMP 碟碟分割中
  8. imagex /apply d:\sources\install.wim 5 e:\
    
  9. 把 Windows XP VM 關機,修改 vmx 檔,刪去原有 Windows XP 的虛擬硬碟
  10. 重新啟動 Windows XP VM,這次使用 Windows 7 的 ISO 檔 boot 機,選擇 "Repair my computer" 並開啟 Command Prompt (命令提示字元)
  11. 輸入:
  12. c:\windows\system32\bcdboot c:\windows
    d:\boot\bootsect /nt60 c: 
  13. 把 Windows XP VM 關機(重要:千萬不要在 VM 中用 BOOTCAMP 碟碟分割開機,會令安裝失敗的)
  14. 重新啟動電腦,使用 BOOTCAMP 開機,Windows 7 會自動完成安裝 ^.^

星期三, 3月 18, 2009

howang @ Twitter

雖然香港仲未話係好流行,但係我覺得 Twitter 最適合我呢d想寫野但係又唔係成日得閒寫水尾春咁長的 blog 的人。

http://twitter.com/howang

星期三, 10月 03, 2007

學校check學生的xanga?

一看標題,咦!?不是舊聞嗎?對!不過基於某些原因近日我回想此事有感而發,希望分享一下意見。很多人在forum大吐苦水,學校追究他/她在xanga上寫的言論,受害人多數認為xanga是私人的網上日記,不應被學校干涉。其實受害人的xanga本身可以在網上被任何人觀看,既然寫了在xanga上,就要有心理準備該日記會被任何人閱讀,受害人根本沒有考慮這一點,就把很多不見得人的文字寫上,被看到被追究是自找的。沒錯我自己也曾把不能被某些人看見的事寫在網誌中,但很多到了現在被那些不應看到的人看到也不重要了。我也曾利用xanga去查看究竟別人怎樣看我,當然寫的人不會直接對我說,但這卻令我知道那些人喜歡我,那些人討厭我,從而進行自我反思,並找出別人討厭我的原因,繼而改善我的待人接物態度,取得更好的人際關係,但世人並不是個個都像我,現實中,看的可能是老闆,可能是上司,也可能是敵人,結果會是怎樣,也不用多說吧。如果大家有什麼不吐不快,不妨試試隱藏自己的身份,又或者善用blogger的權限管理,打造真正私人的網誌。
xanga?算把啦,支持blogger無廣告、速度快!

星期四, 8月 30, 2007

初試咩機之軟件心得

擁有一部咩機*已經一個星期了,努力熟習中。

軟件心得篇
﹣ 硬件買左就冇得變,唯有軟件可以變。
大部份都是 freeware 或是預載的程式,其餘的是 Demo 版。