by 郑凯 zhengkai@gmail.com
2014.10.23
- Chrome 插件
Secure Shell
public int clearBits(int num, int i) { | |
int mask = (1 << i) - 1; | |
return num & mask; | |
} |
by 郑凯 zhengkai@gmail.com
2014.10.23
Secure Shell
package main | |
// This is a basic example of running an nsqd instance embedded. It creates | |
// and runs an nsqd with all of the default options, and then produces | |
// and consumes a single message. You are probably better off running a | |
// standalone instance, but embedding it can simpllify deployment. | |
// See https://github.com/bitly/nsq/blob/master/nsqd/options.go and | |
// https://github.com/bitly/nsq/blob/master/apps/nsqd/nsqd.go for | |
// more details on how to configure an embedded nsqd instance. |
package consumer | |
import ( | |
"errors" | |
"testing" | |
"github.com/bitly/go-nsq" | |
) | |
// tests nsq.HandlerFunc. just write the function in line in the test |
The default Go implementation of
sync.RWMutex does not scale well
to multiple cores, as all readers contend on the same memory location
when they all try to atomically increment it. This gist explores an
n
-way RWMutex, also known as a "big reader" lock, which gives each
CPU core its own RWMutex. Readers take only a read lock local to their
core, whereas writers must take all locks in order.
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
package main | |
import ( | |
"bytes" | |
"fmt" | |
"github.com/gorilla/mux" | |
grpc "github.com/gorilla/rpc" | |
"github.com/gorilla/rpc/json" | |
"log" | |
"net/http" |
My name is {{.Name}} and I'm {{.Age}} years old!! |
#!/bin/bash | |
GFWLIST=https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt | |
PROXY=127.0.0.1:7070 | |
cd `dirname "${BASH_SOURCE[0]}"` | |
echo "Downloading gfwlist from $GFWLIST" | |
curl "$GFWLIST" --socks5-hostname "$PROXY" > /tmp/gfwlist.txt | |
/usr/local/bin/gfwlist2pac \ | |
--input /tmp/gfwlist.txt \ |