Skip to content

Instantly share code, notes, and snippets.

View enocom's full-sized avatar

Eno Compton enocom

View GitHub Profile
@enocom
enocom / Execution time
Created March 2, 2019 16:16 — forked from ericnormand/00_script.clj
Boilerplate for running Clojure as a shebang script
$ cp script.clj ~/bin/cljtest2
# ~/bin is on my $PATH
$ chmod +x ~/bin/cljtest2
$ time cljtest2 "Yo" "Hey" 1 3 4 - -ff
Hello!
"2019-03-01T17:22:43.564Z"
("Yo" "Hey" "1" "3" "4" "-" "-ff")
268435456
real 0m2.073s
(function() {
document.getElementsByClassName('metabar')[0].innerHTML = '';
document.getElementsByClassName('js-stickyFooter')[0].outerHTML = '';
document.getElementsByTagName('aside')[0].outerHTML = '';
})()
(ns scratch.core
(:require [clojure.core.async :as a]))
(defn start-runner []
(let [stop (a/chan)]
(a/go-loop []
(when (a/alt! stop false :default :keep-going)
(do (Thread/sleep 1000)
(println "Running..."))
(recur)))

I'm planning on either writing this up in detail or maybe doing a screencast about screencasting, but I'll give a short version here.

On sound quality:

This matters a lot. In decreasing order of importance:

  1. Remove echo. You have to hear this to understand. Set up a mic in front of your mouth and record a sentence. Then, put a thick comforter over you and the mic and say it again at the same distance. Listen to

Go Conferences

  • Go Devroom FOSDEM - February in Brussels, Belgium
  • GopherCon India - March in Pune, India
  • GopherCon Russia - March in Moscow, Russia
  • GoSF - March in San Francisco, USA
  • GothamGo - April in New York, USA
  • GopherCon SG - May in Singapore
  • GopherCon Europe - June in Reykjavik, Iceland
  • GopherCon Denver - August in Denver, USA
function gcloud {
if ! docker inspect gcloud-config > /dev/null 2>&1; then
docker run -it --name gcloud-config -v "$PWD:/pwd" google/cloud-sdk:alpine gcloud auth login
fi
docker run -it --rm --volumes-from gcloud-config -v "$PWD:/pwd" google/cloud-sdk:alpine gcloud $@
}
function aws {
if ! docker inspect aws-config > /dev/null 2>&1; then
docker run -it --name aws-config -v "$PWD:/pwd" mesosphere/aws-cli configure
function getCookie(token) {
fetch("https://doppler.coconut.cf-app.com/set-cookie?CookieName=authorization&CookieValue="+token)
.then(function(response) { console.log(response); })
}
function getRecentLogs(guid) {
fetch("https://doppler.coconut.cf-app.com/apps/" + guid + "/recentlogs")
.then(function(response) { return response.text(); });
}

Keybase proof

I hereby claim:

  • I am enocom on github.
  • I am enocom (https://keybase.io/enocom) on keybase.
  • I have a public key whose fingerprint is B090 06E3 DA80 468A EC81 D3E1 617E 1A59 0FEF BD82

To claim this, I am signing this object:

package main
import "fmt"
type T struct{}
func (t T) Method() {
fmt.Println("Hey there")
}

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs