Skip to content

Instantly share code, notes, and snippets.


Colin Ihrig cjihrig

View GitHub Profile
cjihrig /
Created Dec 31, 2019
On Using `assert` as Your Assertion Library

This gist is a more detailed followup to this tweet in which I advocate for using Node's assert module as your goto assertion library.

Not Hatin', Just Sayin' Disclaimer: There are plenty of perfectly good JavaScript assertion libraries out there. If you're happy with your current choice in assertion libraries, please continue using them. This gist is just my personal opinion. It does not represent the opinion of my employer, your employer, or anyone else.


cjihrig / wasi.c
Last active Mar 21, 2020
WASI C Header
View wasi.c
#include "uvwasi.h"
__wasi_errno_t __wasi_args_get(char** argv, char* argv_buf) {
return __WASI_ENOTSUP;
__wasi_errno_t __wasi_args_sizes_get(size_t* argc, size_t* argv_buf_size) {
return __WASI_ENOTSUP;
cjihrig / README libvirt cloud-init with static
Created Feb 14, 2019 — forked from itzg/README libvirt cloud-init with static
Configuring a libvirt domain with a static IP address via cloud-init local datasource
View README libvirt cloud-init with static

Here is how to create a cloud-init disk image and OS disk image suitable for configuring into a libvirt domain file.

In my case I am naming my domain (a.k.a. virtual machine or VM) xenial with a static IP address of The filenames "network-config" and "user-data" files are arbitrary, so they can be named with a prefix for the domain, etc.

First, get the cloud image and convert into QCOW2 format:

qemu-img convert -O qcow2 xenial-server-cloudimg-amd64-disk1.img xenial-server-cloudimg-amd64-disk1.qcow2

Challenges in using post-mortem debugging with async/await


async/await is a new feature of the EcmaScript programming language that combines generators and promises to improve the language-level model for writing asynchronous code.

It is [currently in "stage 3"]( proposals) of the TC39 process,

cjihrig /
Created Nov 11, 2016 — forked from renchap/
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {

Keybase proof

I hereby claim:

  • I am cjihrig on github.
  • I am cjihrig ( on keybase.
  • I have a public key whose fingerprint is 94AE 3667 5C46 4D64 BAFA 68DD 7434 390B DBE9 B9C5

To claim this, I am signing this object:



Clone and build Node for analysis:

$ git clone
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1"
$ ./configure
$ make -j4

Installing V8 on a Mac


  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)

Build V8

  • git clone

MDB is unlike most debuggers you've experienced.

It is not a source level debugger like gdb or lldb or even Node's builtin debugger

Generally used for postmortem analysis.

Postmortem is for Production and Development

We operate mostly on core files, though you can attach to running processes as well.