Skip to content

Instantly share code, notes, and snippets.

View aaronpk's full-sized avatar

Aaron Parecki aaronpk

View GitHub Profile
def get_distance
venues = []
venues << Venue.new(:lat => 45.572952,:lon => -122.68394,:name => "my house", :vid => 6129841)
venues << Venue.new(:lat => 45.569133, :lon => -122.681568, :name => "new seasons", :vid => 42031)
venues << Venue.new(:lat => 45.429839, :lon => -122.574021, :name => "24 hour fitness clackamas", :vid => 115506)
venues << Venue.new(:vid => 89015, :name => "Fred Meyer, Arbor Lodge", :lat=> 45.577137, :lon => -122.68199)
venues << Venue.new(:vid => 39705, :name => "The Green Dragon", :lat => 45.515798, :lon => -122.656703)
venues << Venue.new(:vid => 36395, :name => "Oregon Convention Center", :lat => 45.528311, :lon => -122.663204)
@naoyamakino
naoyamakino / parser.py
Created February 23, 2011 07:29 — forked from aaronpk/parser.py
iCal feed parser for HearNear.org
from icalendar import Calendar, Event
import simplejson as json
import re
import web
from mimerender import mimerender
import sys
import urllib2
event = {}
@donpdonp
donpdonp / gist:1260156
Created October 3, 2011 20:32
twitter stream to irc
require 'tweetstream'
require 'json'
require 'irc-socket'
SETTINGS = JSON.load(File.open("settings.json"))
@irc = IRCSocket.new(SETTINGS["server"])
@irc.connect
@irc.nick SETTINGS["nick"]
@irc.user SETTINGS["nick"], 0, "*", "Neuron Bot"
@irc.join("#pdxtwitter")
@springmeyer
springmeyer / ruby-mapnik.sh
Created October 9, 2011 04:11
compile ruby-mapnik against mapnik trunk on ubuntu 11.04
## install mapnik 2.x (trunk) from nightlies
# be careful with this because these change nightly
# and may require you re-compile apps using mapnik
# after you run `apt-get upgrade` post installation of mapnik
apt-get install python-software-properties
apt-add-repository ppa:mapnik/nightly-trunk
sudo apt-get update
sudo apt-get install libmapnik2 libmapnik2-dev mapnik2-utils python-mapnik2
## install ruby
@patrickarlt
patrickarlt / gist:5601428
Created May 17, 2013 19:33
Iterate stuff in Javascript
var foo = {
key1: "a",
key2: "b",
key3: "c"
};
// node, modern browsers
Object.keys(foo).forEach(function (key, i, keys) {
console.log(key, foo[key]);
});
@julien51
julien51 / push.js
Last active December 18, 2015 04:19
var request = require('request');
// app below needs to be a Connect/Express app.
// Subscribing: use https://push.superfeedr.com/ to use Superfeedr (works with any feed!)
function subscribe(url, conf, cb) {
var hub = conf.hub;
var params = {
method: 'POST',
uri: hub,
@kyledrake
kyledrake / gist:1498932
Last active August 2, 2016 04:31
Neocities' Rainbows! config file - https://neocities.org
# This is Neocities' Rainbows! config file. We are using this in production to run all our web apps.
# It works really well for us and has been heavily load tested, so I wanted to share it with the community.
#
# In my opinion, this is the best way to deploy a ruby web application. Unlike EventMachine based solutions,
# it uses real ruby threads, which allows it to take advantage of the internal non-blocking IO pattern
# in MRI.
#
# Contrary to popular belief, MRI doesn't block execution to wait on IO when you are using threads, even
# with the GIL. The requests are done concurrently for anything that is based on the IO class. This
# includes things like Net::HTTP and even `system commands`. Grep the MRI Ruby source code for
@donpdonp
donpdonp / indieauth.php
Last active July 8, 2018 15:39
indieauth minimal html/php
// callback from indieauth
$home = "http://example.org";
$fields = array("code"=>$_GET["token"],
"redirect_uri" => $home."/auth.php");
$ch = curl_init();
$indieauth = "https://indieauth.com/auth";
curl_setopt($ch,CURLOPT_URL, $indieauth);
curl_setopt($ch,CURLOPT_POST, True);
curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($fields));
#sudo sysctl -w net.inet.ip.portrange.first=32768
sudo sysctl -w net.inet.ip.portrange.first=12000
sudo sysctl -w net.inet.tcp.msl=1000
sudo sysctl -w kern.maxfiles=1000000 kern.maxfilesperproc=1000000
@jaseg
jaseg / gist:3334991
Created August 12, 2012 22:32
Password manager without a password manager

Prelude

Since password managers are big and complicated and I currently am pretty bored since I am sitting in a car for a few hours, here is a simple algorithm to generate resource-specific, unique passwords using a master password and no password database.

WARNING

As pointed out here: http://news.ycombinator.com/item?id=4374888 this method is broken.

Usage