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 python | |
import sys, paramiko | |
if len(sys.argv) < 5: | |
print "args missing" | |
sys.exit(1) | |
hostname = sys.argv[1] | |
password = sys.argv[2] |
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 python | |
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE | |
# Written by Nathan Hamiel (2010) | |
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
from optparse import OptionParser | |
class RequestHandler(BaseHTTPRequestHandler): | |
def do_GET(self): |
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
def download_cover(url, name=None): | |
#print "========================== START" | |
#print "==== COVER URL: %s" % (url,) | |
purl = urlparse(url) | |
path = purl.path | |
if path.startswith('/'): | |
path = path[1:] | |
abspath = os.path.join(settings.MEDIA_ROOT,settings.RADIOPLAYLIST_COVERS_PREFIX,path) | |
relpath = os.path.join(settings.RADIOPLAYLIST_COVERS_PREFIX,path) | |
if not os.path.exists(os.path.dirname(abspath)): |
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
#make some settings accessible via settings.FOO from within templates | |
from django.conf import settings | |
def exposed_settings(request): | |
context_settings = dict() | |
for x in settings.TEMPLATE_CONTEXT_SETTINGS: | |
context_settings[x] = getattr(settings, x) | |
return { 'settings': context_settings } |
NewerOlder