View main.go
func getStack(skip int) string { | |
buffer := make([]byte, 1024) | |
for { | |
written := runtime.Stack(buffer, false) | |
if written < len(buffer) { | |
// call stack contains of goroutine number and set of calls | |
// goroutine NN [running]: | |
// github.com/user/project.(*Type).MethodFoo() | |
// path/to/src.go:line | |
// github.com/user/project.MethodBar() |
View samizdat-shell-help.bash
#!/bin/bash | |
### | |
### my-script — does one thing well | |
### | |
### Usage: | |
### my-script <input> <output> | |
### | |
### Options: | |
### <input> Input file to read. | |
### <output> Output file to write. Use '-' for stdout. |
View main.js
/* | |
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets. | |
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there). | |
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ . | |
Known limitations: | |
- it won't be able to take into account some external stylesheets (if CORS isn't set up) | |
- it will produce false negatives for classes that are mentioned in the comments. |
View randomcommits.txt
0 is not stdin on windows | |
#7 started for future. | |
ability to kill sudo background process | |
a bit of refactoring, minor improvements | |
A breath of fresh air | |
accept arbitrary size tokens | |
accept arbitrary types as nested error | |
Account for DataCenter mode while looking for hook scripts | |
Activity reviewing is now avaiable | |
actually, clear status on exit |
View notpassing.go
package hookstest | |
import ( | |
"fmt" | |
) | |
func ShouldNotPass() { | |
fmt.Printf( | |
"This code should not pass linting because it has broken message formatting: %s\n", | |
) |
View passing.go
package hookstest | |
import ( | |
"fmt" | |
) | |
// ShouldPass prints a message that this function passes any code linter | |
func ShouldPass() { | |
fmt.Println("This code should pass any linter") | |
} |
View a.js
var apm = require('elastic-apm-node').start() | |
var http = require('http') | |
var process = require('process') | |
function sleep(time) { | |
var stop = new Date().getTime(); | |
while(new Date().getTime() < stop + time) { | |
; | |
} | |
} |
View a.sh
sudo systemctl stop kafka; sudo rm -rf /var/lib/kafka/my-topic-0; sudo systemctl start kafka; AMOUNT=20000 THREADS=5 CYCLES=10 go run main.go | |
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused | |
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused | |
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused | |
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused | |
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused | |
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused | |
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused | |
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused | |
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused |
View gist:ebd64540fd49bcde1417f54c5210267f
1494574706.613978 server started (13549): version 2.4, socket /tmp/tmux-1000/test, protocol 8 | |
1494574706.614127 on Linux 4.10.11-1-ARCH #1 SMP PREEMPT Tue Apr 18 08:39:42 CEST 2017; libevent 2.0.22-stable (poll) | |
1494574706.617361 add peer 0x7dc290: 8 (0x7dbaa0) | |
1494574706.617432 new client 0x7dbaa0 | |
1494574706.617496 loading /etc/tmux.conf | |
1494574706.617538 loading /dev/null | |
1494574706.617618 server loop enter | |
1494574706.623461 peer 0x7dc290 message 100 | |
1494574706.623524 client 0x7dbaa0 IDENTIFY_FLAGS 0x10000 |
View .go
package main | |
import ( | |
"log" | |
"net/http" | |
) | |
type Handler struct{} | |
func (handler Handler) ServeHTTP( |
NewerOlder