Skip to content

Instantly share code, notes, and snippets.


Aseem Kishore aseemk

View GitHub Profile
aseemk /
Last active Dec 16, 2019
Bookmarklet template!

TODO: Add description of your bookmarklet here.

To add this bookmarklet to your browser, instructions for Chrome:

  1. Right-click your Bookmarks Bar.
  2. Click "Add Page..."
  3. For "Name", type "TODO: Title here".
  4. For "URL", copy-paste the below:
aseemk / i18n._coffee
Last active Jan 28, 2019
Node.js script to extract i18n strings from source code.
View i18n._coffee
#!/usr/bin/env _coffee
# Helper script to search all of our files for i18n strings and update our
# strings file. Helpful in case we missed a code path during testing.
# Specifically, searches for gettext `__()` calls in our checked-in files.
$ = require 'underscore'
echo = console.log
aseemk /
Last active Feb 14, 2018
A bookmarklet for "selecting all" (technically, "toggling all") checkboxes on the Amazon AWS S3 console.
aseemk / randomStr.js
Created Jul 12, 2012
Random alphanumeric (base-62) strings in Node.js, cryptographically strong
View randomStr.js
var bases = require('bases');
var crypto = require('crypto');
// Returns a base-62 (alphanumeric only) string of the given length:
function randomStr(length) {
// We generate a random number in a space at least as big as 62^length,
// and if it's too big, we just retry. This is still statistically O(1)
// since repeated probabilities less than one converge to zero. Hat-tip to
// a Google interview for teaching me this technique! ;)
aseemk / app.js
Created Jan 9, 2013
Node.js cluster support on Heroku — freaking sweet!
View app.js
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
var pid =;
var port = process.env['PORT'] || 8000;
if (cluster.isMaster) {
console.log('Master:', pid);
// Fork workers -- one less than the number of CPUs.
aseemk /
Last active Dec 2, 2017
CoffeeScript upcoming changes.

CoffeeScript 1.7 is shaping up to be a pretty kick-ass release with significant improvements. Here are the ones I'm most excited about, in order of my own excitement.

Parentheses-free chaining

Years of being wished for, finally granted!

aseemk /
Last active Nov 15, 2017
Trello bookmarklet to (re-)calculate sums of "points" from cards.

Trello bookmarklet to (re-)calculate sums of "points" from cards.

"Points" can be anything numeric (no units). Just prefix each card you want to count with the points in parentheses. E.g. (3) Investigate options.

It's okay for cards to not have points. They just won't be included in the sums.

The sum of points for each list will get added to the list title in the same way as cards. E.g. (17) To Do. Any existing sum will get updated.

The list's actual title (e.g. if you refresh) will not be updated; only the "display" title at that moment will be.

aseemk / package.json
Last active Aug 21, 2017
FiftyThree Mix (AKA Paper Public Stream) archiver/scraper script
View package.json
"name": "mix-archiver",
"version": "1.0.0",
"description": "Scrape and archive a FiftyThree Mix (Paper Public Stream) profile.",
"bin": "scrape.js",
"author": "Aseem Kishore <>",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"superagent": "^3.6.0"
aseemk / 500.html
Created Jan 9, 2013
Thingdom's error and maintenance pages for Heroku. (Built with Jekyll and served by GitHub Pages.)
View 500.html
title: 500 Internal Server Error
<h1>500 Internal Server Error</h1>
Sorry, something’s gone wrong on our end.
We apologize for the inconvenience.
aseemk / typescript-static-and-runtime-typing.ts
Last active Nov 13, 2016
An example of how to use TypeScript's impressive type inference with both generics and function overloads to achieve robust static typing with runtime type knowledge too! Playground:
View typescript-static-and-runtime-typing.ts
type StaticValueType = string | number | boolean;
type StringValueType = 'string' | 'number' | 'boolean';
function parse(val: string): 'string';
function parse(val: number): 'number';
function parse(val: boolean): 'boolean';
function parse<T extends StringValueType>(val: null, valType: T): T;
function parse(val: StaticValueType | null, valType?: StringValueType): StringValueType {
if (val == null) {
if (valType == null) {