Skip to content

Instantly share code, notes, and snippets.

View jbhannah's full-sized avatar
🏳️‍⚧️
she/her

Jesse Brooklyn Hannah jbhannah

🏳️‍⚧️
she/her
View GitHub Profile
@jbhannah
jbhannah / v6.php
Created May 23, 2011 03:38
Simple PHP IPv6 detection script (http://wp.me/pnbL6-6a)
<?php
header('Content-type: application/json');
if ( array_key_exists('addr', $_GET) )
$ip = $_GET['addr'];
else
$ip = $_SERVER['REMOTE_ADDR'];
$v6 = preg_match("/^[0-9a-f]{1,4}:([0-9a-f]{0,4}:){1,6}[0-9a-f]{1,4}$/", $ip);
$v4 = preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/", $ip);
@jbhannah
jbhannah / dropbox-setup.sh
Created May 23, 2011 03:51
Dropbox setup on a headless Ubuntu Server (http://wp.me/pnbL6-5F)
#!/bin/sh
# Dropbox setup on a headless Ubuntu Server
# Script written by Jesse B. Hannah (http://jbhannah.net) <jesse@jbhannah.net>
# Based on http://wiki.dropbox.com/TipsAndTricks/UbuntuServerInstall
###
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@jbhannah
jbhannah / 20-example1-com.conf
Created May 23, 2011 04:04
Drupal multisite, clean URLs, and lighttpd (http://wp.me/pnbL6-2o)
# The following redirects all non-existing subdomains and the "www." prefix to
# the top domain. Change 'sub' below to a vertical-bar (|)-delimited list of
# subdomains.
$HTTP["host"] !~ "^((sub)\.)?example1\.com" {
$HTTP["host"] =~ "^(.+\.)example1\.com" {
url.redirect = ( "^/(.*)" => "http://example1.com/$1" )
}
}
# If you don't have any subdomains you want to be web-accessible, comment out
@jbhannah
jbhannah / 60-thinkfinger.rules
Created May 23, 2011 05:09
ThinkFinger, Ubuntu Hardy, and GNOME (http://wp.me/pnbL6-1Y)
#
# udev rules file for the thinkfinger fingerprint scanner
#
# gives access to the fingerprint reader to those in the "fingerprint" group
#
# Taken from:
# http://www.thinkwiki.org/wiki/How_to_enable_the_fingerprint_reader_with_ThinkFinger
# which was taken and modified from:
# http://article.gmane.org/gmane.linux.drivers.thinkfinger/329
#
@jbhannah
jbhannah / skype_status.php
Created May 23, 2011 05:14
Skype status PHP script for use with AJAX
<?php
header('Content-type: application/json');
if ( array_key_exists('username', $_GET) )
$user = $_GET['username'];
else
$user = "";
$curl = curl_init("http://mystatus.skype.com/${user}.num");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
@jbhannah
jbhannah / htoprc
Created May 23, 2011 05:21
Common configuration files
# Beware! This file is rewritten every time htop exits.
# The parser is also very primitive, and not human-friendly.
# (I know, it's in the todo list).
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=47
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
@jbhannah
jbhannah / rotate.desktop
Created May 23, 2011 05:24
ThinkPad X60 Tablet Ubuntu setup scripts
[Desktop Entry]
Type=Application
Exec=rotate.py monitor
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=Monitor Screen Rotation
Name=Monitor Screen Rotation
Comment[en_US]=Monitor the rotation of the display and rotate the screen to match.
Comment=Monitor the rotation of the display and rotate the screen to match.
@jbhannah
jbhannah / he-ipv6.sh
Created May 23, 2011 17:51
Hurricane Electric IPv6 Tunnel Broker script for Ubuntu
#!/bin/sh
# Hurricane Electric IPv6 Tunnel Broker script for Ubuntu
# /etc/network/if-up.d/he-ipv6.sh
# Written by Jesse B. Hannah (http://jbhannah.net) <jesse@jbhannah.net>
# Based on instructions provided by Hurricane Electric (http://tunnelbroker.net)
###
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@jbhannah
jbhannah / gist:1052145
Created June 28, 2011 20:39
Plaintext output with header row to Ruby hash
processes = []
psef = []
`ps -ef`.lines.each { |r| psef << r }
headers = psef.shift.split
psef.each do |row|
row = row.split
p = {}
@jbhannah
jbhannah / wow_char_api.php
Created August 7, 2011 00:04
World of Warcraft community API character data fetcher
<?php
header('Content-type: application/json');
if ( array_key_exists('char', $_GET) && array_key_exists('realm', $_GET) ) {
$char = $_GET['char'];
$realm = $_GET['realm'];
} else {
echo json_encode(array());
return;
}