Skip to content

Instantly share code, notes, and snippets.

@nandhp
nandhp / robin-cascade.pl
Last active April 8, 2016 01:25
Compute estimated merge times for Robin chatrooms (robin-estmerge: Estimated merge times in 80 lines; robin-cascade: human-readable output and other computations)
#!/usr/bin/perl
use JSON;
use warnings;
use strict;
my $EST_TIERS = 0; # Estimate tiers of existing chats
my $T1_INTERVAL = -1;#9; # In seconds (8000->6000 in 5-9PM => 9 sec)
my @duration = (0, 1, 3, 7, 15, 31);
sub duration {
@nandhp
nandhp / sdl_colors.c
Created July 10, 2012 23:33
Test program for emscripten bug with SDL_MapRGB
#include <SDL/SDL.h>
#ifdef EMSCRIPTEN
#include <emscripten.h>
// Implementation of SDL_MapRGB and SDL_MapRGBA that isn't totally broken:
// #define SDL_MapRGB(fmt,r,g,b) (0xff+((b)<<8)+((g)<<16)+((r)<<24))
// #define SDL_MapRGBA(fmt,r,g,b,a) ((a)+((b)<<8)+((g)<<16)+((r)<<24))
#endif
void one() {
@nandhp
nandhp / .lessfilter
Created September 22, 2011 21:31
lesspipe + source-highlight integration
#!/bin/sh
#
# .lessfilter - Custom rules for lesspipe
#
# GNU source-highlight
SRC=/usr/bin/source-highlight
SRCOPTS="-f esc --style-file=esc.style -i"
# Directory listings