聚會時間公告: 因應COSCUP 2011, Kalug 8月份休會一次

一月 12, 2013
» FreedomBox (with DreamPlug) 開箱文(上)

要介紹FreedomBox首先要看一下James Vasile的這段影片,


某日下午在捷運站前咖啡廳獲得 FreedomBox 購物袋。

裡面是一台DreamPlug!

怎麼被簽字筆畫的亂七八招?這個難道是 ebay 標回來所謂的"九成新"?

Wait… James. 不是本文開頭影片中髮量稀疏的型男嗎?法律博士兼FreedomBox Foundation執行長的 James?

原來是這台機器的主人(洪朝貴 教授)大力支持這個計畫,在 kickstarter 贊助 FreedomBox 所得到的 FreedomBox 核心團隊簽名的紀念機種。

FreefomBox CommunityAngel

Pledge $1,500 or more
16 backers
In honor of your generosity, the FreedomBox Foundation team will personally sign your custom plug computer and we will laser etch each one with a serial number to show that you helped at the very beginning. First pledged, first in line for early numbered plugs. (Shipping included) (Note: this reward replaces the unsigned plug computer offered at the previous pledge level but does include all other rewards above it on the list)

讓我們回歸正題,把箱子繼續開下去。

原來這箱子有兩層!!還沒繼續開下去我就已經對這台設備如此用心的包裝感動不已,這精美的紙箱設計簡直可與台北設計獎工業設計類金獎作品相比。

掀開第一層精美的瓦怔紙箱,第二層出現的是橫式車檔貼紙、說明書與紀念CD。

電源線、USB線、網路線(比電源線還粗)、freedombox隨身碟、兩種不同的插座頭、後擋板… hum… 這個黑黑的小盒子是甚麼?

居然是JTAG Board!我在某公司做Embedded Linux這麼多年也沒看過幾台JTAG Board!隨機出貨配 JTAG Board… 這… 老實說這還真不賴。

回過頭來關心一下DreamPlug的本體。
本體分成兩塊,上面是Power module,下面則是主機。Power module也可以換成後擋板外接變壓器。

一側是UART、USB、RESET Button、光纖、JTAG、Two Gigabit Ethernet 。

另一側,噯呀拿斜了… 另一側就是MicPhone, Audio Output, ESATA, SD 跟另一個USB。

以上,接下來讓我們開機連看看…

不過剛好桌子有點小,加上要電源跟網路孔。所以就拿Raspberry Pi來連DreamPlug。
(是的… 我還可以搞的更複雜一點。)

Raspberry Pi 好小好可愛啊。(大心) 迷之音:想買的話 Ruten 已經買的到囉。

DreamPlug的JTAG Board也是一個USB Serial Device,一端接上Pi後及出現。

[1599192.516016] usb 5-1: new full-speed USB device number 2 using uhci_hcd
[1599192.730036] usb 5-1: New USB device found, idVendor=9e88, idProduct=9e8f
[1599192.730042] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1599192.730046] usb 5-1: Product: SheevaPlug JTAGKey FT2232D B
[1599192.730049] usb 5-1: Manufacturer: FTDI
[1599192.730052] usb 5-1: SerialNumber: FTU80D0N
[1599192.886655] usbcore: registered new interface driver usbserial
[1599192.886672] usbcore: registered new interface driver usbserial_generic
[1599192.886684] USB Serial support registered for generic
[1599192.886692] usbserial: USB Serial Driver core
[1599192.901602] usbcore: registered new interface driver ftdi_sio
[1599192.901620] USB Serial support registered for FTDI USB Serial Device
[1599192.901761] usb 5-1: Ignoring serial port reserved for JTAG
[1599192.901799] ftdi_sio 5-1:1.1: FTDI USB Serial Device converter detected
[1599192.901844] usb 5-1: Detected FT2232C
[1599192.901846] usb 5-1: Number of endpoints 2
[1599192.901849] usb 5-1: Endpoint 1 MaxPacketSize 64
[1599192.901851] usb 5-1: Endpoint 2 MaxPacketSize 64
[1599192.901854] usb 5-1: Setting MaxPacketSize 64
[1599192.904137] usb 5-1: FTDI USB Serial Device converter now attached to ttyUSB0
[1599192.904157] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver

接著

pi@raspberrypi ~ $ screen /dev/ttyUSB0 115200

插上電之後就可以看到u-boot的畫面了。

U-Boot 2012.04.01 (Jun 01 2012 - 02:17:08)
Marvell-DreamPlug

SoC:   Kirkwood 88F6281_A1
DRAM:  512 MiB
WARNING: Caches not enabled
SF: Detected MX25L1605D with page size 64 KiB, total 2 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0, egiga1
88E1116 Initialized on egiga0
88E1116 Initialized on egiga1
Hit any key to stop autoboot:  0 
Marvell>> 

不過我們不用一開始從 u-boot.kwb 裝,因為這台機器的主人是FreedomBox社群天使… 裡面所有的東西都裝好了。

FreefomBox CommunityAngel

再一連串的initial script後,可以Login了。

Debian GNU/Linux wheezy/sid freedombox ttyS0

freedombox login:                

開起來了,開起來了!!快,快用root登入… 密碼是… f…ree…dom。 密碼都這麼自由,真是太酷了…

freedombox login: root           
Password: 
Last login: Sat Jan  1 00:26:53 UTC 2000 on ttyS0
Linux freedombox 3.2.0-3-kirkwood #1 Mon Jul 23 22:36:47 UTC 2012 armv5tel

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@freedombox:~# 
root@freedombox:~# 
root@freedombox:~# 

喔喔喔喔…. 可以登入了耶!!!

啊不就是一台Debian……………囧

等等… 說好的自由呢?

那… 就是下一篇囉,呵呵。

The post FreedomBox (with DreamPlug) 開箱文(上) appeared first on Kevinwatt's Blog.

十一月 8, 2012
» Go vs node.js vs PHP vs Python, Loop benchmark.

剛好跟lloyd大大聊到node.js V8的效能. 試寫了幾行發現速度還真是非常的快.

隨手用四種語言寫個forloop. 時間消耗依序是這樣的 Go < node.js < PHP < Python
其中 node.js 直譯器的需要編譯時間最長. 所以如果loop的max=100時.
其時間消耗變成這樣 Go < PHP < Python < node.js

這個實驗告訴我們 benchmark 是可以做到人人都滿意的。:P

package main
func main() {
    max := 1000000000
    var a,b,c int
    for i:=0;i<max;i++ {
        a = 1234 + 5678 + i
        b = 1234 * 5678 + i
        c = 1234 / 2 + i
    }
    _=a+b+c
}
var i, a, b, c, max;
max = 1000000000;
for (i = 0; i < max; i++) {
        a = 1234 + 5678 + i;
        b = 1234 * 5678 + i;
        c = 1234 / 2 + i;
}
<?
$max = 10000000;
for ($i = 0; $i < $max; $i++) {
    $a = 1234 + 5678 + $i;
    $b = 1234 * 5678 + $i;
    $c = 1234 / 2 + $i;
}
?>
max = 10000000;
for i in range(max):
    a = 1234 + 5678 + i
    b = 1234 * 5678 + i
    c = 1234 / 2 + i

仔細看code. Go & node.js 的for loop都比PHP & Python大了100倍.
因為nodejs的效能好到不能跟後兩者放在同一個量級比賽. 所以加了100倍之後拿來跟Go比.

在這邊Go很明顯多做一些事, 那是因為Go不能宣告了變數又不用.

time ./b;time node b.js;time php b.php; time python3 b.py
real  0m1.422s
user  0m1.417s
sys  0m0.004s

real  0m2.941s
user  0m2.967s
sys  0m0.018s

real  0m2.901s
user  0m2.875s
sys  0m0.025s

real  0m4.769s
user  0m4.746s
sys  0m0.022s

嘿嘿.

至於Go如果做假宣告的話那會是這樣.

package main
func main() {
    max := 1000000000
    for i:=0;i<max;i++ {
        _ = 1234 + 5678 + i
        _ = 1234 * 5678 + i
        _ = 1234 / 2 + i
    }
}

real  0m0.944s
user  0m0.938s
sys  0m0.005s

The post Go vs node.js vs PHP vs Python, Loop benchmark. appeared first on Kevinwatt's Blog.

十月 19, 2012
» Samsung Chromebook

誰不想要有一台不能抓BT、不能燒CD、不能撥RMVB、不能寫Code、不能上PTT,但是長的像 MBA 的 ARM Chrome Notebook呢?

那當然是我啦,我不是很想要…

The post Samsung Chromebook appeared first on Kevinwatt's Blog.

十月 15, 2012
» MooresCloud & RaspberryPi

MooresCloud 不談Hardware只談燈的Linux device. (迷之音: 你是不是把Linux跟OSX的市場搞混了…)

$35的RaspberryPi Model B升級到512MB了. (迷之音: DRAM廠都倒光了你才加個128MB… )
Model B now ships with 512MB of RAM

The post MooresCloud & RaspberryPi appeared first on Kevinwatt's Blog.

十月 2, 2012
» Rooted Nexus S disable ad.

Remount /system become writable.

shell@android:/ # mount|grep system
/dev/block/platform/s3c-sdhci.0/by-name/system /system ext4 ro,relatime,barrier=1,data=ordered 0 0
shell@android:/ # mount -o remount,rw /system

Use local IP cover those AD provider DN.
echo "127.0.0.1 img.qwapie.com" >> /system/etc/hosts
echo "127.0.0.1 mm.admob.com" >> /system/etc/hosts
echo "127.0.0.1 r.admob.com" >> /system/etc/hosts
echo "127.0.0.1 analytics.admob.com" >> /system/etc/hosts
echo "127.0.0.1 googleads.g.doubleclick.net" >> /system/etc/hosts
echo "127.0.0.1 ads.fring.com" >> /system/etc/hosts
echo "127.0.0.1 ad.qwapi.com" >> /system/etc/hosts

Remount /system to read only.
shell@android:/ # mount -o remount,ro /system

» Thepiratebay se 又被關機了!?

透過isitdownrightnow觀察 Thepiratebay 已經被關機超過一天了。這使得李組長眉頭一皺,發覺案情並不單純…

http://www.isitdownrightnow.com/thepiratebay.se.html

原來根據第二手外電翻譯+不可證實的消息來源指出 WikiLeaks’ 和 Pirate Bay 的 Web Host 供應商 PRQ 已經被瑞士警方逮捕

http://www.forbes.com/sites/andygreenberg/2012/10/01/wikileaks-and-pirate-bay-web-host-prq-raided-by-swedish-police/

十月 1, 2012
» Cassandra install on Ubuntu 1204

Add to /etc/apt/sources.list

deb http://www.apache.org/dist/cassandra/debian 11x main
deb-src http://www.apache.org/dist/cassandra/debian 11x main

Install command

gpg --keyserver pgp.mit.edu --recv-keys 4BD736A82B5C1B00
gpg --export --armor 4BD736A82B5C1B00|sudo apt-key add -
sudo apt-get update
sudo apt-get install cassandra

Install pycassa:

sudo apt-get install gcc python-dev python-pip # for thrift.protocol.fastbinary
sudo pip install pycassa

Also CQL: http://code.google.com/a/apache-extras.org/p/cassandra-dbapi2/

九月 29, 2012
» FFmpeg 1.0 "Angel" Release.

FFmpeg 第一版發行於2000/12/20 將近12個年頭,今天終於在沒有什麼重大更新的情況之下平靜的推出了 1.0 版。

可喜可賀

九月 28, 2012
» Cassandra is Glow Up: C* 2012: The State of Cassandra, 2012

太久沒注意了,看來這兩年來 Cassandra 成長的相當好…Cassandra Users

宜搜, ebay 大量的Service用到 Cassandra. reddit blog也用Cassandra.
連 godaddy 都使用 Cassandra 做服務移轉紀錄跟Distributed Session Store.

而且很歡樂的是 Cassandra 居然還發展出了 "Cassandra Query Language",這NoSQL的SQL化是怎麼一回事?XDD
http://cassandra.apache.org/doc/cql/CQL.html

九月 26, 2012
» 在網頁中崁入一行code就可以讓你的Samsung galaxy 做Factory Reset(回復原廠設定)

使用Samsung galaxy手機的你,常常會找不到Android的Factory Reset(回復原廠設定)在哪裡嗎?

現在起只要在網頁中崁入一行code,之後讀取該網頁就可以讓你的Samsung galaxy直接進行無法中斷的Factory Reset

目前已知下列擁有 TouchWiz skin 的 Samsung 手機全部都可使用這項貼心的小功能。

Galaxy S3, Galaxy S2, Galaxy Ace, Galaxy Beam and Galaxy S

到底是哪行code呢?其實就是一組神秘電話號碼…

<frame src='tel:*2767*3855%23' />

這行code會讓你的手機自動播出 *2767*3855# ,也就是Galaxy手機回復原廠設定的USSD code。

詳情請參考下方連結。
Hacker news討論區: http://news.ycombinator.com/item?id=4569686

實際操作畫面(於10:00):http://www.youtube.com/watch?v=Q2-0B04HPhs&t=10m0s

» Malware 惡意程式的軟體開發者開始使用 Go

Symantec最近回報了一些由Go撰寫的惡意程式(Malware),這個惡意程式在一個名為GalaxyNxRoot.exe 的 android rooting tool上被發現。在這個tool 中分別有兩個檔案由Go所撰寫 PPSAP.exe adbtool.exe。


GalaxyNxRoot.exe properties

Once executed, the GalaxyNxRoot.exe file drops and launches two executable files, both written in Go:

%Temp%PPSAP.exe
%Temp%adbtool.exe
The dropped PPSAP.exe file is an information-stealing Trojan. It collects system information such as current running processes, user name, MAC address, etc., and posts it to the following remote location:
[http://]golang.iwebs.ws/about/step1.php

The dropped adbtool.exe file downloads an encrypted file from the following remote location:
[http://]sourceslang.iwebs.ws/downs/zdx.tgz

This file is decrypted as a Dynamic-link library (DLL) file and then loaded. It attempts to encrypt various file formats on the compromised computer. The targeted file formats include:

Source code files (.c, .cpp, .cs, .php, .java, .pas, .vb, .frm, .bas, .go, .asp, .aspx, .jsp, .pl, .py, .rb)
Image files (.jpg, .png, .psd)
Audio files (.wav, .wma, .amr, .awb)
Archive files (.rar, .zip, .iso, .gz, .7z)
Document files (file extensions containing the following strings: doc, xls, ppt, mdb, pdf)
Other types of files (file extensions containing the following strings: dw, dx, sh, pic, 111, win, wvw, drw, grp, rpl, mce, mcg, pag)

全文:http://www.symantec.com/connect/blogs/malware-uses-google-go-language

九月 25, 2012
» 雙北房仲業 近一成倒閉

看到今天的新聞"雙北房仲業 近一成倒閉"

內文指出,"這波房仲倒店潮是歷年來最大一次,將影響雙北市約5,000至6,000人因此失業。"
這種論調就是希望失業人數可以帶給政府壓力,但事實上政府該做的不是拯救房地產景氣。而是讓這些人可以順利轉職去從事其他有意義且有經濟價值的產業… 因為房地產雖然也是一種經濟生產,但屬於末端產物,低技術性且勞力密集… 而炒作房地產更不是正常的經濟供需行為。

至於房仲業為什麼會倒?其實從前陣子的全台空屋率創新高的新聞就看得出來。何謂空屋率? 空屋率其實是沒有出租、也沒有人住… 實際上就是空置在那邊的房產。
這種20%以上空屋率,供給明顯大於需求的產品,居然價格還可以上漲的"不正常經濟行為"是不健康的。這種類似鬱金香熱的不理性投資使得社會把大筆資金留置在房產, 而不是投入在真正有生產價值的產業. 對社會經濟發展更是非常糟糕的一件事。我個人認為,房仲業的倒閉潮只是這種泡沫化商品破滅的開始…

張金鶚教授在今天的youtube channel也有談到同一個議題, 可以參考一下.

九月 23, 2012
» A python example for send a message from xmlrpc to irc-bot.

This is python-irclib example.
If you use debian or ubuntu, you can install python-irclib by below command.

apt-get install python-irclib

#!/usr/bin/env python
import socket, signal
from SimpleXMLRPCServer import *
from thread import start_new_thread
from ircbot import SingleServerIRCBot

class AltXMLRPCServer(SimpleXMLRPCServer):

    finished=False

    def register_signal(self, signum):
        signal.signal(signum, self.signal_handler)

    def signal_handler(self, signum, frame):
        print "Caught signal", signum
	self.abot.shutdown()
        self.shutdown()

    def sendmsg(self, s):
	#print(s.encode('utf8'))
	for chrang in self.abot.chans:
		self.abot.connection.privmsg(chrang, s.encode('utf-8'))
	return 1

    def shutdown(self):
        self.finished=True
        return 1

    def ircbot(self, bot):
	self.abot = bot

    def serve_forever(self):
        while not self.finished: server.handle_request()

class EchoBot(SingleServerIRCBot):
    def __init__(self, chans, nickname, server):
        print "*** Connecting to IRC server %s..." % server
        SingleServerIRCBot.__init__(self, [(server, 6667)], nickname, "IRC echo bot")
        self.chans = chans

    def on_nicknameinuse(self, c, e):
        c.nick(c.get_nickname() + "_")

    def on_welcome(self, c, e):
        print "*** Connected"
        for chan in self.chans:
            c.join(chan)

    def shutdown(self):
        self.disconnect()
        self.die()

hostname=socket.gethostname()
port=8000

server = AltXMLRPCServer(("10.8.0.1", port))
print "Serving on %s:%d" %("10.8.0.1", port)

chlist=[]
bot = EchoBot(["test123"], "lovemeloveme","irc.freenode.net");
server.ircbot(bot)
server.register_function(server.shutdown)
server.register_signal(signal.SIGHUP)
server.register_signal(signal.SIGINT)
server.register_function(server.sendmsg)
start_new_thread(bot.start, ())
server.serve_forever()
print "Closed"

» 輕量級的Dyndns update client inadyn

最近剛好換Server想幫只有動態IP的電腦裝個新的動態DNS(Dynamic DNS) Client來連線使用.
apt serarch一下跑一堆perl的package出來… 開機跑這個略嫌重口味了點.
後來找到一套binrary 只有28k的inadyn

# apt-get install inadyn
# cp /usr/share/doc/inadyn/examples/inadyn.conf /etc
# vim inadyn.conf

刪除掉example 1 
#  1.
#Some comment about inadyn cfg file
#--username test --password test --update_period 60000 
#    --alias test.homeip.net --alias my.second.domain
修改 example2:
--username yendewei # user
--password password
update_period 60000  # some other param without '--'
alias hods.dyndns.org
--background
--syslog

修改 /etc/rc.local 將下行加到 #!/bin/sh -e 以下, exit 0以上的位址

/usr/sbin/inadyn

之後開機就會自動執行了。
第一次用手動執行 

# /usr/sbin/inadyn

檢查看看有沒有更新dyndns的資料,如果沒有就再跑一次

# killall inadyn
# /usr/sbin/inadyn

九月 20, 2012
» python4kids 一個老爸教8歲的兒子寫python所用的blog

python4kids已經為時兩年了
是一個每天10~15分鐘的python教學計劃.

» 果然在浴室唱歌比較好聽…

Bathroom Sessions. Beyonce – Halo (cover) by Lisa Scinta


九月 19, 2012
» Firefox OS Demo (09-06-12)

一個相當完整的Firefox OS demo在最近公開了.



到底這個Project還會beta多久呢? 就讓我們繼續看下去…

九月 14, 2012
» 一直沒注意到ubuntu package的更新…

原來不用在build go了. 因為go都被包進ubuntu了. XD


golang - Go programming language compiler - metapackage
golang-dbg - Go programming language compiler - debug files
golang-doc - Go programming language compiler - documentation
golang-go - Go programming language compiler
golang-mode - Go programming language - mode for GNU Emacs
golang-src - Go programming language compiler - source files
gccgo - Go compiler, based on the GCC backend
gccgo-4.7 - GNU Go compiler
gccgo-4.7-multilib - GNU Go compiler (multilib files)
gccgo-multilib - Go compiler, based on the GCC backend (multilib files)

現在安裝go的動作如下…
sudo apt-get update
sudo apt-get install golang
export GOROOT=/usr/lib/go

好簡單啊!!!!

七月 19, 2011
» 醫病關係

之所以會貼這篇,主要是關於我老婆懷孕牙齦出血,上週三在自由路看完牙醫洗過牙後好了三天… 接著嚴重出血不止。最後早上三點回婦產科吊點滴打止血針…

但牙齦的問題一直沒解決啊,於是透過網路查詢到高醫有懷孕婦女特別門診

  • 牙科成立『懷孕婦女牙科特別門診』

    本醫院牙科有鑑於懷孕婦女生理變化易造成許多口腔問題(統計數字顯示,懷孕時臨床上產生牙齦炎之比率約占百分之三十至百分之百),甚至加重原本已存在之口腔疾病。咸認產前口腔檢查與治療,以及懷孕時之定期口腔檢查是極為重要的一環。院方已核准正式成立『懷孕婦女牙科特別門診』,將於近期內服務病友。
  • 真是太好了,有這樣的門診特別針對孕婦的口腔問題,而且還舉出』懷孕時臨床上產生牙齦炎』的數字為例。於是就在星期一晚上,我們掛號後,並聯絡家人充當司機,一批人浩浩蕩蕩的準備好,在預約時間今天早上11:00到達。

    我們門診掛號掛的是高醫懷孕婦女特別門診的陳正慧醫師。
    後來的事可以用兩句話簡單說明。

    1. 門診時間醫生跑去開會,讓預約的病人愉快的在候診區等一個多小時,醫師回來後診療時間共長達2分鐘。
    2. 陳醫生表示要洗牙,病人表示剛洗過且婦產科醫師交待不能洗,於是塗抹碘甘油並囑咐病人要注意口腔衛生接著結束這一局門診。

    這個門診真是太特別了,居然是塗抹碘甘油。果然是專業的專科醫師,在短短的2~3分鐘內就做出明快的判斷。碘甘油是牙齦問題的常用藥,洗牙更是國人常進行的牙齒保健重要流程。
    雖然這簡簡單單的兩個動作看起來平淡無奇,但是這包含了牙醫界最廣為人知的牙齒保健項目,就讓我們瞭解到一個醫學中心特別門診的專業。

    在我的心中,這樣的特別門診簡直就跟劉昴星的特級廚師一樣難得。

    甚麼?你要問本文跟醫病關係的關係是甚麼?

    哪有甚麼關係… 你一定是誤會了。

    五月 10, 2011
    » Debian golang Package

    description Packaging for Google Go
    owner Ondrej Sury
    last change Sat, 7 May 2011 18:27:37 +0000
    URL https://alioth.debian.org/anonscm/git/pkg-google/golang.git
    Debian

    http://packages.debian.org/zh-tw/source/sid/golang

    A Feedjack powered Planet
    A Django site.