Skip to content

Instantly share code, notes, and snippets.

View ihower's full-sized avatar
🎯
Focusing

Wen-Tien Chang ihower

🎯
Focusing
View GitHub Profile
@ihower
ihower / gist:115577
Created May 21, 2009 17:18
convert big5 hex codepoint to utf-8 string
require 'iconv'
$KCODE = 'u'
hex_string ="4A6BA441" # A441 is big5 "乙"
big5_string = hex_string.scan(/../).map{ |c| c.hex }.pack("c*")
iconv = Iconv.new("utf-8//ignore", "big5")
utf8_string = iconv.iconv(big5_string) # convert to utf-8
puts utf8_string # output JK乙
[user]
name = Wen-Tien Chang
email = ihower@gmail.com
[alias]
co = checkout
ci = commit
sh = !git-sh
[color]
diff = auto
status = auto
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registrano | Lobby</title>
</head>
<body id="lobby-page">
<style type="text/css">
production: &defaults
min_word_len: 1
charset_table: U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z,A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
@ihower
ihower / rails_install_script_on_ubuntu
Created September 4, 2009 09:54
Ubunbu 9.04 (minimal) install script for Ruby on Rails training purpose
#!/bin/bash
# Install Guide:
# 1. Use http://www.virtualbox.org if you use Windows or OS X
# 2. Download http://www.ubuntu.com 9.04 Desktop Edition and install into VM.
# 3. In your ubuntu console:
# $ wget http://gist.github.com/raw/180820/333b288a1b5df8df09842bfcfa248fa252f0cf3b/rails_install_script_on_ubuntu
# $ chmod 555 rails_install_script_on_ubuntu
# $ ./rails_install_script_on_ubuntu
@ihower
ihower / gist:202843
Created October 6, 2009 08:15
Rails app template
# rails foobar -m http://gist.github.com/202843.txt
run "rm README"
run "rm public/index.html"
run "rm -f public/javascripts/*"
run "rm -f publuc/images/*"
generate :controller, "welcome index"
route "map.root :controller => 'welcome'"
if yes?("Do you want to use BDD framework?")
#!/bin/bash
# Install Guide:
# 1. Use http://www.virtualbox.org if you use Windows or OS X
# 2. Download http://www.ubuntu.com 9.04 Desktop Edition and install into VM.
# 3. In your ubuntu console:
# $ wget http://gist.github.com/raw/212749/dfc34bd47732d25da0715a52aef2158cfba99d71/ruby_install_script_on_ubuntu
# $ chmod 555 ruby_install_script_on_ubuntu
# $ ./ruby_install_script_on_ubuntu
# This is not serious benchmark, you should read:
#
# http://jan.prima.de/plok/archives/175-Benchmarks-You-are-Doing-it-Wrong.html
# http://jan.prima.de/plok/archives/176-Benchmarks-You-are-Doing-it-Wrong.html
# http://books.couchdb.org/relax/reference/high-performance
#
# CouchDB v0.10.0 (via CouchDBX) on Macbook Pro 2.2 (Snow Leopard)
#
# 1000 times
# Round 1
#!/usr/local/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'railties' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'