Skip to content

Instantly share code, notes, and snippets.

View whymarrh's full-sized avatar

Whymarrh Whitby whymarrh

View GitHub Profile
@whymarrh
whymarrh / git-os-x-installer.bash
Last active August 29, 2015 14:08
Installation script for Git on OS X (modified from timcharper/git_osx_installer)
#!/usr/bin/env bash
set -e -o pipefail
LATEST_GIT_VERSION=$(curl http://git-scm.com/ 2>&1 | grep -A 2 '<span class="version">' | grep '[[:digit:]].[[:digit:]]' | tr -d ' ')
GIT_VERSION="${1:-$LATEST_GIT_VERSION}"
PREFIX="/usr/local/git"
SUDO="sudo"
NOW_SECONDS=$(date +%s)
THE_ABYSS="/dev/null"
@whymarrh
whymarrh / hipchat_notify.py
Last active August 29, 2015 14:14
Rudimentary Jenkins + HipChat integration
import argparse
import requests
import json
ROOM_ID = ''
TOKEN = ''
HIPCHAT_ROOM_URL = 'https://api.hipchat.com/v2/room/{0}/notification'
@whymarrh
whymarrh / re.js
Created May 5, 2015 22:29
A silly re
var re = /^(?!app[\\\/])|(app[\\\/]test)/;
console.log();
console.log();
console.log();
console.log();
[
"app/test/Config.js",
"app/test/OtherConfig.js",
@whymarrh
whymarrh / serial_ports.py
Last active September 24, 2015 00:21
Create serial ports with Python
#!/usr/bin/env python3 -OO
import itertools
import serial
import shlex
import subprocess
MESSAGE = """
Hi there! You have a serial port:
@whymarrh
whymarrh / b2w.md
Last active October 24, 2015 16:03
A list of Back to Work episodes
@whymarrh
whymarrh / swap.c
Last active December 12, 2015 12:38
The XOR swap algoritm in C.
void swap(int *a, int *b);
int main(int argc, char **argv) {
int a = 1;
int b = 2;
swap(&a, &b);
return 0;
}
void swap(int *a, int *b) {
@whymarrh
whymarrh / com.whymarrh.apps.mediakeys.plist
Last active December 13, 2015 19:48
Sample p-list file for an OS X daemon.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.whymarrh.apps.mediakeys</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/the/executable/file</string>
</array>
@whymarrh
whymarrh / tends.c
Created March 16, 2013 22:59
A cool "tends to" operator in C (not actually).
#include <stdio.h>
#define as while
// as seen on Stack Overflow
// http://stackoverflow.com/q/1642028
int main(int argc, char **argv) {
int x = 42;
as (x --> 0) {
@whymarrh
whymarrh / inline.php
Last active December 16, 2015 23:49
In-lines CSS, JavaScript, and images.
#!/usr/bin/env php
<?php
define(SUCCESS, 0);
define(ERROR, 1);
if (count($argv) != 2) {
printf("usage: %s <filename>\n", basename($argv[0]));
exit(ERROR);
}
@whymarrh
whymarrh / test-pa11y.bash
Created August 3, 2013 21:36
Run nature/pa11y against an array of app routes.
#!/usr/bin/env bash
# servers
jeeves="localhost:7211"
alfred="localhost:7212"
abyss="/dev/null"
cd "public"
php -S "$jeeves" &> "$abyss" &