Skip to content

Instantly share code, notes, and snippets.

@TaurusOlson
TaurusOlson / projections.json
Last active August 17, 2016 14:17
A .projections.json file adapted to Django applications
{
"../*.py": {
"type": "my_project"
},
"../my_project/settings.py": {
"type": "settings"
},
"templates/my_app/*.html": {
"type": "templates",
"alternate": "views.py"
@TaurusOlson
TaurusOlson / venv_temp.sh
Last active June 30, 2016 06:00
A bash sript creating a temporary Python virtual environment with optional packages.
#! /bin/bash
function usage() {
cat <<EOF
Create a temporary Python virtual environment with optional packages.
Usage:
$(basename $0) [package1 package2...]
@TaurusOlson
TaurusOlson / resize_img.sh
Created March 11, 2016 11:50
Create one or many new resized image files
#!/bin/bash
function usage() {
cat<<EOF
$(basename $0) - Create one or many new resized image files
Usage:
$(basename $0) <size> <imgfile1> [imgfile2 imgfile3 ...]
@TaurusOlson
TaurusOlson / upgrade_postgresql.md
Last active February 7, 2016 12:58
Upgrade PostgreSQL on Mac OS X

Upgrade PostgreSQL

This document briefly describes how to upgrade PostgreSQL from 9.4.5 to 9.5 and assumes the installation was done with Homebrew. Upgrades between other versions should be similar.

(original source: http://stackoverflow.com/a/27624397/63347)

Stop the server

@TaurusOlson
TaurusOlson / iris.html
Created September 19, 2015 20:09
Plot of the iris dataset using d3.js
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<style type="text/css" media="screen">
circle {
{
"Total": 972,
"JavaScript": 324,
"Ruby": 188,
"Python": 88,
"PHP": 65,
"C": 53,
"Objective-C": 51,
"Java": 45,
"Shell": 31,
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@TaurusOlson
TaurusOlson / Makefile
Last active August 29, 2015 14:14
Makefile for Latex
all: myfile.pdf
TMP=$(wildcard *.mtc* *.maf *.log *.aux *.out)
%.pdf: %.tex
@xelatex $<
clean:
@rm -fv $(TMP)
.PHONY: clean
# Passes https://gist.github.com/mrocklin/5722155
def groupby(f, coll):
""" Group elements in collection by ``f`` """
d = dict()
for item in coll:
key = f(item)
if key not in d:
d[key] = []
d[key].append(item)
@TaurusOlson
TaurusOlson / minimal_statusline.vim
Created February 19, 2014 12:22
A minimal statusline for Vim
hi default link User1 Error
set statusline =
set statusline +=[%n] " buffer number
set statusline +=\ %F " Full path to file
set statusline +=\ %1*%m%0* " modified flag
set statusline +=\ %=%-20.30{tagbar#currenttag('%s','')} " Current function
set statusline +=\ %h " [help]
set statusline +=%r " read only flag
set statusline +=%w " preview window flag
set statusline +=%=%-14.(%l,%c%V%) " Line, column-virtual column"