Skip to content

khaeru/py

Repository files navigation

khaeru: Python miscellany

image

Everything that doesn't fit somewhere else.

© 2010–2023 Paul Natsuo Kishimoto <mail@paul.kishimoto.name>.

Licensed under the GNU General Public License, version 3.0 or later.

Install

From source:

$ git clone git@github.com:khaeru/py.git $HOME/vc/khaeru
$ cd $HOME/vc/khaeru
$ pip install --editable .

From PyPI:

$ pip install khaeru

The only direct requirement is click. For some of the submodules, below, there are additional requirements; find and install these with:

$ khaeru deps NAME

# Example: pipe to pip directly
$ khaeru deps git-all | xargs pip install

Contents

Python submodules

khaeru.biogeme

khaeru.pelican_ipython

Render IPython snippets in Pelican pages, with the help of the Sphinx extension IPython.sphinxext. See e.g. https://paul.kishimoto.name/2021/01/handling-country-codes/

khaeru.task

Code for working with Taskwarrior.

.notify

See task-notify, below.

.slack

Compute “slack”: amount of work time before given deadlines, after accounting for planned work.

Python submodules with CLI

In addition to khaeru, the following commands are installed. Most use click, so have their own --help.

apt-or-pip

Suggest whether to install Python packages using apt, or pip.

bib

Command-line utility for BibTeX databases; moved to https://github.com/khaeru/bib.

ceic

Process data exported from the CEIC database.

dedupe

git-all

Locate and describe directories under $HOME which are git-controlled and have uncommitted changes. Use git auto-dispatch: git all.

pim

Various tools for personal information management, as a click application. See pim --help.

rclone-push

Upload files using rclone and a file .rclone-push.yaml in the current directory.

task-notify

Similar to https://github.com/flickerfly/taskwarrior-notifications, but in Python, and also reports active time from Taskwarrior.

strip-replies

A script for use with the Claws Mail Python plugin to tidy reply messages by removing signatures and blocks of blank lines.

Executable Python submodules

Invoke these directly with python -m khaeru.NAME:

khaeru.disqus-export

khaeru.imgdupe

Find image files in a set of directories with matching names and appearance, but possibly different EXIF metadata or size.

khaeru.kdx

Manage Kindle DX collections according to directory structure.

khaeru.maildupe

Choose duplicate files to save/remove from a Maildir mailbox, for clumsy users of OfflineIMAP.

khaeru.reas_hdf5

Convert the Regional Emissions inventory in ASia (REAS) v2.1 into a HDF5 file. Broken.

khaeru/script/: Shell scripts

Invoke these using khaeru run NAME [ARGS], or directly.

Most of these use a #!/bin/sh line, meaning that, on Ubuntu, they run under dash, not bash. Read more: 1, 2.

biogeme, biosim

Wrappers for Biogeme.

gpg-edit

Like sudoedit, but for GPG-encrypted files.

gpg-sqlite

Like gpg-edit, but for SQLite databases.

install-gams-api

Install the GAMS APIs.

install-latexmk

Install the latest version of Latexmk from CTAN.

mailman-scrape

new-machine

Configure a new Ubuntu machine.

packages

Generate lists of apt and pip packages.

ssh-try HOST1 HOST2

SSH to the first host that connects successfully.

task-dedupe

Snippets to assist with removing duplicate tasks in Taskwarrior.

toggle-md0

In Ubuntu 15.10, gnome-disk-utility removed md RAID support; use this with a .desktop file to have a GUI way of starting/stopping an array.

xps13

Tweaks for Ubuntu on an old (~2012) Dell XPS 13. Most of these are no longer needed.

gk-query, gk-query.py

Query the GNOME Keyring for passphrases associated with a particular search string, from the command-line. Works headlessly (i.e. without an active GNOME session).

svante_jupyter_job, svante_jupyter_setup, svante_jupyter_tunnel

Run a Jupyter kernel gateway using Slurm on the MIT svante cluster.

khaeru/old/: Old scripts

Some of these still work, but no guarantees. No entry point is provided for these; invoke them directly.

dreamhost-dns.py

Dynamic DNS cron script for DreamHost.

gedit-rubber

LaTeX compile script using rubber, for the gedit plugin 'External Tools'.

h5enum.py

Use xarray instead.

lp986841

https://bugs.launchpad.net/ubuntu/+source/acroread/+bug/986841/comments/21.

moin-migrate

Merge MoinMoin data from multiple installations.

mount.sh, umount.sh

n-way.bzr, n-way.py, n-way.unison

N-way diff.

nm-state

Retcode 0 or 1 according to whether nm-tool says there is a connection active.

pythons.sh

rb-alarm.sh

Play Rhythmbox from a cron script.

reflib-check, reflib-scavenge

For Referencer .reflib databases.

rise-and-shine, rise-and-shine.py, rise-and-shine.ui

Alarm clock using Music Player Daemon (MPD).

synergy, synergy-jp, synergy-kd

Extreme laziness using Synergy.

tomboy2zim

Convert Tomboy XML notes to Zim markup.