Skip to content

Instantly share code, notes, and snippets.

View jiphex's full-sized avatar

James Hannah jiphex

View GitHub Profile
@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
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]
<?
// 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!";
}
?>
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)
@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
<html>
<head>
<style>
em {
font-style: normal;
color: #33aa33;
}
span.pw:hover {
background-color: #000000;
#! /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
#! /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]>
@jiphex
jiphex / testdns.c
Created November 11, 2009 11:12
Barebones dig using inet_ntoa in C
#include <netdb.h>
#include <stdio.h>
int main(int argc, char * argv[]) {
if(argc > 1) {
int i;
struct hostent *hent;
hent = gethostbyname(argv[1]);
printf("Hostname: %s\n", hent->h_name);
for(i = 0; hent->h_addr_list[i] != 0; i+=1) {
printf("IP: %s\n", inet_ntoa(*((long *)hent->h_addr_list[i])), i);
#! /usr/bin/env python
# Unpostmap - reverse postmap'ed data
import os,sys,datetime
try:
import bsddb
hashed = bsddb.hashopen(sys.argv[1], 'r')
print "# hashed by unpostmap (%s)"%sys.argv[1]
for key in hashed:
print "%s %s" % (key, hashed[key])