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
import os | |
class WSGIApp(object): | |
def __init__(self): | |
setup_logger(os.environ.get('PYCSW_CONFIG')) | |
def __call__(self, env, start_repsonse): | |
""" Do reqeust stuff here """ | |
application = WSGIApp() |
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 api_url_for(endpoint, **values): | |
# probably handle missing api_app key in some | |
# special exception. | |
api_app = current_app().config["api_app"] | |
with api_app.app_context(): | |
return url_for(end_point, **values) | |
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
#!/bin/bash | |
DIR=$( cd "$( dirname "$0" )" && pwd ) | |
source $DIR/../env.sh | |
if [ ! X_OPENSHIFT_RUNNING_LOCAL ]; then | |
source $X_OPENSHIFT_VENV/bin/activate | |
fi |
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
#!/bin/bash | |
# | |
# .openshift/action_hooks/build | |
# | |
DIR=$( cd "$( dirname "$0" )" && pwd ) | |
source $DIR/../env.sh | |
if [ ! -d $X_OPENSHIFT_VENV ]; then | |
echo "[build] $(virtualenv --distribute $X_OPENSHIFT_VENV)" |
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
class BaseConverter(object): | |
""" | |
Class for encoding/decoding base 10 values to/from another base | |
""" | |
def __init__(self, base, base_digits): | |
""" | |
:param base: (int) the base (e.g 2, 16, 64) | |
:param base_digits: (iterator) of base digits (e.g "01" for base 2, etc) | |
""" | |
self.base = base |
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
#!/usr/bin/env python | |
import sys | |
print "\\n".join([l.strip() for l in sys.stdin.readlines()]) |
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 http = require('http'); | |
var RX = require('rx'); | |
var request = require('request'); | |
function get(url) { | |
return RX.Observable.create(function(observer) { | |
request(url, function(err, response, body) { | |
if (err) { | |
observer.onError(err); | |
return; |
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
Shawn's Intellij Shortcuts | |
Symbols: | |
⌥ Option | |
⌘ Command | |
⇧ Shift | |
⌃ Control | |
← Left arrow | |
→ Right Arrow | |
↑ Up Arrow |
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
let plugins = getPlugins() | |
.flatMap(p => p) | |
// Group plugins by consumer_id or app_id | |
.reduce((obj, p) => { | |
let id = p.consumer_id || p.api_id; | |
if (id in obj) { | |
obj[id].push(p); | |
} else { | |
obj[id] = [p]; | |
} |
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
# statsd | |
sudo tcpdump -i eth0 -p -n -s 1500 -A udp port 8125 | |
# statsd flushing to graphite | |
sudo tcpdump 'port 2005 or 2009' -s0 -A | |
# collectd | |
sudo tcpdump -i eth0 -p -n -s 1500 -A udp port 25827 |