Skip to content

Instantly share code, notes, and snippets.

View robbiet480's full-sized avatar
😩
terminally online

Robbie Trencheny robbiet480

😩
terminally online
View GitHub Profile
@robbiet480
robbiet480 / directions_example.html
Created September 1, 2011 07:30
This HTML file contains Javascript code to detect location and redirect to Google Maps. Useful to tell people when they call asking for directions "go to http://robbiet.us/directions/" and it will auto direct them based on Geolocation. Uses Modernizr
<!DOCTYPE html>
<html>
<head>
<title>Directions Example</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js"></script>
<script type="text/javascript">
//Ask for HTML5 geolocation, use Modernizr to detect if we can even do it. If allow, go to show_map, if deny go to handle_error. Please note the High Accuracy flag, which may cause the location fix to take longer, but it gives a more precise reading
function get_location() {
if (Modernizr.geolocation) {
navigator.geolocation.getCurrentPosition(show_map, handle_error, {maximumAge: 75000, enableHighAccuracy: true});
@robbiet480
robbiet480 / index.html
Created September 4, 2011 04:16
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WifiSMS</title>
<link rel="apple-touch-icon-precomposed" href="touch-icon-iphone.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="touch-icon-ipad.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="touch-icon-iphone4.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=0;">
@robbiet480
robbiet480 / spammytwittertoirc.js
Created September 25, 2011 06:25
Robbie's Handy Dandy Twitter Streaming API to IRC Bot
//Robbie's handy dandy, super annoying, Twitter Streaming API To IRC bot!
//Just change all the settings to your liking. You could also repurpose this to send to places other then IRC
//npm install jerk twitter-node
var TwitterNode = require('twitter-node').TwitterNode,
jerk = require('jerk')
, sys = require('sys')
var options =
{ server: 'irc.freenode.net'
, nick: 'RobbieBot'
@robbiet480
robbiet480 / numbers.json
Created September 30, 2011 05:18
numbers.json
{
"available_phone_numbers": [
{
"friendly_name": "(206) 673-5364",
"phone_number": "+12066735364",
"latitude": "47.610000",
"longitude": "-122.330000",
"region": "WA",
"postal_code": "98154",
@robbiet480
robbiet480 / gist:1252762
Created September 30, 2011 05:24
output
Array
(
[+12066735364] => 256
[+13133347800] => 256
[+17035968708] => 256
[+17035968704] => 256
[+17035968750] => 256
[+17035968785] => 256
[+17035968841] => 256
[+17035968702] => 256
var http = require('http');
var new_url;
var new_json;
var data;
var chunk;
function unshorten(url1) {
longurl = http.createClient(80, 'api.longurl.org');
request = longurl.request('GET', "/v2/expand?format=json&url=" +escape(url1),
{'host': 'api.longurl.org','User-Agent': 'tweetfixer/1.0'});
request.end();
<?xml version="1.0"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd http://www.google.com/kml/ext/2.2 http://code.google.com/apis/kml/schema/kml22gx.xsd">
<Document id="BART04282011">
<author>
<name>Bay Area Rapid Transit District</name>
</author>
<link href="http://api.bart.gov/kml/"/>
<name>BART System</name>
<Snippet>BART system KML including station locations, station entrances, and approximate track layout.</Snippet>
<Folder id="Routes">
robbie-trenchenys-imac ओम् ~/Repos/messagefly/node_modules/hook.io-irc:(4d2h32m|git@master!)
1291 ± node bin/irc ✭
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ECONNREFUSED, Connection refused
at Socket._onConnect (net.js:601:18)
at IOWatcher.onWritable [as callback] (net.js:186:12)
robbie-trenchenys-imac ओम् ~/Repos/messagefly/node_modules/hook.io-irc:(4d2h32m|git@master!)
@robbiet480
robbiet480 / Trim.txt
Created February 20, 2012 07:17
Enable TRIM for Mac
TRIM can be enabled by using the following Terminal commands. Copy these commands and run them in Terminal:
Backup the file that you’re about to patch:
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /IOAHCIBlockStorage.original
Patch the file to enable TRIM support:
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00).{9}(\x00\x51)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
When running:
t timeline @robbie --csv --number 3000
I get:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:1060:in `request': undefined method `closed?' for nil:NilClass (NoMethodError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:772:in `get'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.0/lib/faraday/adapter/net_http.rb:70:in `perform_request'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.0/lib/faraday/adapter/net_http.rb:35:in `call'