Skip to content

Instantly share code, notes, and snippets.

View briancline's full-sized avatar

Brian Cline briancline

  • SoftLayer / IBM Cloud
  • Dallas, Texas
View GitHub Profile
!function() {
var doc = document,
htm = doc.documentElement,
lct = null, // last click target
nearest = function(elm, tag) {
while (elm && elm.nodeName != tag) {
elm = elm.parentNode;
}
return elm;
};
@edwardgeorge
edwardgeorge / jack.rb
Created November 8, 2010 12:59
Homebrew formula to install JackOSX binary package.
require 'formula'
class Jack <Formula
homepage 'http://jackaudio.org'
version '0.87'
if MACOS_VERSION < 10.6
url 'http://downloads.sourceforge.net/project/jackosx/JackOSX/0.87/JackOSX.0.87_32bits.zip'
md5 '431b35cab4b3928e66e8accb2a1dee80'
else
url 'http://downloads.sourceforge.net/project/jackosx/JackOSX/0.87/JackOSX.0.87_64-32bits.zip'
# This is a nginx config snippet showing how to inherit an http header
# or defaulting it to a specific value. This is useful because it allows
# upstream load balancers to set specific headers, but if they're missing
# the app LB will know how to default it.
# This will inherit the previously set X-Scheme variable, or otherwise
# default it to the current `$scheme`. Requires nginx 0.9.0+.
#
# Docs: http://wiki.nginx.org/HttpMapModule#map
map $http_x_scheme $x_scheme {
@teh
teh / shutdown_example.py
Created August 4, 2011 21:13
Proper shut down in-flight requests for eventlet's wsgi server
import daemon, lockfile, signal, logging
import eventlet
from eventlet import wsgi, timeout
worker_pool = eventlet.GreenPool(20)
sock = eventlet.listen(('', 8000))
def proper_shutdown():
worker_pool.resize(0)
@mitchellh
mitchellh / gist:1171262
Created August 25, 2011 17:44
They see me wiresharkin'... they hatin'...
#!/usr/bin/env python
"""
This Python scripts listens for all HTTP requests to the
Turntable CDNs and downloads the file requested into the
current directory.
Disclaimer: This is a proof of concept. The author of this
script is not responsible for how this is used.
"""
@mitchellh
mitchellh / gist:1277049
Created October 11, 2011 01:30
Configure Vagrant VM to use Host DNS for VPN
Vagrant::Config.run do |config|
# ...
config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
@mlavin
mlavin / fabfile.py
Created January 11, 2012 16:44
Fabric Package Install
import ConfigParser
import os
from fabric.api import env, sudo
from fabric.contrib import files
SERVER_ROLES = ['dbmaster', 'app', 'lb', ]
env.roledefs = dict.fromkeys(SERVER_ROLES, [])
# Directory structure
@scotttam
scotttam / apns.py
Created January 30, 2012 21:21
Sends an Apple Push Notification with Python
import socket, ssl, json, struct
import binascii
# device token returned when the iPhone application
# registers to receive alerts
deviceToken = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
thePayLoad = {
'aps': {
'alert':'Oh no! Server\'s Down!',
@rafl
rafl / elasticsearch_cache
Created March 22, 2012 16:32
Munin ElasticSearch plugins
#!/usr/bin/env perl
# Parameters supported:
#
# config
# autoconf
#
# Magic markers:
#%# family=auto
#%# capabilities=autoconf
@misaelnieto
misaelnieto / live-mjpeg-stream.py
Last active April 25, 2024 03:22
Streaming MJPEG over HTTP with gstreamr and python - WSGI version
#!/usr/bin/python
#based on the ideas from http://synack.me/blog/implementing-http-live-streaming
# Updates:
# - 2024-04-24: Apply suggestions from @Pin80
# Run this script and then launch the following pipeline:
# gst-launch videotestsrc pattern=ball ! video/x-raw-rgb, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! tcpclientsink port=9999
#updated command line
#gst-launch-1.0 videotestsrc pattern=ball ! videoconvert ! video/x-raw, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! #tcpclientsink port=9999
from multiprocessing import Queue