Skip to content

Instantly share code, notes, and snippets.

View adamrights's full-sized avatar

Adam Bedell adamrights

View GitHub Profile
@RichardBronosky
RichardBronosky / cmg_medley_tv_lsn-after.xml
Created April 3, 2012 17:34
Akamai config for TV LSN, before addition of targetUrl magic.
<?xml version="1.0" encoding="UTF-8"?>
<configs xsi:noNamespaceSchemaLocation="../schemas/metadata.xsd" xmlns:cache="uri:akamai.com/metadata/cache/5.0" xmlns:edgeservices="uri:akamai.com/metadata/edgeservices/5.0" xmlns:xalan="http://xml.apache.org/xslt" xmlns:config="uri:akamai.com/metadata/config/5.0" xmlns:network="uri:akamai.com/metadata/network/5.0" xmlns:auth="uri:akamai.com/metadata/auth/5.0" xmlns:match="uri:akamai.com/metadata/match/5.0" xmlns:forward="uri:akamai.com/metadata/forward/5.0" xmlns:comment="uri:akamai.com/metadata/comment/5.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:akamai="uri:akamai.com/metadata/akamai/5.0" xmlns:security="uri:akamai.com/metadata/security/5.0" xmlns:reporting="uri:akamai.com/metadata/reporting/5.0" xmlns:edgecomputing="uri:akamai.com/metadata/edgecomputing/5.0" xmlns:assign="uri:akamai.com/metadata/assign/5.0">
<akamai:edge-config version="5.0">
<comment:advanced_defaults.begin/>
<comment:advanced_defaults.end/>
<comment:quickstart_sec

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@nulltask
nulltask / app.js
Created February 21, 2012 17:32
Node.js network balanced cluster with Socket.IO
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, cluster = require('cluster');
var app = module.exports = express.createServer()
, io = require('./socket')(app);
@saetia
saetia / gist:1623487
Last active April 20, 2025 23:05
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@geddski
geddski / nesting.js
Created January 14, 2012 05:08
helper function for nesting backbone collections.
function nestCollection(model, attributeName, nestedCollection) {
//setup nested references
for (var i = 0; i < nestedCollection.length; i++) {
model.attributes[attributeName][i] = nestedCollection.at(i).attributes;
}
//create empty arrays if none
nestedCollection.bind('add', function (initiative) {
if (!model.get(attributeName)) {
model.attributes[attributeName] = [];
@netroy
netroy / 000-server.js
Created November 5, 2011 11:30
Using cluster to scale existing Express/Connect apps
var cluster = require('cluster'),
app = require('./app');
var workers = {},
count = require('os').cpus().length;
function spawn(){
var worker = cluster.fork();
workers[worker.pid] = worker;
return worker;
@robflaherty
robflaherty / csv-to-json.php
Created September 1, 2011 02:26
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@justinabrahms
justinabrahms / colortest.py
Created June 26, 2011 17:10 — forked from graven/colortest.py
Small utility to test terminal support for 256-color output.
#!/usr/bin/env python
# Ported to Python from http://www.vim.org/scripts/script.php?script_id=1349
print "Color indexes should be drawn in bold text of the same color."
print
colored = [0] + [0x5f + 40 * n for n in range(0, 5)]
colored_palette = [
"%02x/%02x/%02x" % (r, g, b)
for r in colored
@sspencer
sspencer / transparent-gif.js
Created October 31, 2010 22:27
Serve a transparent GIF from NodeJS
// Two ways to serve transparent GIF
var buf = new Buffer([
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00,
0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02,
0x02, 0x44, 0x01, 0x00, 0x3b]);
res.send(buf, { 'Content-Type': 'image/gif' }, 200);
/*
* Mclarens Bar: Redis based Instant Messaging
* Nikhil Marathe - 22/04/2010
* A simple example of an IM client implemented using
* Redis PUB/SUB commands so that all the communication
* is offloaded to Redis, and the node.js code only
* handles command interpretation,presentation and subscribing.
*
* Requires redis-node-client and a recent version of Redis