Skip to content

Instantly share code, notes, and snippets.

View dsturnbull's full-sized avatar

David Turnbull dsturnbull

View GitHub Profile
require 'formula'
class Hadoop < Formula
url 'http://www.apache.org/dyn/closer.cgi?path=hadoop/core/hadoop-0.20.204.0/hadoop-0.20.204.0.tar.gz'
homepage 'http://hadoop.apache.org/common/'
md5 'ea9a0699405074f169dccd3cc6adb608'
def shim_script target
<<-EOS.undent
#!/bin/bash
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end
@dsturnbull
dsturnbull / jira.xml
Created June 8, 2011 04:49
/lib/svc/manifest/application/atlassian/jira.xml
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='application/atlassian/jira' type='service' version='0'>
<dependency name='network' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/milestone/network:default'/>
</dependency>
@dsturnbull
dsturnbull / gist:1013792
Created June 8, 2011 04:49
/lib/svc/method/jira
We couldn’t find that file to show.
nmap <SwipeUp> :split<CR>
nmap <SwipeDown> :split<CR><C-w>j<CR>
nmap <SwipeLeft> <C-w>v<CR>
nmap <SwipeRight> <C-w>v<CR><C-w>l<CR>
#!/bin/ksh
# Public domain. Use as you wish.
EMAIL=admins@darkstar
TMPFILE=/tmp/fmadm.output.$$
export PATH=/usr/bin:/usr/sbin
#
int
main(int argc, char *argv[])
{
dispatch_async(dispatch_get_global_queue(0, 0), ^{
EditLine *el;
History *myhistory;
int count;
const char *line;
HistEvent ev;
#define foreach(LIST, FUN) \
{ \
list_t *__i = LIST; \
while (__i != NULL) { \
FUN(__i->node); \
__i = __i->next; \
} \
} while(0)
foreach(world->hexes, ^(hex_t *hex) {
module LocationFinder
class FindMyIphone
def self.find(username, password)
agent = Mechanize.new
login_page = agent.get('https://auth.me.com/authenticate?service=findmyiphone&ssoNamespace=appleid')
login_form = login_page.forms.first
login_form.username = username
login_form.password = password
agent.submit(login_form, login_form.buttons.first)
bool
is_prime(int num)
{
int i, w;
if (num <= 1)
return false;
if (num == 2 || num == 3)
return true;