Skip to content

Instantly share code, notes, and snippets.

🤦‍♂
Permanent 418 status code.

Jon Gjengset jonhoo

Block or report user

Report or block jonhoo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jonhoo
jonhoo / README.md
Last active Oct 22, 2018
Distributed RWMutex in Go
View README.md
@jonhoo
jonhoo / README.md
Created Apr 15, 2015
Go slices and `interface{}`s
View README.md

When passing Go slices through interface{} values, beware that this slows your application down. If possible, you should instead be passing around pointers to slices, and dereference them after the cast:

$ go test -c
$ ./x.test -test.bench . -test.run Benchmark -test.benchtime 3s
BenchmarkInterfaceSlice		30000000	        148 ns/op
BenchmarkInterfaceSlicePtr	300000000	       14.0 ns/op
$ go tool pprof -text -cum x.test slice.out | grep -vE 'testing|goexit|Benchmark'
4420ms of 4610ms total (95.88%)
Dropped 16 nodes (cum <= 23.05ms)
@jonhoo
jonhoo / PKGBUILD
Created Feb 26, 2015
Updated PKGBUILD for source-code-pro-1.017R
View PKGBUILD
# Maintainer: Manuel Mendez <mmendez534@gmail.com>
# Contributor: Jon Gjengset <jon@tsp.io>
pkgname=source-code-pro-fonts-powerline
pkgver=1.017
pkgrel=3
pkgdesc="A set of monospaced fonts (TTF & OTF) designed for coding environments"
arch=('any')
license=('custom:OFL')
url='http://sourceforge.net/projects/sourcecodepro.adobe/'
@jonhoo
jonhoo / PKGBUILD
Created Jan 13, 2015
mutt-like PKGBUILD for mutt-slang
View PKGBUILD
# $Id: PKGBUILD 207672 2014-03-13 00:02:32Z bisson $
# Maintainer: Sean Greenslade <sean at seangreenslade dot com>
# Contributor: tobias [tobias [at] archlinux.org]
# Contributor: Gaetan Bisson <bisson@archlinux.org>
pkgbase=mutt
pkgname=${pkgbase}-slang
pkgver=1.5.23
pkgrel=2
pkgdesc='Small but very powerful text-based mail client'
@jonhoo
jonhoo / README.md
Created Jan 8, 2015
Plot commit activity across all local git repositories
View README.md

These scripts will find all git repositories on the local machine, find all commits made by some user (specified as arguments to find-commits), and plot the number of commits, lines added, and lines removed over time. Commits that add or remove over 10000 lines will be ignored (for huge data files and such).

To run:

$ ./find-commits.sh jon@thesquareplanet.com jon@tsp.io > commits.txt
$ cat commits.txt | ./draw-commits.sh
@jonhoo
jonhoo / laundry.sh
Last active Aug 29, 2015
Sidney Pacific Laundryview CLI
View laundry.sh
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "$0 <machine>"
exit 1
fi
rem=""
mtype=""
state=""
state() {
View gist:66c380c32e6e90a65b11
### Keybase proof
I hereby claim:
* I am jonhoo on github.
* I am jonhoo (https://keybase.io/jonhoo) on keybase.
* I have a public key whose fingerprint is 0EB8 140B 1294 C265 5DDD BF0C D64A C9D6 7176 DC71
To claim this, I am signing this object:
@jonhoo
jonhoo / dungeon-keeper.desktop
Created Feb 2, 2014
Dungeon Keeper Desktop Entry on Linux
View dungeon-keeper.desktop
[Desktop Entry]
Name=Dungeon Keeper
Comment=Evil is Good
Exec=dosbox -conf ../dosboxDK.conf -conf ../dosboxDK_single.conf -noconsole -c exit
Icon=dungeon-keeper
Path=/home/user/.wine/drive_c/GOG Games/Dungeon Keeper Gold/DOSBOX
Terminal=false
Type=Application
Categories=Game;
@jonhoo
jonhoo / packet-generator.cpp
Created Dec 4, 2013
Complete example code showing how to construct a UDP packet from scratch and inject it on a WiFi interface in Linux
View packet-generator.cpp
/**
* Hello, and welcome to this brief, but hopefully complete, example file for
* wireless packet injection using pcap.
*
* Although there are various resources for this spread on the web, it is hard
* to find a single, cohesive piece that shows how everything fits together.
* This file aims to give such an example, constructing a fully valid UDP packet
* all the way from the 802.11 PHY header (through radiotap) to the data part of
* the packet and then injecting it on a wireless interface
*
You can’t perform that action at this time.