Skip to content

Instantly share code, notes, and snippets.

@cliffwoo
cliffwoo / 12306AutoLogin.user.js
Created September 19, 2012 01:59
12306 Auto Login
/*
12306 Auto Login => A javascript snippet to help you auto login 12306.com.
Copyright (C) 2011 Kevintop
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes 12306.user.js
@cliffwoo
cliffwoo / 12306.user.js
Created September 19, 2012 01:59 — forked from xczdx/12306.user.js
12306 Auto Query => A javascript snippet to help you book ticket
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011-2012 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js
@cliffwoo
cliffwoo / gist:3904152
Created October 17, 2012 07:08
查看内存插槽数及内存大小
#http://blog.chinaunix.net/uid-7270462-id-3226111.html
dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range
dmidecode|grep -P 'Maximum\s+Capacity'
dmidecode|grep -A16 "Memory Device"
@cliffwoo
cliffwoo / gist:3942793
Created October 24, 2012 00:04 — forked from huacnlee/gist:3936299
Mac 清理 TextMate 2 不断升级带出一堆多余的打开方式
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
@cliffwoo
cliffwoo / chat.rb
Created October 30, 2012 08:59 — forked from rkh/chat.rb
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@cliffwoo
cliffwoo / nginx.sh
Created November 1, 2012 03:15 — forked from marshluca/nginx.sh
/etc/init.d/nginx
# /etc/init.d/nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@cliffwoo
cliffwoo / simple-nginx-webdav.sh
Created November 6, 2012 06:47 — forked from dysinger/simple-nginx-webdav.sh
A simple nginx/webdav setup for use with things like mobile-org
#!/bin/sh
# on ubuntu: need some utils & dev libs
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev
# compile nginx
cd /tmp
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz
cd nginx*
./configure --with-http_ssl_module --with-http_dav_module \
@cliffwoo
cliffwoo / chat.rb
Created November 14, 2012 01:21 — forked from rkh/chat.rb
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@cliffwoo
cliffwoo / gist:4133499
Created November 23, 2012 00:54
MacOS下修改主机名
#修改主机名
scutil --set HostName $newhostname
#计算机名
scutil --set ComputerName $newcomputername
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
x, y := 0, 1
return func() int {
x, y = y, x + y