Skip to content

Instantly share code, notes, and snippets.

View SEJeff's full-sized avatar

Jeff Schroeder SEJeff

View GitHub Profile
@SEJeff
SEJeff / debugdjango_function.sh
Created November 4, 2010 19:25
This is the shell function I use to catch snowy tracebacks when a tomboy sync fails
debugdjango() {
action=${1:-traceback}
port=${2:-8000}
interface=${3:-lo}
TCPDUMP="tcpdump -i${interface} -A port ${port}"
case $action in
all)
echo "INFO: Running tcpdump on interface $interface and port $port" >&2
sudo $TCPDUMP
;;
@drawks
drawks / gist:1556276
Created January 3, 2012 18:47 — forked from kimchy/gist:1556146
Enable _source compression in elasticsearch
curl -XPUT 'http://localhost:9200/_template/template_logstash/' -d '
{
"template": "logstash-*",
"mappings": {
"_default_": {
"_source": { "compress": "true" },
}
}
}'
@fatbox
fatbox / djangomodule.py
Created January 28, 2012 14:22
Load Django modules from within a Salt module
"""
This allows you to import Django modules into a Salt module
"""
import logging
import sys
import os
log = logging.getLogger(__name__)
@rduplain
rduplain / gist:6886040
Created October 8, 2013 14:55
Cronic - A cure for Cron's chronic email problem - by Chuck Houpt - http://habilis.net/cronic/
#!/bin/bash
# Cronic v2 - cron job report wrapper
# Copyright 2007 Chuck Houpt. No rights reserved, whatsoever.
# Public Domain CC0: http://creativecommons.org/publicdomain/zero/1.0/
set -eu
OUT=/tmp/cronic.out.$$
ERR=/tmp/cronic.err.$$
@zircote
zircote / AuroraStuff.md
Last active August 22, 2016 17:11
My early gotchas with Apache Aurora

The mustache gotcha

When using “bound” objects in an .aurora file it is an absolute that you do not have spaces in the “mustaches”.

Examples:

  • Bad: {{ profile.my_var }}
  • Good: {{profile.my_var}}

Docker Container Snafus

When running a docker container, you must ensure that all of the dependent library for the thermos_executor.pex are present in the docker container itself. The thermos_executor runs in the container not the mesos slaves environment.

@commandodev
commandodev / req_req.py
Created June 26, 2012 10:04
Handling REQ/REP syncronization in eventlet
from eventlet.pools import Pool
from eventlet.timeout import Timeout
class SocketPool(Pool):
"""A pool of sockets connected to a component
If a socket times out in use, simply close if before handing it back to the
pool and it will be discarded and a replacement inserted into the pool."""
def __init__(self, address, **kwargs):
@rduplain
rduplain / README.md
Created August 30, 2012 16:07
Flask-Script: demo passing in configuration file.

This demonstrates that you can configure a Flask application through Flask-Script, without having to create a Flask instance or deal with circular dependencies. Note that Flask-Script's Manager accepts a factory function in place of a Flask app object.

Running:

python manage.py runserver

gives "Hello, world!" on http://localhost:5000/, while running:

python manage.py runserver -c development.cfg
@jordansissel
jordansissel / RESULTS.md
Created September 21, 2012 07:41
screenshot + code showing how to query logstash/elasticsearch with a graphite function.

logstash queries graphed with graphite.

Operation: Decouple whisper from graphite.

Method: Create a graphite function that does a date histogram facet query against elasticsearch for a given query string for the time period viewed in the current graph.

Reason: graphite has some awesome math functions. Wouldn't it be cool if we could use those on logstash results?

The screenshot below is using logstash to watch the twitter stream of keywords "iphone" "apple" and "samsung" - then I graph them each, so we get an idea of popularity. As a bonus, I also do a movingAverage() on the iphone curve to show you why this is awesome.

#!/bin/bash
PUBLIC_INTERFACE=eth0
# This assumes symmetric connection - for asymmetric connections need some more params
TOTAL_BANDWIDTH=1000mbit
# The following params would guarantee staked validaotrs 300 mbps undisturbed and
# limit other traffic to 500 mbps.