Skip to content

Instantly share code, notes, and snippets.

View SaitoWu's full-sized avatar
:shipit:
Hacking everyday

Xin Wu SaitoWu

:shipit:
Hacking everyday
View GitHub Profile
@SaitoWu
SaitoWu / exp.rb
Created March 5, 2011 18:04
some ruby language exercise
def call_block
puts "before call"
yield
yield
puts "after call"
end
call_block{ puts "call" } #before call\ncall\ncall\nafter call
@SaitoWu
SaitoWu / c-repo.sh
Created February 12, 2011 10:52
build your own c-repl
#clone repl from github or download form http://neugierig.org/software/c-repl/
git clone https://github.com/martine/c-repl.git c-repl
#install dependencies
sudo apt-get install ghc6 gccxml libghc6-parsec-dev libghc6-mtl-dev \
libghc6-hunit-dev
sudo apt-get install gdb libexpat1-dev c2hs libreadline-dev
@SaitoWu
SaitoWu / runable.rb
Created February 11, 2011 08:57
exec something on ruby.
#0> non-block call
Thread.new do
blahbla...
end
#1> 4 simple ways to call shell or cmd
`ps aux`
@SaitoWu
SaitoWu / fffffuuuu.rb
Created January 14, 2011 17:38
amazing script for fun from fffffuuu comic.
require 'open-uri'
img_url = "http://fffffffffffffffffffffffuuuuuuuuuuuuuuuuuuuuuu.com/big.jpg?im="
(1..1044).each do |x|
n = '%.4d' % x + ".jpg"
open(n, "wb").write(open(img_url+n).read)
end