Skip to content

Instantly share code, notes, and snippets.

View fish_prompt.fish
# 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
end
if not set -q __fish_git_prompt_hide_untrackedfiles
set -g __fish_git_prompt_hide_untrackedfiles 1
end
View keybase.md

Keybase proof

I hereby claim:

  • I am pchng on github.
  • I am pchng (https://keybase.io/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
pchng / cbc_radio_broadcast_logs.py
Created Mar 9, 2015
CBC Radio 2 broadcast log history download Python script
View cbc_radio_broadcast_logs.py
#!/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
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
@Test
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
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">
<head>
<meta charset="utf-8">
<title>Test of JavaScript single-threadedness</title>
</head>
<body>
<h1>Test of JavaScript single-threadedness</h1>
<button id="check">Check</button>
<script src="https://code.jquery.com/jquery-2.1.0.min.js"></script>