Skip to content

Instantly share code, notes, and snippets.

View jonhoo's full-sized avatar
🤦‍♂️
Permanent 418 status code.

Jon Gjengset jonhoo

🤦‍♂️
Permanent 418 status code.
View GitHub Profile
@jonhoo
jonhoo / mp3Match.pl
Created March 5, 2013 17:40
Compare the mp3 files in multiple folders and choose which ones to keep based on bitrate, length, etc.
#!/usr/bin/perl
# Scans all directories prefixed by "-n" for mp3 files and compares them with
# mp3 files of the same name in all other given directories.
# Allows comparison of bitrate, length and size, and then selecting which to keep
use strict;
use warnings;
use Cwd qw/cwd abs_path/;
use MP3::Tag;
die "Usage: $0 folder folder -n lookupfolder -n lookupfolder\n" if @ARGV < 2;
@jonhoo
jonhoo / slicewin
Last active June 3, 2016 21:58
Script for slicing and aerosnapping X windows in an EWMH compatible WM
#!/bin/bash
if [[ $# -eq 0 ]]; then
echo "Usage: $0 top|right|bottom|left [maximized]"
exit 1
fi
active=`xprop -root _NET_ACTIVE_WINDOW | sed 's/^.*# //'`
if [[ $active == "0x0" ]]; then
echo "No active window found (_NET_ACTIVE_WINDOW == 0x0)"
@jonhoo
jonhoo / showoff
Created July 22, 2013 12:30
Bash function for setting up and tearing down remote tunnels
#!/bin/bash
# Remember to change USER@SERVER below to the server you want to
# show off from
showoff() {
if [[ -z $2 ]]; then
lport=80
rport=8080
else
lport=$1
rport=$2
@jonhoo
jonhoo / packet-generator.cpp
Created December 4, 2013 00:27
Complete example code showing how to construct a UDP packet from scratch and inject it on a WiFi interface in Linux
/**
* 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
*
@jonhoo
jonhoo / dungeon-keeper.desktop
Created February 2, 2014 14:59
Dungeon Keeper Desktop Entry on Linux
[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;
### 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 / laundry.sh
Last active August 29, 2015 14:06
Sidney Pacific Laundryview CLI
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "$0 <machine>"
exit 1
fi
rem=""
mtype=""
state=""
state() {
@jonhoo
jonhoo / README.md
Created January 8, 2015 22:50
Plot commit activity across all local git repositories

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