Skip to content

Instantly share code, notes, and snippets.


Benjamin E. Coe bcoe

View GitHub Profile
nebrius /
Last active Apr 5, 2022
Instructions for configuring TypeScript for Node.js

This gist will walk you through configuring your Node.js Project so that you can write your code in TypeScript using Visual Studio Code. These isntructions were written for attendees at Microsoft Build doing a super secret thing I can't talk about (ooo, the suspense!), but they also will work for any Node.js project written in TypeScript.

Before we get started configuring TypeScript, we need to initialize a new Node.js project. If you have not already installed Node.js, please head over to and install the latest LTS version of Node.js. Once this is done, create a folder for your Node.js project and open a terminal in this folder. In the terminal, run the command:

npm init

This command will ask you a series of questions. You can use the defaults for each question here because they don't really matter. These only matter if you intend to publish your module to [](htt

jkrems /
Last active Nov 16, 2022
History of ES modules
bcoe /
Last active Dec 2, 2022

npm Users By Downloads (

npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.

Metrics are calculated using top-npm-users.

# User Downloads
beaugunderson /
Last active Aug 29, 2016
cool modules from nodeconf

from streams session

  • end-of-stream - specify a callback to be called when a stream ends (which is surpsingly hard to get right)
  • duplexify - compose a Duplex stream from a Readable and a Writable stream
  • pump - pipe streams together and close all of them if one of them closes
  • pumpify - combine an array of streams into a single duplex stream using pump and duplexify
  • through2 - tools for making Transform streams
  • from2 - tools for making Readable streams

from "participatory modules" session

View gist:926587b40c07cb32e9fa
From 6765c58a27f9a9ef4a7820e10259e464d9fbbb33 Mon Sep 17 00:00:00 2001
From: isaacs <>
Date: Mon, 2 Mar 2015 16:03:34 -0800
Subject: [PATCH] http: do not reuse socket on error responses
Some servers (in this case, CouchDB) behave very oddly when you attempt
to re-use a socket that returned an error response.
lib/_http_client.js | 4 ++++
1 file changed, 4 insertions(+)
View Makefile
# Hello, and welcome to makefile basics.
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
# Once you're done here, go to
# to learn SOOOO much more.
jeremyj / watch haproxy sticky tables
Created Oct 16, 2014
watch haproxy sticky tables
View watch haproxy sticky tables
watch -n 1 'echo "show table http" | socat unix:/var/run/haproxy.sock -'
watch -n 1 'echo "show table public" | socat unix:/var/run/haproxy.sock -'
mathisonian /
Last active Nov 26, 2022
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5


ceejbot /
Last active Nov 15, 2022
monitoring manifesto

monitoring: what I want

I've recently shifted from a straight engineering job to a job with a "dev/ops" title. What I have discovered in operations land depresses me. The shoemaker's children are going unshod. Operations software is terrible.

What's driving me craziest right now is my monitoring system.

what I have right now

What I have right now is Nagios.

View gist:6b1bcaf7724dfc2a54f3
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans