Skip to content

Instantly share code, notes, and snippets.

View andymboyle's full-sized avatar

Andy Boyle andymboyle

View GitHub Profile
UPDATE `wp_posts`
SET `post_author`=6
WHERE `post_content` LIKE '%Cole Moser%';
UPDATE `wp_posts`
SET `post_author`=5
WHERE `post_content` LIKE '%Kyle Scanlan%';
UPDATE `wp_posts`
SET `post_author`=4
@andymboyle
andymboyle / gist:6514291
Created September 10, 2013 19:22
PostGIS spatial_ref_sys INSERT statement for 4326 SRID
The one listed on http://spatialreference.org/ref/epsg/4326/ has an errant 9 somewhere. The correct SQL statement is below:
INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 4326, 'epsg', 4326, '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ', 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]');
@andymboyle
andymboyle / __init__.py
Created July 1, 2013 01:42
Loading the Google doc
import gdata.docs.service
import gdata.spreadsheet.service
import os
import tempfile
import csv
def get_spreadsheet(account, password, key, gid):
gd_client = gdata.docs.service.DocsService()
gd_client.email = account
@andymboyle
andymboyle / load_homicides.py
Last active December 19, 2015 04:29
Management command for Django tutorial project
from dateutil import parser
from django.core.management.base import BaseCommand
from optparse import make_option
from datetime import datetime
from gdocs_importer import logger
from gdocs_importer.models import Homicide
from gdocs_importer.lib import get_spreadsheet
GOOGLE_KEY = '' # Enter the Google key here
import django
import os
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
from django.db import models
class Homicide(models.Model):
address = models.CharField(max_length=100, blank=True, null=True)
date_time = models.DateTimeField(blank=True, null=True)
location = models.CharField(max_length=50, blank=True, null=True)
neighborhood = models.CharField(max_length=100, blank=True, null=True)
age = models.IntegerField(blank=True, null=True)
gender = models.CharField(max_length=7, blank=True, null=True)
DATABASES = {
'default': {
'NAME': 'gdocs_importer',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': 'localhost',
'PORT': '5432'
},
}
@andymboyle
andymboyle / gist:5320805
Created April 5, 2013 16:49
Fixing KCET's autoplay
So, KCET apparently has their autoplay set on all of their embed videos. If you're using their embed code, you're going to need to add this line to the end of the embed code, before the closing object tag -- </object>
Here's the code to add: <param name="flashVars" value="autoPlay=false" />
Example code can be seen below:
<object name="kaltura_player_1365179991" id="kaltura_player_1365179991" type="application/x-shockwave-flash" autoPlay="false" allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" height="300" width="533" data="http://www.kaltura.com/index.php/kwidget/wid/1_x0vu51tw/uiconf_id/8700151"><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="bgcolor" value="#000000" /><param name="movie" value="http://www.kaltura.com/index.php/kwidget/wid/1_x0vu51tw/uiconf_id/8700151"/><param name="flashVars" value=""/><a href="http://corp.kaltura.com">video platform</a><a href="http://corp.kaltu
# translation mapping table that converts
# single smart quote characters to standard
# single quotes
SINGLE_QUOTE_MAP = {
0x2018: 39,
0x2019: 39,
0x201A: 39,
0x201B: 39,
0x2039: 39,
0x203A: 39,
Twenty-eight District 214 students have been selected among the finest high school musicians in the state to perform in the Illinois Music Educators Association (IMEA) All-State Festival on Jan. 23-26 in Peoria, Ill.
The following District 214 students have been chosen as All-State participants:
Buffalo Grove High School-junior Peter Kotecki-Band (clarinet); and seniors Megan Rullo--Band (bassoon), Michael Maley-Orchestra (double bass), and Joe Cavaiani-Vocal Jazz (tenor). Buffalo Grove music teachers are Edward Jacobi (Band), Debora Utley (Choir), and Elizabeth Bennett (Orchestra).
Elk Grove High School-junior Peter Pendowski-Chorus (bass); and seniors Taylor Barnes, Orchestra (viola), John-Paul Pendowski-Chorus (bass), and Sarah Barts-Future Music Educator Seminar-Band. Elk Grove music teachers are Ron Fiorito (Band), Sarah Catt (Choir), and William Baar (Orchestra).
John Hersey High School-sophomore Tiffany Chung-Orchestra (violin); juniors Mary Casagrande-Band (French horn), Jeremy Fuller--Band (bass cl