Skip to content

Jynx1/python-scripts-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>/python3

Python 2.7

music-organizer.py

This 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.

Python 3

EvalExpr.py

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

link-checker.py

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.

Link checker screenshot

ScrapeCountries.py

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

phonetic.py

Obtain the NATO phonetic alphabet representation from short phrases.

$ phonetic.py github
g - golf
i - india
t - tango
h - hotel
u - uniform
b - bravo

About

Short and fun Python scripts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 98.0%
  • Shell 2.0%