jq is useful to slice, filter, map and transform structured json data.
brew install jq
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| 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 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
git log --oneline -1 <PR-BRANCH>git push -f origin :| package main | |
| import ( | |
| "reflect" | |
| "strings" | |
| ) | |
| func makeChannel(t reflect.Type, chanDir reflect.ChanDir, buffer int) reflect.Value { | |
| ctype := reflect.ChanOf(chanDir, t) | |
| return reflect.MakeChan(ctype, buffer) |
| #!/bin/bash | |
| # A simple script to backup an organization's GitHub repositories. | |
| # NOTE: if you have more than 100 repositories, you'll need to step thru the list of repos | |
| # returned by GitHub one page at a time, as described at https://gist.github.com/darktim/5582423 | |
| GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files | |
| GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up | |
| # (if you're backing up a user's repos instead, this should be your GitHub username) | |
| GHBU_UNAME=${GHBU_UNAME-"<CHANGE-ME>"} # the username of a GitHub account (to use with the GitHub API) |
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| "github.com/davecgh/go-spew/spew" | |
| ) | |
| func main() { |
| package main | |
| import ( | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| ) | |
| type Notification struct { | |
| Error error `json:"error"` |
| package main | |
| import "fmt" | |
| func main() { | |
| user := User{} | |
| // Set the group: | |
| groupSetter("admin", user) |
| package main | |
| import ( | |
| "crypto/tls" | |
| "crypto/x509" | |
| "fmt" | |
| "io" | |
| "log" | |
| ) |
| package main | |
| import ( | |
| "bytes" | |
| "encoding/gob" | |
| "fmt" | |
| ) | |
| type MyFace interface { | |
| A() |