This file contains 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
import MySQLdb | |
host = 'localhost' | |
user = 'USER' | |
passwd = 'PASSWORD' | |
database = raw_input('Enter database name:') | |
conn = MySQLdb.connect (host=host, user=user, passwd=passwd, db=database) |
This file contains 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
import base64 | |
import httplib | |
import logging | |
import string | |
try: | |
import simplejson as json | |
except ImportError: | |
import json | |
class settings: |
This file contains 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
import base64 | |
import httplib | |
import logging | |
import string | |
try: | |
import simplejson as json | |
except ImportError: | |
import json | |
class settings: |
This file contains 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
from django import template | |
register = template.Library() | |
@register.filter | |
def fileNameClean(file, arg): | |
''' | |
Return the file name without any directory information. | |
''' | |
obj = getattr(file, arg, False) |
This file contains 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/python | |
# simple python script to return your public IP address using whatismyip.com | |
# if executed from command line will display IP | |
def findIP(): | |
''' | |
Returns your IP address. Includes setting the header to match the request | |
see http://www.whatismyip.com/faq/automation.asp | |
''' |
This file contains 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/python | |
import urllib2 | |
from boto.ec2.connection import EC2Connection | |
try: | |
from django.conf import settings | |
except ImportError: | |
class settings: |
This file contains 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
adjust_timeout () { | |
cat <<EOF | |
if keystatus --shift; then | |
set timeout=-1 | |
else | |
set timeout=0 | |
fi | |
EOF | |
} |
This file contains 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
# coding: utf-8 | |
import re | |
## quick hack to convert gimp color palettes into scss vars | |
## ended up getting rather complex when I started making it more dynamic | |
## may clean up in the future as proper functions with command line option | |
## title will be written as title_basetitle_sub[loop#] | |
## allows customization of title that could be extended into a config |
This file contains 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
from math import cos, sin, atan2, sqrt | |
def center_geolocation(geolocations): | |
""" | |
Provide a relatively accurate center lat, lon returned as a list pair, given | |
a list of list pairs. | |
ex: in: geolocations = ((lat1,lon1), (lat2,lon2),) | |
out: (center_lat, center_lon) | |
""" | |
x = 0 |
This file contains 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
// Example testing sketch for various DHT humidity/temperature sensors | |
// Written by ladyada, public domain | |
#include "DHT.h" | |
#define DHTPIN 2 // what pin we're connected to | |
#define DHTPIN2 3 // what pin we're connected to | |
// Uncomment whatever type you're using! | |
#define DHTTYPE DHT11 // DHT 11 |
OlderNewer