Skip to content

Instantly share code, notes, and snippets.

@juil
juil / gist:1680141
Created January 26, 2012 01:02 — forked from fennb/gist:1283573
nginx microcaching config example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
@juil
juil / gist:1679989
Created January 26, 2012 00:26 — forked from fennb/gist:1124535
node.js proxy server in 20 lines of JS (via http://www.catonmat.net/http-proxy-in-nodejs/)
var http = require('http');
http.createServer(function(request, response) {
var proxy = http.createClient(80, request.headers['host'])
var proxy_request = proxy.request(request.method, request.url, request.headers);
proxy_request.addListener('response', function (proxy_response) {
proxy_response.addListener('data', function(chunk) {
response.write(chunk, 'binary');
});
proxy_response.addListener('end', function() {
@juil
juil / onchange.sh
Created August 19, 2011 17:43 — forked from senko/onchange.sh
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
@juil
juil / about.md
Created August 9, 2011 16:46 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@juil
juil / README.md
Created July 5, 2011 14:01 — forked from rgabo/README.md
CoffeeScript / Node.js - ticksort

Node.js ticksort in CoffeeScript!

Beating your sleepsort by magnitudes! Takes only SUM(argv) ticks and does not overflow the stack either. Fork the gist if you can reduce the size of ticksort.coffee.