Skip to content

Instantly share code, notes, and snippets.

View zenlor's full-sized avatar
⚖️
balancing terrain generation

Lorenzo Giuliani zenlor

⚖️
balancing terrain generation
View GitHub Profile
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@jeffrafter
jeffrafter / server.js
Created August 28, 2010 21:37
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@octplane
octplane / mongo_pubsub.rb
Created November 9, 2010 16:17
Simple Pub/Sub system using MongoDB, capped collections and tailable cursors in ruby
require 'rubygems'
require 'mongo'
module MongoPubSub
QUEUES_COLLECTION = 'queues'
class EndSubscriptionException < Exception; end
class Publisher
def initialize(queue_name, mongo_connection)
# Initialize queue collection as a capped collection
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name)
@samsonjs
samsonjs / sync.js
Created January 18, 2011 04:00
poor man's bi-directional sync
#!/usr/bin/env node
// Sync two dirs giving precedence to the machine with the most recently modified files.
// After the first sync we sync again with the opposite precedence to make sure files
// deleted on either machine stay gone.
//
// The (primary) problem with this approach is that the newest changes always win. If
// you edit a file on both machines the latest changes will be the *only* remaining
// changes. Be careful if you actually use this!
@bert
bert / README
Created February 3, 2011 06:29
Embedding applications via XEmbed
From: gtk-list-bounces@gnome.org [mailto:gtk-list-bounces@gnome.org] On Behalf Of Andy Spencer
Sent: Friday, January 21, 2011 5:24 AM
To: Michael Treibton
Cc: gtk-list@gnome.org
Subject: Re: Embedding applications via XEmbed
On 2011-01-20 20:52, Michael Treibton wrote:
> I've read about GtkSocket and GtkPlug, but the examples for the
> official documentation don't make it clear to me how to go about this.
>
@tobsn
tobsn / log.js
Created May 3, 2011 12:09
node.js pipe for lighttpd logs to mongodb
#!/usr/local/bin/node
var fs = require('fs'),
useragent = require('/www/utils/node_modules/useragent'),
zoneinfo = require('/www/utils/node_modules/zoneinfo'),
TZDate = zoneinfo.TZDate,
countrycodes = require('/www/utils/node_modules/zoneinfo/lib/countrycodes');
mongo = require('/www/utils/node_modules/mongoq'),
db = mongo('mongodb:\/\/localhost/logs'),
access = db.collection( 'access' );
@nyuichi
nyuichi / 90-min-scc.scm
Created July 31, 2011 10:36
The 90 Minute Scheme to C Compiler
#!/usr/local/Gambit-C/bin/gsi
; Copyright (C) 2004 by Marc Feeley, All Rights Reserved.
; This is the "90 minute Scheme to C compiler" presented at the
; Montreal Scheme/Lisp User Group on October 20, 2004.
; Usage with Gambit-C 4.0:
;
; % ./90-min-scc.scm test.scm
@mheadd
mheadd / config.js
Created August 17, 2011 15:44
Node Knockout Demo Application
/**
* Enter your configuration details in this file.
*/
// Details of your CouchDB instance.
exports.couchdb = {
userid : '',
password : '',
host : 'http://127.0.0.1',
port : '5984',
@senko
senko / onchange.sh
Last active July 14, 2023 07:54
OnChange - Watch current directory and execute a command if anything in it changes
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@thingsinjars
thingsinjars / LICENSE.txt
Created December 12, 2011 09:39 — forked from 140bytes/LICENSE.txt
Chainable DOM Manipulation
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Simon Madine <http://thingsinjars.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE