Skip to content

Instantly share code, notes, and snippets.

View whyrusleeping's full-sized avatar

Whyrusleeping whyrusleeping

  • Mana
  • The Metaverse
View GitHub Profile
@whyrusleeping
whyrusleeping / seqgen.go
Created October 17, 2014 20:37
generate all subsequences of a string
package main
import "fmt"
type seqGen struct {
baseStr string
curI int
ch chan string
}
package main
import (
"fmt"
)
type Fun func(int) int
type Thing struct {
A int
@whyrusleeping
whyrusleeping / gob.go
Created October 16, 2014 06:07
golang gob interface example
package main
import (
"bytes"
"encoding/gob"
"fmt"
)
type MyFace interface {
A()
{"links":[{"Source":0,"Target":18,"Value":1},{"Source":0,"Target":1,"Value":1},{"Source":0,"Target":13,"Value":1},{"Source":1,"Target":10,"Value":1},{"Source":1,"Target":8,"Value":1},{"Source":1,"Target":6,"Value":1},{"Source":1,"Target":5,"Value":1},{"Source":1,"Target":12,"Value":1},{"Source":1,"Target":11,"Value":1},{"Source":1,"Target":9,"Value":1},{"Source":1,"Target":3,"Value":1},{"Source":1,"Target":4,"Value":1},{"Source":1,"Target":2,"Value":1},{"Source":1,"Target":7,"Value":1},{"Source":13,"Target":15,"Value":1},{"Source":13,"Target":16,"Value":1},{"Source":13,"Target":14,"Value":1},{"Source":13,"Target":17,"Value":1},{"Source":18,"Target":19,"Value":1},{"Source":18,"Target":24,"Value":1},{"Source":18,"Target":21,"Value":1},{"Source":18,"Target":23,"Value":1},{"Source":18,"Target":20,"Value":1},{"Source":18,"Target":22,"Value":1}],"nodes":[{"Name":"QmcTUNMbpVtPoCY5jDfoaSJ8FPR4YybZtfTJo4mfZ2nXgB"},{"Name":"QmQ3dnZH2WUfoGj6x4K1vFKG5XNurTzEj4m1sCi7UGxLpa"},{"Name":"QmeDq6jqtNWYw6GQW2yzEWqPY6keXYiTAQRJUc
@whyrusleeping
whyrusleeping / betterdiag.json
Last active August 29, 2015 14:07
Sample diagnostics output
[{"ID":"QmQpPRLXZnqM8nyShCvXVfgowzfGg5UpGrrY7GhHcb2U5a","Connections":[{"Latency":0,"ID":"QmVW2Fwrmck6vgmfDhfKP5QLvM3mUxzBJHa8c1g5Lqwqxz"},{"Latency":3114468,"ID":"QmZQZ4ji4vJxgRmcrBr3Gw1etq4zHmL7X7VXJnte8uAUMz"},{"Latency":1656239,"ID":"QmaReaspiZwddthJWRuQiHywVVhVuip2HbAc8gqjidJAjF"},{"Latency":2354405,"ID":"QmTK2Rrm5NtgArsk5PmbaB6W1J432nLiwN8TpvdRXbgtwE"},{"Latency":0,"ID":"QmecMt8pcvqrrNSncQifBgKTAswhbXLms1NxNbTqGLSDw3"},{"Latency":2545698,"ID":"QmTBawrFZZA4ndDGnHAtpLtpqca8qCU2pRcBdDPBSswKL1"},{"Latency":0,"ID":"QmNhnUBTKhZfr8gVsnp2V2hMFoDmwu9aPeBWhs8TEkJ1Pe"},{"Latency":1603435,"ID":"QmQdNC8fPirSVopoxvzpJwo8RNQ68w4x4Uz2q2NnJ4JsxN"},{"Latency":2154429,"ID":"QmccEpZVcPFbTaKMmRBuuJMJEqccz6fEXHf28ijYxbFGjC"},{"Latency":2469519,"ID":"QmQUuxq58921EkoDkhBKD9cK5W5Ra23moc2gxs8nJm7awr"},{"Latency":0,"ID":"QmbShMzuHPYMFaCXHpzh1cpoFH16Enrs8QTsjXZsJ98x4L"},{"Latency":0,"ID":"QmXUpxUu5Jmu2XGmVgwzbhrj1VMFxUMgXzZSiFN6NsD4aL"}],"Keys":null,"LifeSpan":305133133263,"BwIn":8567,"BwOut":1194,"CodeVersion":"github.com/jbenet/
@whyrusleeping
whyrusleeping / archsetup.md
Last active May 11, 2019 17:15
arch linux setup guide for samsung chromebook 2

Arch Linux Chromebook 2 Setup

First, follow the instructions on this page up until it tells you to unmount root: http://archlinuxarm.org/platforms/armv7/samsung/samsung-chromebook-2

Dont unmount root yet. you need to run cp /lib/firmware/mrvl/* root/lib/firmware/mrvl

This copies the proper wireless drivers to your new installation (otherwise wireless will NOT work)

Now you can umount root and sync and reboot.

After rebooting, press Ctrl + u at the boot screen to boot to your SD card.

@whyrusleeping
whyrusleeping / rand.py
Created September 26, 2014 16:10
make some kinda random numbers in python
primeA = 393342739
primeB = 756065159
class rander(object):
def __init__(self, seed):
self.seed = seed
def getByte(self):
self.seed = ((self.seed << 5) ^ primeA) % primeB
return int(self.seed % 256)
whyrusleeping@alarm~> ls ipns/QmRijjhFdMaZtWw6nFQmsYUNXnXjccLxFVmWcHHheHmHZ2 -l
lr-xr-xr-x 1 root root 0 Sep 25 15:51 ipns/QmRijjhFdMaZtWw6nFQmsYUNXnXjccLxFVmWcHHheHmHZ2 -> /home/whyrusleeping/mnt/QmSPrgf3kgrThSzALgskYeeSyKDoLdt7oDyfguMQ6XPkkX
whyrusleeping@alarm~> cat ipns/QmRijjhFdMaZtWw6nFQmsYUNXnXjccLxFVmWcHHheHmHZ2
FROM golang:1.3
MAINTAINER Brian Tiger Chow <btc@perfmode.com>
RUN apt-get update
RUN apt-get install -y fuse
COPY . /go/src/github.com/jbenet/go-ipfs
@whyrusleeping
whyrusleeping / gist:1c799bb6008d7fb41d56
Created September 25, 2014 20:15
ipfs add and cat working
whyrusleeping@alarm~/g/s/g/j/go-ipfs> ipfs add Dockerfile
Executing command locally.
Caution: blockservice running in local (offline) mode.
Adding file: Dockerfile = QmSPrgf3kgrThSzALgskYeeSyKDoLdt7oDyfguMQ6XPkkX
DagService Add [QmSPrgf3kgrThSzALgskYeeSyKDoLdt7oDyfguMQ6XPkkX]
storing [QmSPrgf3kgrThSzALgskYeeSyKDoLdt7oDyfguMQ6XPkkX] in datastore
added QmSPrgf3kgrThSzALgskYeeSyKDoLdt7oDyfguMQ6XPkkX Dockerfile
Pinning node. Currently No-Op
added QmSPrgf3kgrThSzALgskYeeSyKDoLdt7oDyfguMQ6XPkkX Dockerfile
whyrusleeping@alarm~/g/s/g/j/go-ipfs> ipfs cat QmSPrgf3kgrThSzALgskYeeSyKDoLdt7oDyfguMQ6XPkkX
@whyrusleeping
whyrusleeping / gist:212354cb773c15165850
Created September 20, 2014 19:21
Mild downside to using godeps...
cmd/ipfs/add.go:28: cannot use *"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag".NewFlagSet("ipfs-add", "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag".ExitOnError) (type "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag".FlagSet) as type "github.com/gonuts/flag".FlagSet in field value
cmd/ipfs/cat.go:22: cannot use *"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag".NewFlagSet("ipfs-cat", "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag".ExitOnError) (type "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag".FlagSet) as type "github.com/gonuts/flag".FlagSet in field value
cmd/ipfs/config.go:37: cannot use *"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag".NewFlagSet("ipfs-config", "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag".ExitOnError) (type "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag".FlagSet)