Install from the AUR.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILES=`find -iname *.txt -print` | |
for FILE in $FILES | |
do | |
# replace the + to # chars | |
sed -i -r 's/^([+]{4})\s/#### /' $FILE | |
sed -i -r 's/^([+]{3})\s/### /' $FILE | |
sed -i -r 's/^([+]{2})\s/## /' $FILE | |
sed -i -r 's/^([+]{1})\s/# /' $FILE | |
sed -i -r 's/(\[php\])/<?php/' $FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# code from http://danieljlewis.org/files/2010/06/Jenks.pdf | |
# described at http://danieljlewis.org/2010/06/07/jenks-natural-breaks-algorithm-in-python/ | |
def getJenksBreaks( dataList, numClass ): | |
dataList.sort() | |
mat1 = [] | |
for i in range(0,len(dataList)+1): | |
temp = [] | |
for j in range(0,numClass+1): | |
temp.append(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import redis | |
import random | |
import pylibmc | |
import sys | |
r = redis.Redis(host = 'localhost', port = 6389) | |
mc = pylibmc.Client(['localhost:11222']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
dot directive (require graphviz) | |
""" | |
from docutils import nodes | |
from docutils.parsers.rst import directives, Directive | |
import subprocess as sp | |
nthUnnamed = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Starts a multiplexed terminal session with tmux running monitoring software. | |
# Requires dstat, htop and grc. The apache configuration for grc can be found | |
# here: https://gist.github.com/1885569 | |
# | |
# My .tmux.conf is here instead: https://gist.github.com/1886016#file_3_tmux.conf | |
# | |
# tmux 1.7 or later recommended. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host vagrant | |
HostName localhost | |
User vagrant | |
Port 2210 | |
UserKnownHostsFile /dev/null | |
StrictHostKeyChecking no | |
IdentityFile /Users/pblittle/.rvm/gems/ruby-1.9.2-p290@wilbur/gems/vagrant-0.9.7/keys/vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Solarized Dark | |
For use with Jekyll and Pygments | |
http://ethanschoonover.com/solarized | |
SOLARIZED HEX ROLE | |
--------- -------- ------------------------------------------ | |
base03 #002b36 background | |
base01 #586e75 comments / secondary content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "sqlite3" | |
hamster = SQLite3::Database.new ".local/share/hamster-applet/hamster.db" | |
timetrap = SQLite3::Database.new ".timetrap.db" | |
unparsed = hamster.execute("select * from facts inner join activities on activities.id = facts.activity_id inner join categories on categories.id = activities.category_id") | |
entries = unparsed.map do |e| | |
timetrap.execute("insert into entries (note, start, end, sheet) values (?, ?, ?, ?)", | |
"#{e[6]} #{e[4]}", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
from pysal.esda.mapclassify import Natural_Breaks as nb | |
df = pd.DataFrame({'density': np.random.randint(0, 10, 500)}) | |
# replace zero values with NaN | |
df.replace(to_replace={'density': {0: np.nan}}, inplace=True) | |
breaks = nb(df[df['density'].notnull()].density.values, k=5) | |
# this index will allow us to perform the join correctly |
OlderNewer