Some basic command line tools, mostly in Python 3, which automate tasks I frequently find myself performing. This includes downloading audio from YouTube, editing and merging PDFs, and more. As the need arises, I will certainly expand this collection.
Scripts range from highly specific in utility (such as distribute.py
) to fairly broad (such as
pdftools.py
). Certain script functionality is little but a wrapper for a pre-existing command
line utility like qpdf
or sox
; in such cases, the script is designed to simplify the syntax
and make the use of these tools more convenient and intuitive for whatever highly-specific
application I require.
distribute.py
- made for Toyota Yarris sound-system; arranges mp3 files alphabetically into directories of 255 each, and compares the files with those in~/Music
download-music.py
- downloads mp3 audio from a list of YouTube (or other) URLs, removing leading and trailing silenceergo.py
- made to assist with card game, Ergo; outputs a list of atomic proposition which are (dis)proven by a given list of premises (propositional logic sentences)shortcut.py
- creates cross-platform, browser independent internet shortcut for a URL, based on a .html file, with options to retrieve URL from clipboard, and to use (sanitised) webpage title for shortcut namepdftools.py
- extract, interleave or rotate pages of PDFs, or find and replace text in a PDFpwned.py
- query HaveIBeenPwned API to check whether a given password has been leaked in a data breach
Each script begins with an appropriate shebang, allowing it to be executed directly, for instance
with ./scriptname.py
in place of python3 scriptname.py
.
For maximum convenience, it is recommended to place the desired scripts in a folder linked by the
$PATH
environment variable. That is, if the scripts are in ~/scripts
, then the following line
may be added to the shell's RC file, to allow scripts to be executed by name from a terminal open
in any directory:
export PATH=$PATH:~/scripts
Each script in general takes positional command line arguments, as well as optional arguments and
flags. Argument parsing is done in Python using the argparse
module, and all arguments are
thoroughly documented. To view detailed help, simply execute a script with the -h
or --help
flag.
download-music.py
requires command line tools SoX and youtube-dlpdftools.py
requires command line tool QPDF
distribute.py
is not very robust. Manually rearranging the files in each of the generated folders can break the alphabetical ordering.
Pull requests are welcome - in fact, encouraged.