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 / 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 / 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 / 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);