I hereby claim:
- I am johngraber on github.
- I am jgraber (https://keybase.io/jgraber) on keybase.
- I have a public key whose fingerprint is F3EF D90C BA2C 6FC0 8C77 113B 3C70 C1E0 F10A F344
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/python | |
# This script will rename in lower case every file and directory found in the | |
# current directory and below. | |
import os | |
for root, dirs, files in os.walk('.'): | |
for filename in files: | |
old_name = os.path.join(root, filename) |
specChars () { | |
tr [:blank:] [_] | tr [/] [_] | tr -d [=~=][=!=][=@=][=#=][=$=][=%=][='('=][=')'=][=\'=][=,=][=.=][=:=][=';'=][=\\=] | |
} | |
IFS=$'\n' | |
files=$(ls -1) | |
for file in $files ; do |
#! /bin/bash | |
# changeCase: a hack written to convert files from NDS upgrade CD to lowercase file names | |
# author: John Hamilton, john.hamilton@wiscdrapery.com | |
# date: 22-APR-02 | |
# | |
# usage: This script assumes you have: | |
# *) copied all of the contents of the CD to your hard drive | |
# *) full read, write, execute permissions to the copied directories | |
# *) no hidden files ("dot" files) in or below your current directory |
# requires mp3info be installed on system | |
specChars () { | |
tr [:blank:] [_] | tr [/] [_] | tr -d [=~=][=!=][=@=][=#=][=$=][=%=][='('=][=')'=][=\'=][=,=][=.=][=:=][=';'=][=\\=] | |
} | |
#check with user to see if the filenames look good | |
mp3info -p "File: %f\nTitle: %t\nArtist: %a\nAlbum: %l\nYear: %y\nGenre: %g\n" *.mp3 | |
echo -n 'File names will be:' \n |
#!/bin/bash | |
# a very basic script for logical backup of multiple databases in a postgres cluster | |
# get a list of database names, not including the default databases | |
DB_LIST=$(psql -qAt -c "SELECT datname FROM pg_database WHERE datname <> ALL ( ARRAY [ 'postgres' ::NAME, 'template0' ::NAME, 'template1' ::NAME, 'edb' ::NAME ] )") | |
# define and create location for backups | |
BASE_DIR="/path_to/backups/logical" | |
YMD=$(date "+%Y-%m-%d") |
#!/bin/bash | |
# a very basic phyisical backup script, this will also | |
# clean up archived WAL that is no longer needed | |
# define and create location for backups | |
BASE_DIR="/path_to/backups/physical" | |
ARCHIVED_WAL_DIR=/path_to/archived_xlogs | |
YMD=$(date "+%Y-%m-%d") | |
DIR="$BASE_DIR/$YMD" |
def trinum(n): | |
# calculates the "triangular number" of a number | |
# https://www.mathsisfun.com/algebra/triangular-numbers.html | |
return n*(n+1)/2 |
def wma(values, window): | |
# requires trinum.py | |
# using definition provided at | |
# http://www.oanda.com/forex-trading/learn/forex-indicators/weighted-moving-average | |
# create an array of weights | |
# use floats when creating array, or the result is integer division below | |
# and, note that they are reversed. why? read this: |
def hma(values, window): | |
# requires wma.py | |
# HMA = WMA(2*WMA(PRICE, N/2) - WMA(PRICE, N), SQRT(N)) | |
period = int(np.sqrt(window)) | |
# created wma array with NaN values for indexes < window value | |
# hull_moving_averages = np.empty(window) |