Skip to content

Instantly share code, notes, and snippets.

@clehner
clehner / github-pull-request
Created January 21, 2016 03:25
Attach a pull request to an existing issue on GitHub
#!/bin/sh
# http://stackoverflow.com/questions/4528869/how-do-you-attach-a-new-pull-request-to-an-existing-issue-on-github
if [ $# -lt 4 ]; then
echo "Usage: ${0##*/} [issue_num] [username/repo] [base_branch] [head_username:branch]" >&2
exit 1
fi
user="$(pass github.com|awk '/^username:/{print $2}')"
issue=$1
@clehner
clehner / update-cjdns
Last active August 29, 2015 14:20
cjdns updater script
#!/bin/sh
# update-cjdns
# Usage: put in crontab:
# 0 0 * * * /usr/local/sbin/update-cjdns
cd /opt/cjdns || exit 1
git pull | grep -q 'Already up-to-date' && exit 0
tmp="$(mktemp)"
@clehner
clehner / pull.php
Last active August 29, 2015 14:14
GitHub Web Hook for updating a repo
<?php
header('Content-Type: text/plain');
$secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$branch = 'master';
$hub_signature = @$_SERVER['HTTP_X_HUB_SIGNATURE'];
if (!$hub_signature) {
http_response_code(403);
exit('missing signature');
}
@clehner
clehner / verification.md
Last active August 29, 2015 14:08
onename.io verification
@clehner
clehner / OpenTest.c
Created September 26, 2014 17:06
OpenTest: check PBOpen and PBOpenDF vs. FSOpen and OpenDF in MPW libraries
#include <stdio.h>
#include <string.h>
#include <StandardFile.h>
#include <Memory.h>
#include <Files.h>
#include <Devices.h>
OSErr MyOpenDF(ConstStr255Param fileName, short vRefNum, short *refNum)
{
OSErr oe;
@clehner
clehner / bong.coffee
Created July 31, 2013 18:37
bongbot - IRC bot that says bong
#!/usr/bin/env coffee
# install dependencies: npm install irc
irc = require 'irc'
server = 'hubbard.freenode.net'
nickServPassword = ''
nick = 'bongbot'
client = new irc.Client server, 'bongbot',
@clehner
clehner / Makefile
Created April 24, 2013 07:10
Get and set an HP printer's status, using PJL on JetDirect (port 9100)
P=pjstatus
OBJECTS=
CFLAGS = -g -Wall -O3
LDLIBS=
CC=gcc
PREFIX=/usr/local
$(P): $(OBJECTS)
install: $(P)
@clehner
clehner / hyperboria.sh
Last active December 10, 2015 15:28 — forked from waaghals/hyperboria.sh
#!/bin/sh -e
### BEGIN INIT INFO
# hyperboria.sh - An init script (/etc/init.d/) for cjdns
# Provides: cjdroute
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Cjdns router
# Description: A routing engine designed for security, scalability, speed and ease of use.
@clehner
clehner / update.coffee
Created November 28, 2012 03:24 — forked from comboy/update.rb
update all your namecoin domains
#!/usr/bin/env coffee
# put this file in the same dir as namecoind executable
child_process = require 'child_process'
child_process.exec './namecoind name_list', (err, stdout, stderr) ->
(JSON.parse stdout).forEach (domain) ->
if domain.expires_in < 5000
command = "./namecoind name_update #{JSON.stringify domain.name} #{JSON.stringify domain.value}"
@clehner
clehner / git.sh
Created October 9, 2012 23:22
Simple Interactive Git Shell
#!/bin/bash
# git.sh - Interactive Git Shell
# store command history here
HISTFILE=~/.gitsh_history
control_c() {
# save history before exiting
history -a
# i can't figure out how to make this just break out of the read command