Skip to content

Instantly share code, notes, and snippets.

# Fish prompt to show username, host, CWD, Python VirtualEnv, VCS (git, svn, hg) info.
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
if not set -q __fish_git_prompt_show_informative_status
set -g __fish_git_prompt_show_informative_status 1
if not set -q __fish_git_prompt_hide_untrackedfiles
set -g __fish_git_prompt_hide_untrackedfiles 1

Keybase proof

I hereby claim:

  • I am pchng on github.
  • I am pchng ( on keybase.
  • I have a public key whose fingerprint is F722 6230 DB84 09B3 FFB2 737B B1EB 75BC 98B5 23A8

To claim this, I am signing this object:

pchng /
Created Mar 9, 2015
CBC Radio 2 broadcast log history download Python script
#!/usr/bin/env python
# Python 2.7.x
import argparse
import csv
import datetime
import sys
from collections import defaultdict
# Requires requests and beautifulsoup4: pip install beautifulsoup4 requests
import requests
pchng / Simple Java 8 Stream API performance test
Last active Aug 29, 2015
Simple Java 8 Stream API performance test
View Simple Java 8 Stream API performance test
// Test whether Stream API operations are efficiently re-ordered.
// LOGGER is instance of org.slf4j.Logger
public void testStreamApiOrdering() {
final Random rnd = new Random();
final int nItems = 10_000;
final List<Integer> values = new ArrayList<>(nItems);
for (int i = 0; i < nItems; ++i) {
values.add(rnd.nextInt(1000)); // Values between 0 and 999, inclusive.
pchng / js_single_threadedness.html
Last active Aug 29, 2015
Demonstration of JavaScript single-threadedness
View js_single_threadedness.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>Test of JavaScript single-threadedness</title>
<h1>Test of JavaScript single-threadedness</h1>
<button id="check">Check</button>
<script src=""></script>