Skip to content

Instantly share code, notes, and snippets.

View bkw's full-sized avatar

Bernhard Weisshuhn (a.k.a. bernhorst) bkw

View GitHub Profile
@tlhunter
tlhunter / health.js
Created October 24, 2012 18:32
/HEALTH
app.get('/health', function(req, res){
res.send({
pid: process.pid,
memory: process.memoryUsage(),
uptime: process.uptime(),
connections: server.connections
});
});
@pfig
pfig / mkfavicon.sh
Created February 12, 2012 12:01
Make a multi-resolution favicon.ico from a source image, using ImageMagick
#!/bin/bash
# from
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png
convert favicon-256.png -resize 16x16 favicon-16.png
convert favicon-256.png -resize 32x32 favicon-32.png
convert favicon-256.png -resize 64x64 favicon-64.png
convert favicon-256.png -resize 128x128 favicon-128.png
@persand
persand / gist:1355589
Created November 10, 2011 18:01
Bash script for github.com/x URL:s -> git.io
function shit() {
if [ -n "$2" ]; then
curl -i http://git.io -F url=https://github.com/"$1" -F code="$2";
else
curl -i http://git.io -F url=https://github.com/"$1";
fi
}
/*
A simple new-line delimited JSON protocol with upgrades.
Receiving Usage:
protocol = require('./frame-protocol');
// parsing data
parser = protocol.Parser();
@fdmanana
fdmanana / gist:832610
Created February 17, 2011 20:27
The CouchDB replicator database

1. Introduction to the replicator database

A database where you PUT/POST documents to trigger replications and you DELETE to cancel ongoing replications. These documents have exactly the same content as the JSON objects we used to POST to /_replicate/ (fields "source", "target", "create_target", "continuous", "doc_ids", "filter", "query_params".

Replication documents can have a user defined "_id". Design documents (and _local documents) added to the replicator database are ignored.

The default name of this database is _replicator. The name can be changed in the .ini configuration, section [replicator], parameter db.

2. Basics

@oremj
oremj / amo_rabbit_prod_report.php
Created July 19, 2010 21:55
Rabbit ganglia metrics
<?php
/* Pass in by reference! */
function graph_amo_rabbit_prod_report ( &$rrdtool_graph ) {
global $context,
$hostname,
$mem_shared_color,
$mem_cached_color,
$mem_buffered_color,
@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",