Skip to content

Instantly share code, notes, and snippets.

View scottrogowski's full-sized avatar

Scott Rogowski scottrogowski

View GitHub Profile
@scottrogowski
scottrogowski / branch.py
Created March 26, 2015 15:44
Better git branch
#!/usr/bin/env python
# This is a better way to do git branch. This orders branches by last modified
# date and prints the branch notes along with the branch.
# Branches with '+' and '_' in front come first
import subprocess
import sys
from dateutil.parser import parse
import os
@scottrogowski
scottrogowski / one_line_spiral.py
Last active August 29, 2015 14:15
Single expression one line python spiral
# This prints a spiral onto the terminal.
# It is composed of a few list comprehensions, a few ternary expressions, and a y-combinator
# The only python keywords used: print, join, in, lambda, if, else, int, and, or, range
# No libraries are used
# It is 308 characters although I think it would be possible to get it under 300
# with some further optimization of the spiral generator. Particularly I think
# it might be possible to build this without storing state recursively at the
# expense of some additional computation. This could be done by finding an
# expression that would map the element index of the spiral to the coordinates