Skip to content

Instantly share code, notes, and snippets.

View natea's full-sized avatar

Nate Aune natea

View GitHub Profile
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
@natea
natea / configure.zcml
Created November 25, 2010 17:41
The configure.zcml file for sft.theme
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="sft.theme">
<five:registerPackage package="." initialize=".initialize" />
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyn9B9dr82CcXoGTckQcFU23BtJlR/JGAEmcP+vxED03TQdESMtUGDR75/BCeAXYjPLOYehW4xmCYL4yLSfWtFYTExi0FFE1NBEH5rVURY6ba4SwjtHNHRON1wP7HIIXbbgXjaIJpa7SXWxNNEf3Vp50gGl3oZQ0K718gDWRcEBQ5mTf4/wH0taucDNVrXk2S2XE3wU10eNMAV4drzbb/EZopu2FciI427CgSecT9xvPA33RVxITl4PmA4b1uaJgdh8QkbkaQIYokNPWHbLOTGiG+N+CGk6R2OapWbVOY/ZkY9hVZ+wIuIehspCHSct15wlujN1LiUgNs4bGIRD8cZQ== [email protected]
@natea
natea / AddGeometryColumns() - invalid SRID
Created February 26, 2011 18:45
Error message when trying to load fixcity dataset
$ psql -d bmabr -f fixcity/sql/gis_community_board.sqlBEGIN
psql:fixcity/sql/gis_community_board.sql:9: NOTICE: CREATE TABLE will create implicit sequence "gis_community_board_gid_seq" for serial column "gis_community_board.gid"
psql:fixcity/sql/gis_community_board.sql:9: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "gis_community_board_pkey" for table "gis_community_board"
CREATE TABLE
psql:fixcity/sql/gis_community_board.sql:10: ERROR: AddGeometryColumns() - invalid SRID
CONTEXT: SQL statement "SELECT AddGeometryColumn('', $1 , $2 , $3 , $4 , $5 , $6 )"
PL/pgSQL function "addgeometrycolumn" line 5 at SQL statement
psql:fixcity/sql/gis_community_board.sql:11: ERROR: current transaction is aborted, commands ignored until end of transaction block
@natea
natea / DatabaseError with relation "django_content_type"
Created March 27, 2011 00:27
Error when running manage.py syncdb on FeinCMS
Traceback (most recent call last):
File "/cust/p00000013/bundle_p00000013_2011-03-26-23.09.07/thisbundle.py", line 52, in <module>
run_managepy()
File "/cust/p00000013/bundle_p00000013_2011-03-26-23.09.07/thisbundle.py", line 37, in run_managepy
management.execute_from_command_line()
File "/cust/p00000013/bundle_p00000013_2011-03-26-23.09.07/lib/python2.6/site-packages/django/core/management/__init__.py", line 429, in execute_from_command_line
utility.execute()
File "/cust/p00000013/bundle_p00000013_2011-03-26-23.09.07/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/cust/p00000013/bundle_p00000013_2011-03-26-23.09.07/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
@natea
natea / bootstrap.sh
Created June 3, 2011 14:51 — forked from anonymous/bootstrap.sh
Django on Heroku with Celery and Sentry
virtualenv --no-site-packages .
source bin/activate
bin/pip install Django psycopg2 django-sentry
bin/pip freeze > requirements.txt
bin/django-admin.py startproject mysite
cat >.gitignore <<EOF
bin/
include/
lib/
EOF
@natea
natea / api.py
Created June 7, 2011 21:07
valentunes api.py (basic)
from tastypie.resources import ModelResource
from valentunes.models import Card, Track
class TrackResource(ModelResource):
class Meta:
queryset = Track.objects.all()
resource_name = 'track'
class CardResource(ModelResource):
@natea
natea / models.py
Created June 7, 2011 21:36
Valentunes models.py
class Card(models.Model):
""" Card is a valentine's day card that contains the information
about who the card is from and who it's to, what the recipients
interests are and a personal note.
"""
user = models.ForeignKey(User)
recipient_name = models.CharField(max_length=200, blank=True)
recipient_email = models.EmailField(max_length=200, null=True, blank=True)
recipient_phone = models.CharField(max_length=200, blank=True)
intro_note = models.TextField(max_length=1000, blank=True)
@natea
natea / urls.py
Created June 7, 2011 21:42
Valentunes urls.py
from vt.valentunes.api import CardResource, TrackResource
card_resource = CardResource()
track_resource = TrackResource()
urlpatterns = patterns('',
...
(r'^api/', include(card_resource.urls)),
(r'^api/', include(track_resource.urls)),
@natea
natea / models.py
Created June 7, 2011 21:45
Valentunes Card class
class Card(models.Model):
""" Card is a valentine's day card that contains the information
about who the card is from and who it's to, what the recipients
interests are and a personal note.
"""
user = models.ForeignKey(User)
recipient_name = models.CharField(max_length=200, blank=True)
recipient_email = models.EmailField(max_length=200, null=True, blank=True)
recipient_phone = models.CharField(max_length=200, blank=True)
intro_note = models.TextField(max_length=1000, blank=True)