Skip to content

Instantly share code, notes, and snippets.

🖖
coffee

Damon Jablons blackrobot

🖖
coffee
Block or report user

Report or block blackrobot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View The Perfect Django Settings File
"""
Here's my sample Django settings for a project I recently did. Visit http://damonjablons.wordpress.com to see the explanation.
"""
import os
import socket
# Set DEBUG = True if on the production server
if socket.gethostname() == 'your.domain.com':
DEBUG = False
View settings.py
"""
Here's my sample Django settings for a project I recently did. Visit http://damonjablons.wordpress.com to see the explanation.
"""
import os
import socket
# Set DEBUG = True if on the production server
if socket.gethostname() == 'your.domain.com':
DEBUG = False
View __init__.py
from django.conf import settings
from django.template import add_to_builtins
import django.template.loader
try:
for lib in settings.TEMPLATE_TAGS:
add_to_builtins(lib)
except AttributeError:
pass
View gist:507275
function init_map() {
var places = [
{ name: "Place 1", coords: new google.maps.LatLng(30.728752, -73.995525)},
{ name: "Place 2", coords: new google.maps.LatLng(30.733673, -73.990028)},
{ name: "Place 3", coords: new google.maps.LatLng(40.725778, -73.992249)}
]
var myOptions = {
zoom: 14,
center: places[0].coords,
View gist:507276
function init_map() {
var places = [
{ name: "Place 1", coords: new google.maps.LatLng(30.728752, -73.995525)},
{ name: "Place 2", coords: new google.maps.LatLng(30.733673, -73.990028)},
{ name: "Place 3", coords: new google.maps.LatLng(40.725778, -73.992249)}
]
var myOptions = {
zoom: 14,
center: places[0].coords,
@blackrobot
blackrobot / Eggnog Recipe
Created Dec 8, 2010
A Python recipe for Egg Nog
View Eggnog Recipe
#!/usr/bin/env python
from measurments.abstract import SPRINKLE
from delicious import GOOD
def mix_ingredients(ingredients):
mixture = []
for key in ingredients.iterkeys():
mixture.append("%s: %s" % (key, ingredients[key]))
View gist:733539
egg_nog = {
'egg_yolks': 12,
'lbs_sugar': 1,
'cups_rum': 2,
'cups_bourbon': 2,
'quarts_whipping_cream': 2,
'egg_whites': 12,
'nutmeg': 'sprinkle',
}
View gist:766434
webhost1:~# /usr/sbin/useradd -o -u 0 hope
Adding user `hope' ...
Adding new group `hope' (1001) ...
Adding new user `hope' (1001) with group `hope' ...
Creating home directory `/home/hope' ...
Copying files from `/etc/skel' ...
Password: dragostea mea pentru
Password again: dragostea mea pentru
Changing the user information for hope
View gist:823066
<VirtualHost *:80>
ServerName acm25-9.acm.org
<Directory /var/www/vhosts/pubs/ciedev/html/ >
Order deny,allow
Allow from all
</Directory>
### You can uncomment the next three lines to partition logs for this site, just change the log paths.
# LogLevel warn
@blackrobot
blackrobot / ls.py
Created Oct 1, 2011
making an xml request, and turning it into xml
View ls.py
>>> import requests # http://python-requests.org
>>> headers = {'User-Agent': "Public App ID Goes Here/1.0", 'X-PAPPID': "private.app.id.goes.here"}
>>> response = requests.get('http://10.0.23.10:9630/api/invoices/', headers=headers, auth=("username", "password"))
# Or for a post, just change the .get to a .post/.put/.delete ...
>>> data = {'here': "is", 'my': "data", 'for': "posting"}
>>> response = requests.post('http://10.0.23.10:9630/api/invoices/', data=data, headers=headers, auth=("username", "password"))
# Now to decode the response xml to python
>>> from BeautifulSoup import BeautifulStoneStoup as BSS
You can’t perform that action at this time.