Skip to content

Instantly share code, notes, and snippets.

View austinogilvie's full-sized avatar

austin austinogilvie

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@austinogilvie
austinogilvie / txt2snake
Created November 5, 2013 01:05
convert a string to snake_case
#!/bin/bash
word=$1
word=${word// /_}
word=`echo "$word" | tr '[:upper:]' '[:lower:]'`
echo $word;
#!/bin/bash
COUNTER=1
for line in $(cat list_of_extreme_sports.txt); do
url=$(echo "$line" | cut -d'|' -s -f2) # split on pipe sep and take 2nd col
if [ ! -z "$url" -a "$url" != " " ]; then # ensure not empty string.
if [[ "$url" == http* ]]; then # check that it starts with http
OUTFILE="outfile_${COUNTER}"
~/Workspace/Repositories/opensource/table2csv/table2csv/table2csv $url --save $OUTFILE
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from ggplot import meat
def lowess(x, y, f=2/3., iter=3):
n = len(x)
r = int(np.ceil(f * n))
h = [np.sort(abs(x - x[i]))[r] for i in range(n)]
w = np.clip(abs(([x] - np.transpose([x])) / h), 0.0, 1.0)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from ggplot import meat
from statsmodels.nonparametric.smoothers_lowess import lowess
df = meat[['beef','veal']]
df = df.sort_index(by=['beef'])
x = meat.beef.values
y = meat.veal.values
@austinogilvie
austinogilvie / README.md
Last active December 27, 2015 05:09
Tab trigger for importing scientific libraries in a python file using Sublime Text 2.

Save this thing in your

~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User

folder.

Oh, and drop the .xml file extension at the end.

@austinogilvie
austinogilvie / Linear_Regression_With_Loess.ipynb
Created October 30, 2013 19:30
Fit a loess curve with Python. Posted to bitbucket by Jure Zbontar - http://bit.ly/1aIyNaH.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@austinogilvie
austinogilvie / Default (OSX).sublime-keymap.json
Created October 20, 2013 16:18
Keyboard shortcut for inserting a proper equals operator "<-" for R using Sublime Text 2.
[
{
"keys": ["alt+minus"],
"command": "insert",
"args":
{
"characters": " <- "
},
"context": [
{
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.