Skip to content

Instantly share code, notes, and snippets.

View thehowl's full-sized avatar
🧙‍♂️
cooking scrambled eggs on my cpu

Morgan thehowl

🧙‍♂️
cooking scrambled eggs on my cpu
View GitHub Profile
package main
import (
"testing"
"encoding/json"
"encoding/gob"
"bytes"
)
// initialisation
{
"fa-500px": "icon five hundred pixels",
"fa-adjust": "icon adjust",
"fa-adn": "icon adn",
"fa-align-center": "icon align center",
"fa-align-justify": "icon align justify",
"fa-align-left": "icon align left",
"fa-align-right": "icon align right",
"fa-amazon": "icon amazon",
"fa-ambulance": "icon ambulance",
@thehowl
thehowl / ratelimit.go
Created July 6, 2016 13:06
Example of per-user rate limiting in go
package main
import (
"fmt"
"sync"
"time"
)
func main() {
rl := &specificRateLimiter{
@thehowl
thehowl / gocov
Created May 17, 2016 16:34
Script to generate a cover profile easily in go
#!/usr/bin/env bash
go test -v -bench . -cover -coverprofile=profile.out ./...
go tool cover -html=profile.out
rm profile.out
@thehowl
thehowl / cheatsheet.md
Created May 17, 2016 16:25
Go `testing` package cheatsheet

Basic file

Filename being [name]_test.go

package yourpackage

import (
	"testing"
)
// ==UserScript==
// @name m.zxq.co beatmap mirror
// @namespace https://m.zxq.co/
// @version 0.1
// @description faster osu! beatmaps downloads, yay!
// @author Howl
// @match http*://osu.ppy.sh/s/*
// @match http*://osu.ppy.sh/b/*
// @grant GM_xmlhttpRequest
// @connect m.zxq.co
body {
width: 980px;
}
#left {
float: left; width: 520px;
}
#wrapper {
width: 500px;
height: 600px;
min-height: 600px;
@thehowl
thehowl / ggd
Last active March 13, 2016 08:39
ggd - a way to easily get docs about a go package
#!/usr/bin/env bash
if [ -z ${1+x} ]; then
echo 'Usage:'
echo ' ggd [go package]'
exit 0
fi
xdg-open https://godoc.org/"$1" > /dev/null
@thehowl
thehowl / ISC.md
Last active March 10, 2016 19:59 — forked from indexzero/ISC.md
ISC vs. MIT

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, (no free of charge).

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.