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 / 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
@clehner
clehner / irssi-growl.sh
Created September 28, 2012 04:27
Growl notifications for remote Irssi
#!/bin/sh
server='127.0.0.1'
log='irclogs/*/*.log'
ssh "$server" "tail -n1 -f $log" | sed -l 's/^[^ ]* < //' | while read line; do
sender="${line%>*}"
msg="${line#*> }"
growlnotify -m "$msg" "$sender"
done
@clehner
clehner / shapemaker.html
Created June 23, 2011 04:56
Draw simple shapes with points.
<!doctype html>
<html>
<head>
<title>Shape Maker</title>
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
line-height: 1.5em;
font-size: 14px;
}
@clehner
clehner / accesscode.js
Created April 24, 2011 05:53
Access Code Generator & Validator
// Access Code Generator & Validator
// API:
// string generateAccessCode()
// Boolean validateAccessCode(codeString)
(function () {
// configure:
var difference = 5;
@clehner
clehner / classy.js
Created October 18, 2010 02:17
Simple and Fast Javascript Inheritance. (No fancy stuff)
/*
Classy - Simple and Fast Javascript Inheritance.
(No fancy stuff)
Inspiration:
http://ejohn.org/blog/simple-javascript-inheritance/
http://valums.com/javascript-oop/
http://www.broofa.com/blog/2009/02/javascript-inheritance-performance/
Example: