Skip to content

Instantly share code, notes, and snippets.


Jimmy John jimmyislive

View GitHub Profile
def csrf_check(web_request):
def real_decorator(view_func):
def wrapper(*args, **kwargs):
if (request.method == 'GET'):
return view_func(*args, **kwargs)
u = urlparse(request.headers['Origin'])
if u.netloc in ['', '']:
return view_func(*args, **kwargs)
import base64
import boto3
from Crypto.Cipher import AES
class AwsKms(object):
def __init__(self):
self.key_id = AWS_KMS_ARN
self.client = boto3.client('kms',
View gist:d9d00783f06d7f278e30
Ever want to meet like minded individuals who have (or have the desire) to start some crazy idea on their own. Maybe over coffee or lunch. You may/may not want to start your own, but just meeting with such folks is an interesting excercise in itself. If so, email me your details and i'll hook you up with someone closeby (me included!)
jimmyislive /
Created Jan 4, 2015
Redis Elasticache Export
from optparse import OptionParser
import sys
import redis
__author__ = 'Jimmy John'
__doc__ = '''
This is a script to make a copy of a redis db. Mainly to be used for cloning AWS Elasticache
instancces. Elasticache seems to disable the SAVE/BGSAVE commands and you do not have access to
the physical redis instances. The UI allows you to create 'Snapshots', but no way to download
View form
<div class="control-group">
<label class="hidden" for="inputPot">Do not fill me in</label>
<div class="controls">
<input class="hidden" type="text" id="inputPot" placeholder="pot" ng-model="session.packagePot" name="packagePot">
jimmyislive / index.js
Created Apr 16, 2014
angularjs with seo
View index.js
exports.index = function(req, res){
if (req.query._escaped_fragment_ !== undefined) {
if (req.query._escaped_fragment_[0] === '/') {
req.query._escaped_fragment_ = req.query._escaped_fragment_.substring(1);
if (req.query._escaped_fragment_[req.query._escaped_fragment_.length - 1] === '/') {
req.query._escaped_fragment_ = req.query._escaped_fragment_.substring(0, req.query._escaped_fragment_.length - 1);
jimmyislive / api_module.js
Last active Jan 3, 2018
Single Page App components
View api_module.js
var cfg = require('../config').Config,
qs = require('querystring'),
request = require('request');
request = request.defaults({jar: true})
exports.awesome = function(req, res){
headers = {};
jimmyislive / pubsubhubbub_post.js
Created Dec 16, 2013
Sample function that can be used to POST to the hub whenever your feed changes. The cfg object is something that has all the appropriate params depending on which environment you are on e.g. dev | staging | production etc
View pubsubhubbub_post.js
function pubsubhubub_post(post_url, callback) {
var payload = { hostname: cfg.hub,
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
var pubsubhubub_request = https.request(payload, function(pubsubhubub_response) {
//dunno y, but this no-op is needed here !!!
pubsubhubub_response.on('data', function(chunk) {
jimmyislive / feeds.html
Created Dec 2, 2013
Sample files to add a RSS feed to an Express/Restify setup
View feeds.html
<?xml version="1.0"?>
<rss version="2.0">
<title>My title</title>
<description>My Description</description>
<copyright>Copyright 2014, MyAwesomeSite</copyright>