Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nikhilm
nikhilm / index.html
Created May 19, 2015 20:02
fetch crash
// Does not handle fetch event.
# The language list was generated using the following lines of Python
from pygments.lexers import get_all_lexers
import json
xs = [ (x[0], i) for i, x, _, _ in get_all_lexers() ]
xs.sort()
f = open('file', 'w')
json.dump(xs, f)
We couldn’t find that file to show.
@nikhilm
nikhilm / suncirc.cfdg
Created November 22, 2010 13:30
Draws a 'sun', coloured blue using ContextFreeArt
startshape sun
rule sun {
sq { }
36* { r 10 } sq { }
}
rule sq {
CIRCLE { hue 200 saturation 150 }
sq { x 1 y 1 s 0.8 brightness 0.3 }
# Simple script which runs code when a file is modified
#
# You will have to install pyinotify
#
# Run with the directory to watch
# eg. python autobuild.py ./
# currently hardcoded to use
#
# (c) 2009, Nikhil Marathe <nsm.nikhil@gmail.com>
# Licensed under the MIT License
var http = require('http');
http.createServer(function (req, res) {
var result = req.url.match(/^\/user\/([a-z]+)$/);
if( result ) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('<html><head><title>Greeting App</title></head><body><h1>Hello '+ result[1] + '!</h1></body></html>');
}
else {
res.writeHead(403);
res.end("You aren't allowed here!");
@nikhilm
nikhilm / 1
Created February 22, 2011 20:40
initial cmake support for HUpnp
#toplevel in herqq/
project(HUpnp)
set(HUpnp_MAJOR_VERSION 0)
set(HUpnp_MINOR_VERSION 9)
set(HUpnp_PATCH_VERSION 0)
find_package(Qt4 COMPONENTS QtCore QtXml QtNetwork REQUIRED)
add_subdirectory(hupnp)
@nikhilm
nikhilm / gist:2145665
Created March 21, 2012 08:49
why java feels enterprisey!
Overcomplicated shit:
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=com.mycompany.app \
-DartifactId=my-app
@nikhilm
nikhilm / AllColumnsIterator.java
Created April 1, 2012 03:30
Apache Cassandra: Iterate over all columns of a row in batches of count rows.
// Made by Nikhil Marathe <nsm.nikhil@gmail.com>
// This code is in the public domain.
import java.util.Iterator;
import java.util.List;
import me.prettyprint.hector.api.beans.ColumnSlice;
import me.prettyprint.hector.api.beans.HColumn;
import me.prettyprint.hector.api.exceptions.HectorException;
@nikhilm
nikhilm / apprenticeship.md
Created August 24, 2012 10:46
Paraphrased from "Why nerds are unpopular" by Paul Graham - http://www.paulgraham.com/nerds.html

I'm suspicious of this theory that thirteen-year-old kids are intrinsically messed up. If it's physiological, it should be universal. Are Mongol nomads all nihilists at thirteen? I've read a lot of history, and I have not seen a single reference to this supposedly universal fact before the twentieth century. Teenage apprentices in the Renaissance seem to have been cheerful and eager. They got in fights and played tricks on one another of course (Michelangelo had his nose broken by a bully), but they weren't crazy.

As far as I can tell, the concept of the hormone-crazed teenager is coeval with suburbia. I don't think this is a coincidence. I think teenagers are driven crazy by the life they're made to lead. Teenage apprentices in the Renaissance were working dogs. Teenagers now are neurotic lapdogs. Their craziness is the craziness of the idle everywhere.

When I was in school, suicide was a constant topic among the smarter kids. No one I knew did it, but several planned to, and some may have tried. Mostly