Skip to content

Instantly share code, notes, and snippets.

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
<audio />
<script type="text/javascript">
var audio = document.getElementsByTagName('audio')[0];
audio.src = "http://example.com/song.mp3";
audio.load();
audio.play();
</script>
#!/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):
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;
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++) {
#!/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'