Skip to content

Instantly share code, notes, and snippets.

@willvanwazer
willvanwazer / keybase.md
Created February 16, 2015 22:47
Keybase!

Keybase proof

I hereby claim:

  • I am willvanwazer on github.
  • I am willvanwazer (https://keybase.io/willvanwazer) on keybase.
  • I have a public key whose fingerprint is 4CA2 494B 210C 0007 95A0 C24F FDF5 98BD 9248 AD83

To claim this, I am signing this object:

@willvanwazer
willvanwazer / evansmith
Created July 16, 2012 20:26 — forked from evansmith/evansmith
ejb file
package com.washingtonpost.mentionmachine.processing.beans;
import javax.annotation.PostConstruct;
import javax.ejb.LocalBean;
import javax.ejb.Singleton;
import java.util.Calendar;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.*;
@willvanwazer
willvanwazer / jboss
Last active December 13, 2015 17:38 — forked from lionelg3/jboss-as
#!/bin/sh
# Load JBoss AS init.d configuration.
if [ -z "$JBOSS_CONF" ]; then
JBOSS_CONF="/etc/jboss/jboss.conf"
fi
[ -r "$JBOSS_CONF" ] && . "${JBOSS_CONF}"
if [ -z "$JBOSS_HOME" ]; then
@willvanwazer
willvanwazer / redirect.py
Last active December 15, 2015 09:29
Change in Django Redirects
# In Django 1.4, this works fine:
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import redirect_to
urlpatterns = patterns('',
url(r'^redirect/', redirect_to, {'url': 'http://foo'}),
)
# In Django 1.5, it is changed to this:
from django.conf.urls.defaults import patterns, include, url
import requests
CLIENT_KEY=""
EMAIL=""
PASSWORD=""
AUTHORIZE_ENDPOINT="http://feedwrangler.net/api/v2/users/authorize?email=%s&password=%s&client_key=%s" % (EMAIL, PASSWORD, CLIENT_KEY)
authorize = requests.get(AUTHORIZE_ENDPOINT)
access_token = authorize.json()['access_token']
@willvanwazer
willvanwazer / parse.py
Created September 23, 2015 01:56
A snippet of code from the Washington Post's internal story API to process iframes.
# And now we get into the fun rando ones
# First up, vevo! https://www.eff.org/https-everywhere/atlas/domains/vevo.com.html
elif 'http://cache.vevo.com/' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://cache.vevo.com/', 'https://scache.vevo.com/')
# Next up YouTube
elif 'http://www.youtube.com/' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://www.youtube.com/', 'https://www.youtube.com/')
# Gfycat http://gfycat.com
elif 'http://gfycat.com' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://gfycat.com/', 'https://gfycat.com/')