Skip to content

Instantly share code, notes, and snippets.

View DanielMorsing's full-sized avatar

Daniel Morsing DanielMorsing

View GitHub Profile
<!DOCTYPE HTML>
<html>
{{template "header"}} //this i want executed before runtime
<body>
{{template "navbar" "Blog"}} //same with this
</body>
//all this should only be executed at runtime
MAGIC ESCAPE THINGY
{{.title}}
package main
import (
"net/http"
"path"
)
var fshandler = http.FileServer(http.Dir("assets/"))
func scrubber(w http.ResponseWriter, r *http.Request) {
<!--{
Navbar: "Home",
}-->
/* other stuff after this */
/* should be matched by "<!--.*-->" */
@DanielMorsing
DanielMorsing / baseutf8
Created April 19, 2015 10:37
A shitty thing I did in order to pgp sign a tweet.
package main
import (
"fmt"
"io/ioutil"
"math/big"
"os"
)
func main() {
diff --git a/src/net/http/transport.go b/src/net/http/transport.go
index 354b5c0..0ec5398 100644
--- a/src/net/http/transport.go
+++ b/src/net/http/transport.go
@@ -358,6 +358,7 @@ func (cm *connectMethod) proxyAuth() string {
// If pconn is no longer needed or not in a good state, putIdleConn
// returns false.
func (t *Transport) putIdleConn(pconn *persistConn) bool {
+ fmt.Println("putidle")
if t.DisableKeepAlives || t.MaxIdleConnsPerHost < 0 {
[daniel@morslaptop ~]$ mkdir foo && cd foo
[daniel@morslaptop foo]$ bash -c 'cd .. && rm -rf foo'
[daniel@morslaptop foo]$ man open
man: can't change directory to '': No such file or directory
man: command exited with status 255: (cd && LESS=-ix8RmPm Manual page open(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$PM Manual page open(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$ MAN_PN=open(1) less -s)

Keybase proof

I hereby claim:

  • I am danielmorsing on github.
  • I am dmorsing (https://keybase.io/dmorsing) on keybase.
  • I have a public key whose fingerprint is 85A4 D9E4 546F 39F5 7891 92E4 C9C6 BA30 0461 FEBE

To claim this, I am signing this object:

@DanielMorsing
DanielMorsing / foo.go
Created January 31, 2016 18:07
the program
package main
import (
"runtime/causalprof"
"net/http"
"bufio"
"os"
"math/rand"
"fmt"
"sync/atomic"
0x4d183d /home/daniel/go/src/math/rand/rand.go:206
2542898460
5% 2324966363ns -8.57%
30% 2326460354ns -8.51%
35% 2277724044ns -10.4%
45% 2314790374ns -8.97%
50% 2243652563ns -11.8%
95% 1974680705ns -22.3%
package main
import (
"fmt"
"net/http"
_ "net/http/pprof"
"runtime/causalprof"
"sync"
"math/rand"
)