Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Morsing DanielMorsing

View GitHub Profile
@DanielMorsing
DanielMorsing / stacktrace.diff
Last active Jun 16, 2019
Patch that adds stack growth events to the trace viewer
View stacktrace.diff
diff --git a/src/cmd/trace/trace.go b/src/cmd/trace/trace.go
index f39a397d0d..de8348e996 100644
--- a/src/cmd/trace/trace.go
+++ b/src/cmd/trace/trace.go
@@ -739,6 +739,8 @@ func generateTrace(params *traceParams, consumer traceConsumer) error {
ctx.emitInstant(ev, "task start", "user event")
case trace.EvUserTaskEnd:
ctx.emitInstant(ev, "task end", "user event")
+ case trace.EvGoCopyStack:
+ ctx.emitInstant(ev, "copystack", "")
View causalprof.diff
diff --git a/src/net/http/server.go b/src/net/http/server.go
index 57e1b5dacb..31c8352ca2 100644
--- a/src/net/http/server.go
+++ b/src/net/http/server.go
@@ -22,6 +22,7 @@ import (
"os"
"path"
"runtime"
+ "runtime/causalprof"
"strconv"
View foobar.go
package main
import (
"fmt"
"net/http"
_ "net/http/pprof"
"runtime/causalprof"
"sync"
"math/rand"
)
View gist:89f65f6b76bd25aa3f71
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%
View foo.go
package main
import (
"runtime/causalprof"
"net/http"
"bufio"
"os"
"math/rand"
"fmt"
"sync/atomic"
View keybase.md

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:

View gist:a44473c6429790121fed
[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)
View something.patch
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 {
@DanielMorsing
DanielMorsing / baseutf8
Created Apr 19, 2015
A shitty thing I did in order to pgp sign a tweet.
View baseutf8
package main
import (
"fmt"
"io/ioutil"
"math/big"
"os"
)
func main() {
View gist:2758702
<!--{
Navbar: "Home",
}-->
/* other stuff after this */
/* should be matched by "<!--.*-->" */
You can’t perform that action at this time.