Skip to content

Instantly share code, notes, and snippets.

View blackrobot's full-sized avatar
🖖
coffee

Damon Jablons blackrobot

🖖
coffee
View GitHub Profile
"""
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
"""
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
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
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,
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 December 8, 2010 16:45
A Python recipe for Egg Nog
#!/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]))
egg_nog = {
'egg_yolks': 12,
'lbs_sugar': 1,
'cups_rum': 2,
'cups_bourbon': 2,
'quarts_whipping_cream': 2,
'egg_whites': 12,
'nutmeg': 'sprinkle',
}
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
<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 October 1, 2011 17:28
making an xml request, and turning it into xml
>>> 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