This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# simply copy an ip address to your clipboard, then run: | |
# ./drivel.rb | |
# to mount an sshfs partition and open it up in Finder.app. To unmount, run: | |
# ./drivel.rb unmount | |
# requires a Mac running MacFUSE and sshfs | |
host = `pbpaste` | |
prefix = host.include?("@") ? "@" : "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'socket' | |
class IP | |
def self.local | |
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true | |
UDPSocket.open { |s| s.connect('64.233.187.99', 1); s.addr.last } | |
ensure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'nokogiri' | |
XSL = <<-EOXSL | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="xml" encoding="ISO-8859-1"/> | |
<xsl:param name="indent-increment" select="' '"/> | |
<xsl:template name="newline"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Shell script for compiling SpiderMonkey for iPhone | |
# | |
# 1) Install autoconf 2.13 if you don't have it. You can install it with | |
# port install autoconf213, or manually like so: | |
# curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz | |
# tar xzf autoconf-2.13.tar.gz | |
# cd autoconf-2.13 | |
# ./configure --program-suffix=213 --prefix=/Users/nathano/.local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2007 Scott Lembcke | |
* | |
* 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 | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be included in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# how to install boehm gc on OS X | |
task :clean do | |
sh "rm -rf gc" if File.exists?("gc") | |
end | |
task :checkout do | |
#sh "curl -O http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2alpha4.tar.gz" | |
#sh "tar zxf gc-*.tar.gz && rm gc-*.tar.gz" | |
#sh "mv gc-* gc" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# turn any directory into a simple fileserver | |
# | |
# USAGE: | |
# ruby fileserve.rb # starts server for current dir on port 4567 | |
# ruby fileserve.rb ../ # starts server for parent dir | |
# ruby fileserve.rb ../ 4568 # starts server for parent dir on port 4568 | |
require 'rack' | |
require 'webrick' | |
require 'sinatra/base' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://snippets.aktagon.com/snippets/445-How-to-create-a-JSONP-cross-domain-webservice-with-Sinatra-and-Ruby | |
require 'sinatra/base' | |
require 'json/pure' | |
module JSONPatra | |
class App < Sinatra::Base | |
get "/" do | |
callback = params['callback'] | |
json = { :hello => "world!" }.to_json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface Communicator : NSObject <NSStreamDelegate> { | |
@public | |
NSString *host; | |
int port; | |
} | |
- (void)setup; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main (int argc, const char *argv[]) { | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
[[NSNotificationCenter defaultCenter] | |
addObserverForName:@"randomEvent" object:nil | |
queue:[NSOperationQueue mainQueue] | |
usingBlock:^(NSNotification *note) { | |
NSString *message = [[note userInfo] valueForKey:@"message"]; |