This is a collection of short Python scripts I have added to my
PATH variable to run from anywhere.
None are currently available in pip,
but I will add them if enough people are interested.
To add these to your PATH, clone the repo and add the following
to your bashrc or zshrc, replacing <python-scripts>
with the location of the cloned repository.
Furthermore, see my dotfiles repo for my
complete Mac and Linux system configurations.
# Add additional directories to the path.
pathadd() {
[ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]] && PATH="${PATH:+"$PATH:"}$1"
}
pathadd <python-scripts>/python2.7
pathadd <python-scripts>/python3This script organizes my music collection for iTunes
and mpv using tag information.
The directory structure is <artist>/<track>, where <artist> and <track>
are lower case strings separated by dashes.
See the blog post for a more detailed overview.
A module to evaluate a mathematical expression using Python's AST.
Tests are located in EvalExprTest.py.
See the blog post for a more detailed overview.
$ EvalExpr.py '(((4+6)*10)<<2)'
(((4+6)*10)<<2) = 400
Builds upon linkchecker to hide warnings and to send a concise email if bad links are found. See the blog post for a more detailed overview.
Scraping HTML tables with HTMLParser.
Tests are located in ScrapeCountriesTest.py.
See the blog post for a more detailed overview.
$ ScrapeCountries.py 'http://www.nationsonline.org/oneworld/countries_of_the_world.htm' countries.tsv
Parsing countries of the world.
Using 5 columns overall and extracting columns (1, 2, 3, 4).
Finished extracting. Data written to 'countries.tsv'
$ head -n 1 countries.tsv
Afghanistan Afghanistan Afghanestan South-Central Asia
Obtain the NATO phonetic alphabet representation from short phrases.
$ phonetic.py github
g - golf
i - india
t - tango
h - hotel
u - uniform
b - bravo
