Skip to content

Instantly share code, notes, and snippets.

View elidickinson's full-sized avatar

Eli Dickinson elidickinson

View GitHub Profile
load data local infile 'c:/fierce/fwe_opens.csv' ignore into table opens fields
lines terminated by '\n'
set mlid = 102866,
check_time = from_unixtime(@check_time),
last_open = if(@last_open<=0,NULL,date(from_unixtime(@last_open)))
elidickinson /
Created February 17, 2011 21:20
Send weather updates to your HP Printer LCD dispaly
import pywapi #
import telnetlib
import sys
if len(sys.argv) != 3:
print "USAGE: python <ZIPCODE> <PRINTER_IP>"
location_id = sys.argv[1]
elidickinson / merge_feeds_with_simplepie.php
Created March 14, 2011 17:15
Merge feeds in PHP with simplepie
<?php print '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<rss version="2.0" xmlns:dc="">
The latest wireless industry news from FierceWireless
elidickinson / mysql_extract_domain.sql
Created March 28, 2011 00:25
MySQL extract domain
# domain from email address
SELECT mid(email from locate('@',email)+1) as domain FROM emails;
# domain from URL (hacky)
SELECT MID(url,8,LOCATE('/',url,8)-8) AS domain FROM clicks
elidickinson /
Created May 18, 2011 20:53
scrap bio exhib
# First: wget --random-wait --wait=2 --limit-rate=100K{1..142}
# But that saves them with a stupid name, so rename using:
# ls -d exhib* | sed 's/\(.*\)=\(.*\)$/mv "&" "bio\2.html"/' | sh
from BeautifulSoup import BeautifulSoup
import csv
import glob
import os
writer = csv.writer(open("bio.csv", "wb"))
elidickinson / gist:1288059
Created October 14, 2011 19:23
form auto fill
elidickinson /
Created November 20, 2011 01:16
Using CKEditor with Flatpages
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
# Note: we are renaming the original Admin and Form as we import them!
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
from django import forms
from ckeditor.widgets import CKEditorWidget
elidickinson /
Created December 17, 2011 21:47
Pretty prints HTML file
import sys
from BeautifulSoup import BeautifulSoup as bs
print soup.prettify()
elidickinson /
Created January 28, 2012 17:20
show how to access libots C library from Python
from ctypes import *
from ctypeslib.contrib.pythonhdr import *
def quick_summary(data,words=150):
ots = OTS()
return ots.summarize_by_words(words)
class OTS:
libots = None
elidickinson / mobile-detect.vcl
Last active June 14, 2018 11:52
Varnish config for user agent sniffing
# This file has been modified by Eli Dickinson to update detection rules and to
# send a Vary header downstream. It has also been updated to
# work with newer versions of Varnish.
# A simple mobile device detection implementation in VCL
# The file is based upon initial work done by Audun Ytterdal, which can be