Skip to content

Instantly share code, notes, and snippets.

View jiphex's full-sized avatar

James Hannah jiphex

View GitHub Profile
#! /bin/sh
### BEGIN INIT INFO
# Provides: notify-iphone
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Sends prowl notifcation
### END INIT INFO
# Author: James Hannah <[email protected]>
#! /usr/bin/env python
#
# James Hannah <[email protected]> - 2010-01-25
#
# Opens a mailbox (mbox) file and runs through all the messages,
# splitting them into the real mailboxes. Should be useful when
# for some reason mail gets delivered into a shared mbox instead
# of the correct mboxes.
import mailbox
<html>
<head>
<style>
em {
font-style: normal;
color: #33aa33;
}
span.pw:hover {
background-color: #000000;
@jiphex
jiphex / lircrc
Created March 15, 2010 21:27
Config for LIRC to use with XBMC
begin
prog = irexec
remote = mceusb
button = Print
repeat = 0
config = killall -9 xbmc.bin
config = echo "`date` XBMC Killed" >> /var/log/lirc.log
end
begin
Interval Since Last Panic Report: -10 sec
Panics Since Last Report: 1
Anonymous UUID: 9F318FAB-FABE-48A9-BF79-EF47F53C6EFB
Sun Apr 11 19:01:30 2010
panic(cpu 1 caller 0x2269e4): "thread_invoke: preemption_level -1, possible cause: unlocking an unlocked mutex or spinlock"@/SourceCache/xnu/xnu-1504.3.12/osfmk/kern/sched_prim.c:1471
Backtrace (CPU 1), Frame : Return Address (4 potential args on stack)
0x4a9d3e28 : 0x21b449 (0x5ce420 0x4a9d3e5c 0x2238a5 0x0)
0x4a9d3e78 : 0x2269e4 (0x585e1c 0xffffffff 0x585db4 0x2262a8)
0x4a9d3ef8 : 0x2270ea (0x97223f0 0xc90 0x1 0x0)
<?
// obviously you probably want to make this a bit more userfriendly
if($_REQUEST['dvdtitle']) {
$dvdtitle=$_REQUEST['dvdtitle'];
system("touch /var/rip/$dvdtitle.RIP");
} else {
echo "No Title!";
}
?>
#! /usr/bin/env python
import httplib
import sys
if len(sys.argv) < 3:
print "Usage: %s SERVER HOSTNAME[/REQUEST] [body?]" % sys.argv[0]
sys.exit(1)
else:
server = sys.argv[1]
host = sys.argv[2]
@jiphex
jiphex / .vimrc
Created September 14, 2010 11:59
" essential, makes good stuff work
set nocompatible
" if we can do syntax, do it,
if has('syntax') && (&t_Co > 2 || has("gui_running"))
syntax on
endif
" what mode are we in? (all the time)
set showmode
#! /usr/bin/env python
#
# Goes through an mbox (filename given in argv[1]) and
# purges messages older than thirty days.
# (and newer than year 3000 to pick up corrupt headers)
#
import sys
import platform
try:
pv = platform.python_version_tuple()
@jiphex
jiphex / scanmatic.sh
Created January 16, 2011 23:42
Scans a document from the default scanner and emails it (securely) via GMail
#! /usr/bin/env bash
# scans a single document and mails it
#
# Requirements: sane, ImageMagick, tesseract, gocr, sendemail
# It would be trivially email to remove gocr, tesseract is better it seems
# You could replace ImageMagick with anything that convert PBM > something.
SCANFILE=`mktemp /tmp/scantmp.XXXXXXXX`
PBMFILE="${SCANFILE}.pbm"