This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def csrf_check(web_request): | |
def real_decorator(view_func): | |
@wraps(view_func) | |
def wrapper(*args, **kwargs): | |
if (request.method == 'GET'): | |
return view_func(*args, **kwargs) | |
u = urlparse(request.headers['Origin']) | |
if u.netloc in ['www.my_awesome_domain.com', 'my_awesome_domain.com']: | |
return view_func(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define your AWS_KMS_ARN, KMS_REGION, KMS_AWS_ACCESS_KEY_ID, KMS_AWS_SECRET_ACCESS_KEY someplace | |
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!) | |
Jim | |
[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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"> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cfg = require('../config').Config, | |
qs = require('querystring'), | |
request = require('request'); | |
request = request.defaults({jar: true}) | |
exports.awesome = function(req, res){ | |
headers = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<rss version="2.0"> | |
<channel> | |
<title>My title</title> | |
<link>https://awesomesite.com/#/</link> | |
<description>My Description</description> | |
<language>en-us</language> | |
<copyright>Copyright 2014, MyAwesomeSite</copyright> | |
<managingEditor>[email protected]</managingEditor> | |
<webMaster>[email protected]</webMaster> |