- Follow instructions on https://github.com/google/protobuf/releases/tag/v3.0.0-beta-2 to install protoc v3.0.0.
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
go get -u google.golang.org/grpc
(might need to rungo get -u golang.org/x/net/http2
ifhttp2
errors are observed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
When John was a little kid he didn't have much to do. There was no internet, no Facebook, and no programs to hack on. | |
So he did the only thing he could... he evaluated the beauty of strings in a quest to discover the most beautiful string | |
in the world. Given a string s, little Johnny defined the beauty of the string as the sum of the beauty of the letters in it. | |
The beauty of each letter is an integer between 1 and 26, inclusive, and no two letters have the same beauty. | |
Johnny doesn't care about whether letters are uppercase or lowercase, so that doesn't affect the beauty of a letter. | |
(Uppercase 'F' is exactly as beautiful as lowercase 'f', for example.) You're a student writing a report on the youth of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copied, Pasted and summarized from ps' source code. | |
You can use sysctl to get other process' argv. | |
*/ | |
#include <sys/sysctl.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define pid_of(pproc) pproc->kp_proc.p_pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Your slightly pointy-bearded boss has assigned you to write software to find the best songs from different music albums. And the software should be finished in an hour. But don’t panic, you don’t have to solve the problem of writing an AI with good taste. At your disposal is the impeccable taste of a vast horde of long-tailed monkeys. Well, at least almost. The monkeys are not very communicative (or rather, you’re not sure which song “Ook!” is supposed to refer to) so you can’t ask them which songs are the best. What you can do however is to look at which songs the monkeys have listened to and use this information to deduce which songs are the best. | |
#At first, you figure that the most listened to songs must be the best songs. However, you quickly realize that this approach is flawed. Even if all songs of the album are equally good, the early songs are more likely to be listened to more often than the later ones, because monkeys will tend to start listening to the first song, listen for a few songs and then, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Twitter is rarely down these days, but ... | |
http://i.imgur.com/AEFzDX7.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
usage: | |
pack(unsigned char *buf, const char *fmt, ...); | |
similar to sprintf(): | |
put all arguments in "..." into the buffer, according to the format | |
string "fmt", in a way that they can be easily retrieved with unpack() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def namedlist(typename, field_names): | |
"""Returns a new subclass of list with named fields. | |
>>> Point = namedlist('Point', ('x', 'y')) | |
>>> Point.__doc__ # docstring for the new class | |
'Point(x, y)' | |
>>> p = Point(11, y=22) # instantiate with positional args or keywords | |
>>> p[0] + p[1] # indexable like a plain list | |
33 | |
>>> x, y = p # unpack like a regular list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am neurodrone on github. | |
* I am neurodrone (https://keybase.io/neurodrone) on keybase. | |
* I have a public key whose fingerprint is 5B8F FA30 CBB4 1E79 33A6 EFEA CD03 ECE3 08F4 180B | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json, boto | |
# Connect to IAM with boto | |
iam = boto.connect_iam(ACCESS_KEY, SECRET_KEY) | |
# Create user | |
user_response = iam.create_user('aws-user') | |
# Create Policy | |
policy = { 'Version' : '2012-10-17'} |
OlderNewer