Skip to content

Instantly share code, notes, and snippets.

View djui's full-sized avatar

Uwe Dauernheim djui

View GitHub Profile

FWIW: I (@Rondy) am not the author of the content presented here, which is an outline from Edmond Lau's book. I've just copy-pasted it from somewhere and saved as a personal gist, before it got popular on newsnews.ycombinator.com. I don't remember where exactly the original source is from and neither could find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

@mh-cbon
mh-cbon / main.go
Last active October 4, 2016 11:08
package main
func main () {
get := watcher.HotTemplateReloader("a.tmpl", "b.tmpl")
// following should be thread safe, and do the hot reload of t template instance
t, err := get()
if err!=nil {
panic(err)
}
// Uses the default AWS SDK Credentials; e.g. via the environment
// AWS_REGION=region AWS_ACCESS_KEY_ID=key AWS_SECRET_ACCESS_KEY=secret
package main
import (
"bytes"
"flag"
"fmt"
"io"
"log"
package main
import (
"log"
"net/http"
)
func main() {
fs := interceptHandler(http.FileServer(http.Dir(".")), defaultErrorHandler)
log.Fatal(http.ListenAndServe(":80", fs))
@skarllot
skarllot / Makefile.makefile
Created May 3, 2016 21:24
Makefile to merge coverage data from all subpackages (Golang)
.PHONY: test-cover-html
PACKAGES = $(shell find ./ -type d -not -path '*/\.*')
test-cover-html:
echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES),\
go test -coverprofile=coverage.out -covermode=count $(pkg);\
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out
@djui
djui / readln.go
Created December 2, 2015 10:08
Minimal readline with timeout example
import (
"bufio"
"errors"
"strings"
"time"
)
// Readln reads and returns a single line (sentinal: \n) from stdin.
// If a given timeout has passed, an error is returned.
// This functionality is similar to GNU's `read -e -p [s] -t [num] [name]`
function u() {
requestAnimationFrame(u);
g = p ?
audio.currentTime * 60 : (
audio = "RIFFdataWAVEfmt " + atob("EAAAAAEAAQAAeAAAAHgAAAEACAA") + "data",
b.style.background = "radial-gradient(circle,#345,#000)",
b.style.position = "fixed",
b.style.height = b.style.width = "100%",
@jin3110
jin3110 / tmux.sh
Last active January 8, 2024 12:33
How to install tmux in CoreOS toolbox
#!/bin/bash
# Usage
# =====
# ~~~
# /opt/bin/tmux.sh [tmux args...]
# ~~~
#
# How to install tmux in CoreOS toolbox
# =====================================
@kallepersson
kallepersson / MMO.md
Last active January 3, 2016 06:49
What if Bash was an MMO-MUD?

What if Bash was an MMO-MUD?

  • You SSH to get access to this world
  • All players are represented by users
  • No standard GNU/UNIX commands are enabled

Locations are folders:

  • ".." as a concept does not exist but rather the world is bound together by linked folders
  • Symbolic links can also be portals of sorts
  • The system keeps track of all users' CWD and you can "see each other" if you are in the same directory
@jbochi
jbochi / listener.clj
Created November 30, 2013 21:52
chat com clojure, core.async e zeromq
(require '[com.keminglabs.zmq-async.core :refer [register-socket!]]
'[clojure.core.async :refer [>! <! <!! >!! go chan sliding-buffer close!]])
(let [addr "tcp://*:9999"
[s-in s-out] (repeatedly 2 #(chan (sliding-buffer 64)))]
(register-socket! {:in s-in :out s-out :socket-type :rep
:configurator (fn [socket] (.bind socket addr))})
(println "waiting messages...")