Skip to content

Instantly share code, notes, and snippets.

View c2h2's full-sized avatar

Yiling Cao c2h2

View GitHub Profile
@c2h2
c2h2 / alsa-utils compiling fix
Created August 8, 2011 06:30
alsa-utils compiling fix
sudo ln -s libpanelw.so.5 /usr/lib/libpanelw.so
sudo ln -s libformw.so.5 /usr/lib/libformw.so
sudo ln -s libmenuw.so.5 /usr/lib/libmenuw.so
sudo ln -s libncursesw.so.5 /lib/libncursesw.so
@c2h2
c2h2 / sp_printer.rb
Created September 27, 2011 03:03
serial printer by ruby
#!/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
#encoding: utf-8
require "yaml"
require File.expand_path(File.join(File.dirname(__FILE__), "serialport.rb"))
require File.expand_path(File.join(File.dirname(__FILE__), "memq.rb"))
class String
def to_bin
@c2h2
c2h2 / test.c
Created October 11, 2011 09:23
output of serial program
c2h2@c2h2rack001:~$ ./a.out /dev/ttyS0 57600 8 MARK 1 0x01fdfd
lenth is 2 8 :01
lenth is 4 8 :3634
lenth is 6 8 :3634
c2h2@c2h2rack001:~$ ./a.out /dev/ttyS0 57600 8 SPACE 1 0x01fd000002a5010002007f1110091210090000000023595901000000000000140010080801010003010000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0fffffff9fff0ff3ffffffff0ff3ffffffff0ffffff3fffffffffffffffffffffffffffffffffffeefffffffdffeeffbfffffffeeffbfffffffeeffffffbfffffffffffffffffffffffffffffffffffeffffffffdffefffbfffffffefffbfffffffefffffffbfffffffffffffffffffffffffffffffffffeffffffffdffefffbfffffffefffbfffffffefffffffbfffffffffffffffffffffffffffffffffff81ffc1ffe1ff81ffa3ffc1ff81ffa3ffc1ff81ffc1ffa3ffffffffffffffffffffffffffffffffffefffbdffddffefff9dffbdffefff9dffbdffefffbbff9dffffffffffffffffffffffffffffffffffefffbfffbdffefffbdffbfffefffbdffbfffefffbbf
@c2h2
c2h2 / tester.rb
Created October 11, 2011 10:01
a working serial program.
#!/usr/bin/ruby
#encoding: utf-8
require "serialport"
ENABLE_RS485_RELAY = true
DEV=0
BAUD=57600
MSG_SLEEP_TIME = 0.1
@c2h2
c2h2 / gist:1378328
Created November 19, 2011 02:20
pycon 自我介绍
pycon工作: 翻译
姓名: 曹一凌 Yiling Cao
介绍: Ruby, Python and C Developer, Graduated from University of Melbourne. Worked as Web developer, Hardware Developer and System Administrator, Current interests: Image processing, computer vision, large scale information retrieval and processing & VOIP Systems
介绍:Ruby, Python, C开发者, 澳大利亚墨尔本大学计算机系毕业,曾担任web 开发, 硬件工程师, 系统运维。感兴趣于 图像处理,计算机视觉, 大规模信息处理, VOIP系统.
gravatar: http://ps58611.dreamhost.com/1448edb454b1d651bac30a667e4e67a0.jpeg
@c2h2
c2h2 / 2780gpio.c
Created February 10, 2012 12:12
gpio windows demo file.
/* W83627UHG GPIO DEMO PROGRAM File Name : 2780GPIO.C
*/
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#define Superio2_Addr 0x2E
/* #define DEBUG 1 */
void enter_Superio2_CFG(void) {
outportb(Superio2_Addr, 0x87);
@c2h2
c2h2 / ntgps.rb
Created February 15, 2012 09:56
ruby gpsd reader
equire 'date'
require 'rubygems'
require 'cool.io'
require 'yajl'
ADDR = '127.0.0.1'
PORT = 2947
class Gps
@c2h2
c2h2 / aa.rb
Created May 14, 2012 09:39
bunny emit test file.
require 'bunny'
EXCH = "asdf"
QUE = "qwer"
b= Bunny.new
b.start
exch = b.exchange(EXCH, :type => :fanout)
@c2h2
c2h2 / bb.rb
Created May 14, 2012 09:42
bunny test, receiver file
require 'bunny'
EXCH = "asdf"
QUE = "qwer"
b= Bunny.new
b.start
exch = b.exchange(EXCH, :type => :fanout)
@c2h2
c2h2 / pokersim.rb
Created May 14, 2012 19:09
simulate a poker table happening chance.
require 'ruby-poker'
TOTAL_TIMES = 1000000
FACES = "AKQJT98765432"
SUITS = "CDSH"
srand
# build a deck.