Skip to content

Instantly share code, notes, and snippets.

View whyrusleeping's full-sized avatar

Whyrusleeping whyrusleeping

View GitHub Profile
@whyrusleeping
whyrusleeping / rabin.go
Created September 15, 2014 01:36
broken code
package rabin
import (
"bufio"
"bytes"
"crypto/rand"
"fmt"
"io"
"testing"
)
@whyrusleeping
whyrusleeping / gist:1e822fa55d018c589313
Created September 14, 2014 04:44
current ipfs code coverage
ok github.com/jbenet/go-ipfs/bitswap 0.140s coverage: 14.6% of statements
? github.com/jbenet/go-ipfs/blocks [no test files]
ok github.com/jbenet/go-ipfs/blockservice 0.011s coverage: 61.3% of statements
? github.com/jbenet/go-ipfs/cmd/ipfs [no test files]
ok github.com/jbenet/go-ipfs/config 0.013s coverage: 32.1% of statements
ok github.com/jbenet/go-ipfs/core 9.705s coverage: 58.3% of statements
? github.com/jbenet/go-ipfs/core/commands [no test files]
? github.com/jbenet/go-ipfs/crypto [no test files]
? github.com/jbenet/go-ipfs/daemon [no test files]
? github.com/jbenet/go-ipfs/fuse/readonly [no test files]
@whyrusleeping
whyrusleeping / gist:14de551414a7ad2409fd
Created September 11, 2014 17:39
sample ipfs config file
{
"Identity": {
"PeerID": "QmapEQ7xvrjcmqBF3i9umTA9eUXnTA5WLisnXYGg7NiEwG",
"PrivKey": "Should be your private key here",
"Address": "/ip4/127.0.0.1/tcp/4001"
},
"Datastore": {
"Type": "leveldb",
"Path": "/home/whyrusleeping/.go-ipfs/datastore"
},
@whyrusleeping
whyrusleeping / key.go
Created September 3, 2014 06:36
ipfs key interfaces
package crypto
type PrivKey interface {
Sign([]byte) ([]byte, error)
Decrypt([]byte) ([]byte, error)
GetPublic() PubKey
GenSecret() []byte
}
type PubKey interface {
package dht
import (
"time"
u "github.com/jbenet/go-ipfs/util"
peer "github.com/jbenet/go-ipfs/peer"
)
type ProviderManager struct {
@whyrusleeping
whyrusleeping / testipfs.go
Created August 5, 2014 02:46
beginning a testbed for ipfs
package main
import (
dht "github.com/jbenet/go-ipfs/routing/dht"
peer "github.com/jbenet/go-ipfs/peer"
ma "github.com/jbenet/go-multiaddr"
u "github.com/jbenet/go-ipfs/util"
"crypto/rand"
"time"
@whyrusleeping
whyrusleeping / dht.proto
Created July 29, 2014 18:12
protobuf message type for dht messages
package dht;
//run `protoc --go_out=. *.proto` to generate
message DHTMessage {
enum MessageType {
PUT_VALUE = 0;
GET_VALUE = 1;
PING = 2;
FIND_NODE = 3;
void
SDL_BlitCopy(SDL_BlitInfo * info)
{
SDL_bool overlap;
Uint8 *src, *dst;
int w, h;
int srcskip, dstskip;
w = info->dst_w * info->dst_fmt->BytesPerPixel;
h = info->dst_h;
@whyrusleeping
whyrusleeping / order.go
Last active August 29, 2015 14:02
a quick hack to find explicit ordering in sets
package main
import (
"os"
"bufio"
"fmt"
)
func ReadFile(path string) []string {
fi,err := os.Open(path)
@whyrusleeping
whyrusleeping / same_in_c.c
Last active August 29, 2015 13:59
Quick assembly demo
int myFunc(int x, int y) {
return x + y
}
int main() {
int x = 1;
int y = 2;
int z = myFunc(x,y);
}