Skip to content

Instantly share code, notes, and snippets.

View davewongillies's full-sized avatar

Dave Wongillies davewongillies

View GitHub Profile
@ahx
ahx / app.rb
Created January 5, 2009 07:08
An example for an OpenID consumer using Sinatra
# An example for an OpenID consumer using Sinatra
require 'rubygems'
require 'sinatra'
gem 'ruby-openid', '>=2.1.2'
require 'openid'
require 'openid/store/filesystem'
helpers do
def openid_consumer
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 30, 2024 12:48
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@mleinart
mleinart / graphTemplates.conf
Created September 22, 2011 17:25
Solarized graph template for Graphite
[solarized-dark]
background = #002b36
foreground = #839496
majorLine = #fdf6e3
minorLine = #eee8d5
lineColors = #268bd2,#859900,#dc322f,#d33682,#db4b16,#b58900,#2aa198,#6c71c4
fontName = Sans
fontSize = 10
fontBold = False
fontItalic = False
@acdha
acdha / carbon-cache.conf
Last active March 20, 2022 02:02
Upstart config for Graphite's carbon-cache daemon
#!/etc/init/carbon-cache.conf
description "Carbon server"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
umask 022
expect fork
respawn
@chrishamant
chrishamant / s3_multipart_upload.py
Created January 3, 2012 19:29
Example of Parallelized Multipart upload using boto
#!/usr/bin/env python
"""Split large file into multiple pieces for upload to S3.
S3 only supports 5Gb files for uploading directly, so for larger CloudBioLinux
box images we need to use boto's multipart file support.
This parallelizes the task over available cores using multiprocessing.
Usage:
s3_multipart_upload.py <file_to_transfer> <bucket_name> [<s3_key_name>]
@jbraeuer
jbraeuer / check_aws_status.rb
Created January 25, 2012 08:24
A Nagios/Icinga plugin to check AWS Service Health Dashboard (using Ruby+Nokogiri)
#! /usr/bin/ruby
#
# A script to check Amazon Webservice's Health Status Dashboard
#
# Jens Braeuer, github.com/jbraeuer
#
# Version 1.0
#
@miketheman
miketheman / example.rb
Created January 27, 2012 18:52
ruby - moved grep from string method to enumerable
ruby-1.8.7-p352 $ irb
1.8.7 :001 > thing = 'sometext'
=> "sometext"
1.8.7 :002 > thing.grep(/some/)
=> ["sometext"]
ruby-1.9.2-p290 $ irb
1.9.2p290 :001 > thing = 'sometext'
=> "sometext"
1.9.2p290 :002 > thing.grep(/some/)
@shawn-sterling
shawn-sterling / graphite
Created February 14, 2012 21:30 — forked from drawks/graphite
Graphite on uwsgi/nginx
#This is the "site config" for nginx
upstream django {
# Distribute requests to servers based on client IP. This keeps load
# balancing fair but consistent per-client. In this instance we're
# only using one uWGSI worker anyway.
ip_hash;
server unix:/tmp/uwsgi.sock;
}
server {
@tareqabedrabbo
tareqabedrabbo / rabbit.js
Created February 20, 2012 17:35
Connects to RabbitMQ's log exchange and logs all received messages to the console
var connection = require('amqp').createConnection({host: 'localhost'});
connection.on('ready', function() {
// create a temporary queue by passing an empty string as the queue name
var queue = connection.queue('', function(queue) {
console.log('connected to ' + queue.name);
// bind the queue to all messages on the amq.rabbitmq.log topic exchange
queue.bind('amq.rabbitmq.log', '#');
@chooper
chooper / statsd_instrument.py
Created March 11, 2012 22:04
Decorator to quickly add statsd (graphite) instrumentation to Celery task functions.
"""Decorator to quickly add statsd (graphite) instrumentation to Celery
task functions.
With some slight modification, this could be used to instrument just
about any (non-celery) function and be made abstract enough to customize
metric names, etc.
Stats reported include number of times the task was accepted by a worker
(`started`), the number of successes, and the number of times the task
raised an exception. In addition, it also reports how long the task took