Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python2.4
import sys
import email
import urllib
import httplib
from optparse import OptionParser, OptionGroup
from datetime import datetime
PROWLURL='prowl.weks.net'
APIKEY='YOUR_PROWL_API_KEY'
player = null; // niftyplayer instance
files = []; // playlist order; could be shuffled
_files = []; // original order
retries = 0; // how many times javascript tried to find player
int = null; // setInterval handle
// parse all .mp3 links on the page
as = document.getElementsByTagName('a');
for (var i = 0; i < as.length; i++) {
diff --git a/skel/heroku.vcl b/skel/heroku.vcl
index 4b74b22..56280e1 100644
--- a/skel/heroku.vcl
+++ b/skel/heroku.vcl
@@ -62,6 +62,9 @@ sub vcl_recv {
# serve stale items for 30 seconds while fetching new item from backend
set req.grace = 30s;
+ # remove the cookie header for cached pages
+ unset req.http.cookie;
#!/usr/bin/python2.4
import urllib
import httplib
from optparse import OptionParser, OptionGroup
GVHOST = 'clients4.google.com'
GVPATH = '/voice/embed/webButtonConnect'
BUTTONID = '7c175b61b7a363681b1db4d6522c5d4927614d0e'
def connect(caller_number):
<audio />
<script type="text/javascript">
var audio = document.getElementsByTagName('audio')[0];
audio.src = "http://example.com/song.mp3";
audio.load();
audio.play();
</script>
import base64
from django.http import HttpResponse
class http_auth_required(object):
"""
A decorator to handle basic HTTP authentication. Takes a dictionary of
username: password pairs to authenticate against.
"""
def __init__(self, credentials):
self.credentials = credentials

Install the pre-release of bundler. When 1.0 is final the --pre flag will not be necessary.

$ gem install bundler --version=1.0.0.rc.2
Successfully installed bundler-1.0.0.rc.2
1 gem installed

Modify your Gemfile, and locally re-bundle you app with the new bundler options. If bundler complains about the Gemfile format, fix it according to the directions on http://gembundler.com/v1.0/index.html. If you have an old bundler gem defined in your Gemfile, make sure to un-pin it from 0.9.x.

$ echo >> Gemfile

$ bundle install --path vendor/bundle

An exception occurred
no such file to load -- /app/sw/lib/ext/melbourne/rbx/melbourne20 (LoadError)
Backtrace:
Rubinius::CodeLoader#load_error at kernel/common/codeloader.rb:347
Rubinius::CodeLoader#resolve_require_path at kernel/common/codeloader.rb:334
{ } in Rubinius::CodeLoader#require at kernel/common/codeloader.rb:35
Rubinius.synchronize at kernel/bootstrap/rubinius.rb:133
Rubinius::CodeLoader#require at kernel/common/codeloader.rb:34
Rubinius::CodeLoader.require at kernel/common/codeloader.rb:145

Ruby Language Pack

#!/bin/sh
NAME=$1
DATADIR=${2:-.pg}
[ $NAME == "" ] && { echo usage: pg_dev NAME [DATADIR]; exit 1; }
echo Initializing database in $DATADIR
initdb $DATADIR