Skip to content

Instantly share code, notes, and snippets.

View zhouguangming's full-sized avatar

zhouguangming zhouguangming

View GitHub Profile
curl localhost:3000/api-token-auth/ -d 'username=gm_zhou&password=1234qwer'
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImdtX3pob3UiLCJ1c2VyX2lkIjoyLCJlbWFpbCI6IiIsImV4cCI6MTQ5ODgwMjgzN30.uohDefRQ2nQ8L8SLeQq6nqc-r-8yVt1YAdOMeydstMY"}
@zhouguangming
zhouguangming / gist:0da5575312d8fa9ed1c6
Created September 5, 2014 08:41
TCP handshake on MAC
14:31:07.464300 IP (tos 0x10, ttl 64, id 47827, offset 0, flags [DF], proto TCP (6), length 64, bad cksum 0 (->81d2)!)
localhost.58204 > localhost.30000: Flags [S], cksum 0xfe34 (incorrect -> 0x1569), seq 1287356531, win 65535, options [mss 16344,nop,wscale 4,nop,nop,TS val 1546086283 ecr 0,sackOK,eol], length 0
14:31:07.464422 IP (tos 0x0, ttl 64, id 40245, offset 0, flags [DF], proto TCP (6), length 64, bad cksum 0 (->9f80)!)
localhost.30000 > localhost.58204: Flags [S.], cksum 0xfe34 (incorrect -> 0x2de6), seq 3393214846, ack 1287356532, win 65535, options [mss 16344,nop,wscale 4,nop,nop,TS val 1546086283 ecr 1546086283,sackOK,eol], length 0
14:31:07.464437 IP (tos 0x10, ttl 64, id 27669, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 0 (->d09c)!)
localhost.58204 > localhost.30000: Flags [.], cksum 0xfe28 (incorrect -> 0x83f6), seq 1287356532, ack 3393214847, win 9186, options [nop,nop,TS val 1546086283 ecr 1546086283], length 0
14:31:07.464453 IP (tos 0x0, ttl 64, id 43587, offset 0
@zhouguangming
zhouguangming / ogem.sh
Last active December 21, 2015 11:58
Open a gem in a fast way.
#!/usr/bin/env bash
if [ -z $1 ] || [ $1 == "-h" ] || [ $1 == "--help" ]
then
echo "Usage: `basename $0` [Gemname]"
exit 0
fi
GEM_NAME=$1
@zhouguangming
zhouguangming / amb.rb
Created August 16, 2013 03:46
amb in ruby
require 'continuation'
class Amb
def initialize(all)
@_all = all
@_backtrack = []
@_values = {}
@_success = default_success_message
@_failure = default_failure_message
@_debug = default_debug_message
@zhouguangming
zhouguangming / actor.rb
Created August 16, 2013 03:04
actor in ruby
require 'thread'
module Actor
module ClassMethods
def new(*args, &block)
Proxy.new(super)
end
end