Skip to content

Instantly share code, notes, and snippets.

View jl's full-sized avatar

Joey Liaw jl

  • San Francisco, California
View GitHub Profile
@jl
jl / gitgui.md
Last active August 28, 2018 00:40
git user interface productivity

gitk: visualize branches

gitk is useful for visualizing the history as a series of branching vertical lines, one commit per horizontal line:

# see history up to where I am
gitk

# see history on some other branch
gitk origin/master
@jl
jl / HIMSS-2017.md
Created February 22, 2017 17:29
HIMSS Cloud Computing Forum Medicaid 2.0 Follow-up

On 2017-02-19 I had the honor of co-presenting with Jess Kahn at the HIMSS Cloud Computing Forum. We presented some slides about the learnings of building the next-generation Medicaid data warehouse on Amazon Web Services. I am not a Federal employee; I work at Nuna, subcontracted to QSSI to do this work.

Following are some quick thoughts and notes expanding on the presentation in

@jl
jl / pkg-config-mac.md
Created February 20, 2016 05:40
Installing pkg-config from source on OS X
@jl
jl / tupletricks.py
Last active October 10, 2015 20:34
Neat things you can do with namedtuples
import collections
Thing = collections.namedtuple('Thing', 'x y z a b c')
def get_by_id(db, thing_id):
columns = ','.join(Thing._fields) # "x,y,z,a,b,c"
qry = 'SELECT {} FROM things WHERE id=?'.format(columns)
row = db.execute(qry, (thing_id,)).fetchone()
return Thing(*row) # construct by expanding arguments
@jl
jl / named.md
Last active October 10, 2015 20:19
Python 3 named parameters

Let's say you want to write a comparator function that takes two objects.

def is_newer(older, newer):
    return older.timestamp < newer.timestamp

def keep_newer(file1, file2):
    if is_newer(file1, file2):
        os.unlink(file1)
 else:
@jl
jl / chrome-profile-ux-fail.md
Last active August 29, 2015 14:15
restore user profile icons in Chrome

The new user profile menu in Chrome is terrible. Instead of easily-distinguishable icons, you now get a generic gray text button of the first name of your account, which is usually the same between work and personal accounts. The whole point is to easily see which profile you're currently using, and this isn't possible with the new UI. UX FAIL!

You need to cut and paste this link into Chrome.

  • chrome://flags/#enable-new-avatar-menu
    • DISABLE IT
@jl
jl / diffexit.py
Created December 12, 2014 01:22
python subprocess stdout iteration
"""diff output of multiple processes and exit as soon as one line is different
Note: we have to take care to not trigger any of Python's internal buffering mechanisms.
"""
import itertools
import subprocess
import sys
LINE_BUFFERED = 1
@jl
jl / proggymacvim.md
Last active August 29, 2015 14:06
ProggyFont on MacVim

ProggyFont on MacVim

Text looks beautiful on MacBook Retina displays. You can use pretty much any monospace font, anti-aliased, and it will be quite readable for coding on your laptop's screen at 220 ppi. However, if you attach something with less than half that density, for example, the 93 ppi Dell U2414H (23.8" diagonal 1920 x 1200) then you get mushy fonts again.

Below are instructions for installing a pixel-perfect bitmap font which will give you back crisp text on both the external and internal Retina display and greatly reduce eye strain.

Download and install ProggyFont TrueType Font.

" add to ~/.vim/gvimrc
@jl
jl / vagrant-centos7-base.md
Last active April 22, 2019 03:22
How to setup a CentOS 7 vagrant base box

Mac OS X

  • install virtualbox
  • install vagrant
  • download CentOS 7 minimal ISO
  • create a new virtualbox instance "centos7base"
    • 512 mb ram
    • VDI, dynamically allocated, 8 gb
    • disable USB and audio controllers
  • insert the centos 7 iso into the virtual drive
@jl
jl / macvim-git-merge.md
Last active October 1, 2023 03:46
Use MacVim to resolve git merge conflicts

When you install MacVim, you have the option of installing command line integration. This basically puts an mvim shell script somewhere in your path, usually /usr/local/bin/mvim. Git has a list of mergetools that it knows about; gvimdiff is in the list, which expects gvim to be in the path.

First, figure out where your mvim script lives, then add a gvim link.

$ which mvim
/usr/local/bin/mvim
$ cd /usr/local/bin
$ ln -s mvim gvim
$ ls -l gvim