Skip to content

Instantly share code, notes, and snippets.

View elidickinson's full-sized avatar

Eli Dickinson elidickinson

View GitHub Profile
elidickinson / max_width_email.html
Created May 6, 2013 15:10
Email Template trick: max-width with outlook
<!--[if mso]>
<table><tr><td width="580">
<div style="max-width:580px; margin:0 auto;">
<p>This text will be centered and constrained to 580 pixels even on Outlook which does not support max-width CSS</p>
<!--[if mso]>
elidickinson / html_email_buttons_1.html
Last active November 27, 2023 14:55
HTML email buttons that work
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="" style="height:40px;v-text-anchor:middle;width:300px;" arcsize="10%" stroke="f" fillcolor="#d62828">
<center style="color:#ffffff;font-family:sans-serif;font-size:16px;font-weight:bold;">
Button Text Here!
<![if !mso]>
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
class SaferProxyFix(object):
"""This middleware can be applied to add HTTP proxy support to an
application that was not designed with HTTP proxies in mind. It
sets `REMOTE_ADDR`, `HTTP_HOST` from `X-Forwarded` headers.
If you have more than one proxy server in front of your app, set
num_proxy_servers accordingly
Do not use this middleware in non-proxy setups for security reasons.
# What 8 letter word can have a letter taken away, and each time still make another word, until only one letter (and one word) are left?
words_by_length = [set(), set(), set(), set(), set(), set(), set(), set(), set()]
with open('scrabble2019.txt') as f:
for w in f:
word = w.strip()
word_len = len(word)
if word_len <= 8:
answers = set()
var x = $(".gb-domain-name").each(function(i,x) { console.log($(x,"span").text())}); window.scrollBy(0,600)

Keybase proof

I hereby claim:

  • I am elidickinson on github.
  • I am esd ( on keybase.
  • I have a public key whose fingerprint is 6884 A79C 69EC C924 961C 95B9 2CEB 89F6 30BC 7837

To claim this, I am signing this object:

elidickinson /
Created August 15, 2013 02:04
Update twitter profile background image
import tweepy
import tempfile
import urllib
from time import sleep
import os
url = ''
# The consumer keys can be found on your application's Details
# page located at (under "OAuth settings")
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
elidickinson /
Created October 23, 2012 12:59
Script to check that a list of email address have valid domains (i.e. they have an MX record)
# pip install pydns
import DNS, smtplib
import csv, re
in_filename = 'input.csv'
skip_to = None
# DNS.DiscoverNameServers()