A collection of useful scripts that don't fit anywhere else
Python Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
jsjupiter Collapse hemisphere controls to fit on one line Apr 6, 2017
kobo Convert scripts to be compatible with Python 3. Jan 16, 2017
mailtests Test files for testing viewmailattachments, viewhtmlmail Sep 18, 2015
mapping Notes on useful URLs May 2, 2017
motioncam Make ME007 rangefinder dependency optional Mar 16, 2018
oppretro oppretro_astropy: add a superfine mode to get a better estimate of op… Jul 29, 2018
puzzles A couple of trivial scripts to solve CarTalk puzzlers Oct 8, 2016
pycamera Update to more recent versions of picamera. Dec 11, 2017
rpi Specify inches in main Jan 5, 2018
test cachefile: a bunch of hacks to make it work under Python2 as well as … Aug 15, 2018
weather Wunderwx: Read key from a file or env variable. Jul 18, 2018
.gitignore Ignore directories named data, for testing data analysis scripts Feb 6, 2017
COPYING Add GPLv2 COPYING file Jun 25, 2013
README New cachefile class, for caching data fetched from a web API (or othe… Aug 13, 2018
analemma.py analemma: Use PyEphem's expanded city list. Add some better error han… Apr 27, 2018
androidfiles.py androidfiles: Workarounds to trick argparse into allowing varying num… May 3, 2018
animate.js Simple Javascript image animations Sep 29, 2015
aptver Convert scripts to be compatible with Python 3. Jan 16, 2017
balanceparens.py Convert scripts to be compatible with Python 3. Jan 16, 2017
bdump Convert scripts to be compatible with Python 3. Jan 16, 2017
birdcodes-usgs.py New set of bird codes, from a different source. Sep 11, 2015
birdcodes.py Add an entry for rock pigeon, which, unbelievably, isn't in either of… May 21, 2018
cachefile.py cachefile: a bunch of hacks to make it work under Python2 as well as … Aug 15, 2018
calendarparse.py Convert scripts to be compatible with Python 3. Jan 16, 2017
cellaut.py Merge branch 'master' of github.com:akkana/scripts May 1, 2013
chatsounds.py Make chatsounds compatible with python3 Sep 2, 2017
check-monitors check-monitors: parse the monitor name from the xrandr output, since … Mar 10, 2018
cleanhtml.py cleanhtml: use commandline arguments May 17, 2018
colormatch.php Use rgb.txt in the current directory if it exists, Feb 28, 2017
conjunctions.py Add an sql output format. Use ISO for times in the database, Feb 2, 2017
countsyl Convert to python 2/3; print ranges more nicely Jan 16, 2017
courseratext Be smarter about adding paragraph breaks: Jul 16, 2013
decodemail.py -a (all instances of these headers) was broken: Jun 26, 2017
delaytest.cgi Convert scripts to be compatible with Python 3. Jan 16, 2017
diff2rss Diff two files and output RSS of the differences. A possible solution… Sep 21, 2015
diffiles.py Find files that differ between two directories -- Mar 22, 2013
domaincheck.py Show registrar for each domain Jun 14, 2017
eggtimer Update eggtimer for python3 compatibility (Tkinter changes to tkinter) Aug 5, 2018
epubtag.py epubtag: allow specifying a book's title in the constructor Aug 12, 2018
falls_between.py Convert scripts to be compatible with Python 3. Jan 16, 2017
fincompare.py fincompare: Update data fetching to use the pandas data fetcher for t… Jan 17, 2018
fixbookcover Convert scripts to be compatible with Python 3. Jan 16, 2017
fontasia Store categories in ~/.config/fontasia/fontasia.conf instead of .font… Jan 2, 2017
fotogr Minor clarification in the Usage statement for fotogr Jul 22, 2018
gimageview.py Somewhat minimal (but still hugeexample of a gtk image viewer Apr 19, 2014
gitbranchsync.py gitbranchsync: Make prints compatible with python3 Apr 1, 2018
gphoto.py Convert scripts to be compatible with Python 3. Jan 16, 2017
gpreso Rename preso to gpreso and add a new qpreso based on QWebEngine, Jan 6, 2018
gquickbrowse Rename quickbrowsegwk to gquickbrowse for better quickbrowse autocomp… Apr 27, 2018
htmlmail.py htmlmail: strip cc and bcc list after splitting, to allow for spaces … Aug 13, 2018
imageviewer.py Add transimageviewer.py, derived from imageviewer.py, Apr 2, 2017
imageviewer3.py imageviewer3: xid no longer works, and it was just a debug print anyway Dec 16, 2017
ipscan Simple network scanner, shorter code than the python ipsearch script Jun 18, 2017
ipsearch Merge branch 'master' of https://github.com/akkana/scripts Jun 22, 2018
keyreader.py Update keyreader.py to python3 Jun 23, 2018
kitfox-patch kitfox-patch: use realpath to handle relative paths Aug 9, 2018
langgrep langgrep: add some more decodes/encodes to make python happy Mar 10, 2018
linkedinify Fix broken LinkedIn URLs Sep 10, 2014
louder Convert scripts to be compatible with Python 3. Jan 16, 2017
mac_lookup.py Add mac_lookup, for mapping MAC addresses to manufacturers Nov 19, 2017
masq Switch to using 192.168.2 for compatibility with the PiDoorbell tutorial Apr 8, 2014
moonpos Convert scripts to be compatible with Python 3. Jan 16, 2017
mouseevent.py Read mouse events, even if not in X. Linux only. Dec 2, 2013
mpcdemo.py Add a simple multiprocess communication demo Nov 22, 2017
musicplayer.py Add musicplayer requirements in the comments at the top Sep 2, 2017
noblank Disable screen blanking Jun 24, 2014
nonblock-py3.py Update termsize to work with Python3 as well as Python2, and add an e… Nov 26, 2017
noteplayer.py noteplayer: Cache waves after the first time they're generated, to sp… Feb 5, 2018
pathmatch Convert scripts to be compatible with Python 3. Jan 16, 2017
play_chord.py play_chord: make init() callable by other programs, plus some minor r… Jan 28, 2018
podcopy Convert scripts to be compatible with Python 3. Jan 16, 2017
prettysoup.py New module, prettysoup, for HTML prettyprinting Jul 15, 2018
pyclip Use Qt5 if GTK isn't available May 25, 2017
pykey.py pykey: Handle control, alt and meta modifiers. Some refactoring to ma… Apr 2, 2018
pyplay.py Convert scripts to be compatible with Python 3. Jan 16, 2017
pyruler Add a collection of old scripts I hadn't gotten around to adding Dec 30, 2012
pysync Convert scripts to be compatible with Python 3. Jan 16, 2017
python-cheatsheet.py Python cheatsheet: note about how to have newlines in descriptions Aug 8, 2018
qhtmlprint Reorder some lines and add an attempt to crop now that QPrinter no lo… Jan 17, 2016
qpdfview.py Make loading from local files asynchronous just like URLs, to ensure … Jun 2, 2018
qpreso qpreso: run fullscreen if on XGA or smaller display Mar 8, 2018
qslide2pdf Add -1024|1366 argument Jun 6, 2017
quickbrowse.py quickbrowse: clearer load failed error showing the URL that failed Jul 26, 2018
randombg Convert scripts to be compatible with Python 3. Jan 16, 2017
randomline Convert scripts to be compatible with Python 3. Jan 16, 2017
readkey.py Read input without waiting for newlines Dec 30, 2012
repo-pullpush Rename repo-pullpush and add a README entry for it Apr 5, 2016
scrubjay-p-t Add a comment on where to find the docs Jun 16, 2017
scrubjay-tweepy Split scrubjay into two apps using different Twitter APIs: Jun 16, 2017
serio Braindead simple serial communication program in Python May 20, 2013
shorturl Don't need urlparse any more Jun 5, 2015
shorturl-gi3 Port shorturl to py3/gtk3/GI, as an example of how to Jan 17, 2017
sieve.py whitespace only Jun 25, 2018
sinkto Add a de-personalized version of the sinkto script Jul 26, 2015
sonogram.py Convert scripts to be compatible with Python 3. Jan 16, 2017
speedtestserver Convert scripts to be compatible with Python 3. Jan 16, 2017
tee.py Tee needs to check for version info before checking unicode Jul 29, 2017
termcolors Convert scripts to be compatible with Python 3. Jan 16, 2017
termsize Don't specify python version in the termsize shebang line Nov 26, 2017
tklabelimage.py Add an example of how to show text and labels in TkInter Jul 7, 2018
transimageviewer.py Remove nonworking cairo bitmap code, pare down to simple example. I'l… Apr 6, 2017
turtlefrac.py Add quit on q key Nov 5, 2016
tweet Convert scripts to be compatible with Python 3. Jan 16, 2017
urldownloader.py Add a separator between filename and cgi args Feb 3, 2016
vcalparse Convert scripts to be compatible with Python 3. Jan 16, 2017
viewhtmlmail viewhtmlmail: Add a comment apologizing for the html regex Apr 11, 2018
viewmailattachments In quickbrowse, use qpdfview, if available, for PDF. Apr 27, 2018
vol Convert scripts to be compatible with Python 3. Jan 16, 2017
waymaker Remove an unused dependency Feb 16, 2018
weborphans Add some common filenames that aren't really orphans Jun 5, 2015
wikitable.py Remove my test URL May 14, 2016
word2html New module, prettysoup, for HTML prettyprinting Jul 15, 2018
wordview Convert scripts to be compatible with Python 3. Jan 16, 2017
xbright Convert scripts to be compatible with Python 3. Jan 16, 2017
xlsrd xlrd now barfs if you don't decode the cell values specifying an enco… May 29, 2017

README

A collection of useful scripts and snippets, in various languges.

----------------
Subdirectories:
----------------

jsjupiter:
    My Jupiter's Moons Javascript web app: show the Galilean moons and
    their shadows, and predict transits, shadow transits and eclipses.

kobo:
    Module of utilities useful with Kobo ebook readers.

mapping:
    Scripts related to mapping / GIS.

mapping/election2016:
    Map blue-red-purple US presidential election results by county.

mailtests:
    Messages with attachments for testing viewmailattachments.

motioncam:
    An automated motion-sensitive camera driver, for Raspberry Pi or
    other machines. Requires pycamera module.

pycamera:
    A wrapper that can drive a Pi camera module, a USB webcam or an
    external gphoto2-compatible camera using similar APIs.

rpi:
    Scripts for the Raspberry Pi. Mostly wrappers to talk to sensors.

weather:
    Some attempts at accessing various weather APIs and plotting
    statistics.

--------------------------
Scripts in this directory:
--------------------------

analemma.py:
    Plot the analemma from the selected location, using PyEphem and PyGTK.

androidfiles.py:
    A Python module to make it easier to list files on an
    Android device using adb, and copy individual files to the device.
    Can also synchronize two directories, trying to notice when files
    need to be moved rather than removed and recopied.
    Used by podcopy.

animate.js:
    Simple code for animating a series of images in javascript.

aptver:
    Search for Debian packages, installed or uninstalled, matching
    a pattern, and print out versions and descriptions.

balanceparens.py:
    A very simple parenthesis (and brace and bracket) counter.
    Why isn't there a better one already on Linux?

birdcodes.py:
    Give common name for those obscure 4-letter bird codes.

bdump:
    Ascii/hex/decimal dumps of any file. Like od but much more readable.

cachefile.py:
    A general class for cases where you need to fetch data from some
    slow process, like a web API, and cache it locally for speedier access.
    Caches in CSV format.

cellaut.py:
    Simple cellular automata simulation in Python. Slow.

chatsounds.py:
    An xchat Python script to handle nick (and other special-case) sounds.
    Also a rare example of an xchat Python script.

check-monitors
    A trivial shell script to probe for connected monitors and
    use xrandr to activate the right one.

cleanhtml.py
    Clean up HTML edited by gmail users -- remove font/color/style tags
    and such. Then prettyprint (somewhat -- add newlines, at least).
    Minimal, but serves as an example for how to clean up HTML:
    every source may have different types of clutter, so you may need
    to customize for whatever source you're trying to clean up.

colormatch.php:
    Find the nearest matching color name. http://shallowsky.com/colormatch/

conjunctions.py:
    Predict planetary visibility and conjunctions for a specified
    date range.

countsyl:
    Count likely syllables in words, giving best guess and likely max.

decodemail.py:
    Decode email lines encoded in RFC 2047 format, printing only lines
    that match a specific header (Subject:, From:, etc.).

delaytest.cgi:
    A CGI script in Python that spits out some text slowly, with delays.
    Use it on your webserver (or localhost) to test things like parallel
    downloads to make sure they work with slow servers.

domaincheck.py:
    Check for expiring domains, using python-whois.

diff2rss:
    Diff two files and output RSS of the differences.
    A possible (though poor) solution for web pages that don't offer RSS feeds.

diffiles.py:
    Find files that differ between two directories -- even if
    they've been moved to different places in the directory structure.

docx2html, doc2html have been replaced by word2html.

eggtimer:
    Pop up a reminder window in a specified number of minutes.

epubtag.py:
    Display author, title and tag information for ebooks in epub format;
    or add or modify an ebook's topic tags, title or cover.
    Can be imported as a module (there are examples in the kobo/ directory
    and in fixbookcover).

falls_between.py:
    given a day of the week ("tue") or a day of the month (15),
    did it occur between two given dates?

fincompare.py:
    Download financial data from Yahoo finance and plot lots of
    different funds on the same scale.
    Can also take data from a local spreadsheet or other source.

fixbookcover:
    Fix books whose cover doesn't include the title, like many
    Project Gutenberg books.

fontasia:
    A Linux font chooser and categorizer.
    Also works as a GIMP plug-in font chooser.

fotogr:
    Find tagged photos: search for strings in files named Keyword or Tags
    beneath the current directory.

gitbranchsync.py:
    Display git branches and what they're tracking,
    check whether a repository needs pushing upstream,
    and optionally make local branches track remotes of the same name.
    A solution to the problem of git making it idiotically difficult
    to keep several machines in sync with the branches in a git repository.

gpreso:
    A lightweight presentation program for displaying HTML slides.
    Python2/GTK/webkit version. (Previously called preso.)

gquickbrowse:
    Minimal browser: an older version of quickbrowse written in
    python2-webkit-GTK, now orphaned and no longer available on newer
    releases. If you don't pass an argument but there's anything in
    the X selection when you run it, it will browse to that URL first.

htmlmail.py:
    Compose and send HTML mail, including image attachments.

imageviewer.py:
    A generic image viewer widget and image viewer window that can
    be imported into other python programs.

imageviewer3.py:
    A generic image viewer widget and image viewer window using GTK3
    via gi, so they can be used with Python 3.

ipsearch:
    Search for live hosts on the current net, or hosts with a
    particular port open..
    Useful for things like finding that Raspberry Pi you just booted.
    Also has some useful network wrappers like ping, arp, fping,
    list network interfaces and find current network.

ipscan:
    A Bourne shell (sh) net scanner/pi finder uses nmap.

keyreader.py
    Read characters (keystrokes) one at a time (cbreak mode),
    with or without blocking, with or without echo,
    on Unix/Linux/Posix platforms.

kitfox-patch
    A simple shell script to update Firefox's browser/omni.ja file
    with custom patches when a new version of Firefox comes out.

langgrep:
    Search (grep) for patterns only within scripts written in a
    specified language (e.g. in all python scripts).

louder:
    Increase alsa system volume by a small increment. Symlink it to
    another name like "quieter" and it will decrease instead.
    Bind those to volume increase/decrease keys on your laptop.
    and set it as the system wallpaper.

mac_lookup.p:
    Map MAC network addresses to manufacturers.
    Useful for things like scanning your network to find your Raspberry Pi.

masq:
    Set up IP masquerading to talk to another computer, such as a
    Raspberry Pi, over eth0 while using wlan0 for the internet.

moonpos:
    Predict when the moon (or another body) will be at a specified
    altitude and azimuth during a specified time window

mouseevent.py:
    Read mouse events from /dev/input even if not running X,
    using the python evdev module. Linux only.

mpcdemo.py:
    A tiny demo of how to use multiprocess communication in the
    multiprocessing module to start a worker thread and pass messages
    to it.

musicplayer.py:
    A little toy music player in Python, illustrating how to play audio.
    Actually more than a toy now -- I use it as my main music player.

noblank:
    Turn off screen blanking. Run this when you're giving a presentation.
    Linux-specific.

nokeywords:
    Find directories beneath the present one that don't contain a
    Keywords or Tags file -- i.e. image directories that need to be tagged
    with metapho.

nonblock.py, nonblock-py3.py:
    Examples of how to do nonblocking input in Py 2 and Py 3.
    For code that works in either version, see termsize.

noteplayer.py:
    Spun off of play_chord.py: a more general pygame-based  note generator
    usable asynchronously, like from a Raspberry Pi piano keyboard.

oppretro:
    Several different programs to examine Mars' orbit, and also to
    experiment with various astronomy libraries. See oppretro/README.md
    for more details.

pathmatch:
    Search your executable path to find programs matching a string.
    Like str<tab> except you can match patterns anywhere in the
    string, not just at the beginning.

pisoothe:
    Play sound samples (e.g. soothing white or pink noise samples)
    in a loop, reacting to key events for volume control or to skip
    to the next sample.

play_chord.py:
    Example of how to generate and play chords using Python and NumPy.
    Can also play strings of notes, or can play notes from the keyboard.

podcopy:
    Copy podcasts (fetched with podget) to a mounted mp3 player or directory,
    or to an Android device via adb.
    Remove characters in filenames that would cause problems on vfat
    filesystems, and ensure filenames are unique and files aren't dups.

prettysoup:
    Prettyprint a BeautifulSoup object. Customizable, and avoids
    problems like BS4 prettify() adding spaces in the middle of words.

pyclip:
    Read the X clipboard.

pykey.py:
    Simulate keypresses under X. A simpler, Python version of
    Crikey, http://shallowsky.com/software/crikey/

pyplay.py:
    A class to play sounds asynchronously by calling aplay (or an app
    of your choice). Don't repeat a sound that's already playing.
    Used in the xchat script chatsounds.py.

pyruler:
    An X pixel ruler. Useful for measuring things like icon sizes.

pysync:
    Call rsync, but check first what would be changed, and save the
    password between the two calls.

python-cheatsheet.py:
    Cheatsheet and syntax reminders for useful Python features.

qpreso:
    A lightweight presentation program for displaying HTML slides.
    Python3/QwebEngine version.

randombg:
    Choose a random background (wallpaper) from a directory named based on
    current X resolution. So you can have different sets of backgrounds
    sized for laptop screen, external monitor etc.

randomline:
    Print a random line from a file. Useful for things like choosing
    a random wallpaper or random system beep tone.

readkey.py:
    Read a key press from the keyboard without waiting for a newline.
    For CLI programs: doesn't need X, tkintr, pygame or similar libs.

repo-pullpush:
    Modify a git repository, taking the existing URL, making that
    the pushurl and adding a passwordless pull URL alongside it.

scrubjay:
    Demo of how to use a few different Twitter API.
    No UI as yet.
    Two variants: scrubjay-tweepy (tweepy) and scrubjay-p-t (python-twitter).

serio:
    A proof-of-concept serial terminal app in Python.
    Don't take this seriously; it's not meant as a real app (yet?)

shorturl:
    Use a URL shortening service to get a shorter URL.
    Can take input from the current X selection, and automatically
    select its output for pasting into a browser or Twitter window.

shorturl-gi3:
    shorturl ported to python3, GTK3 and GObject introspection (GI).
    Most useful as an example of how to use GI-GTK3.

sieve.py:
    Visualization of the Sieve of Eratosthenes, using Python curses.
    (Not very useful, but makes a good curses example.)

sinkto:
    Synchronize files in a list between two machines.
    Good for syncing updated scripts, dot files, documents,
    email folders etc. to a laptop when preparing for or returning
    from a trip, or just for keeping several machines in sync.

speedtestserver:
    A mini http server that can introduce delays or other glitches
    that are useful for testing http download clients.
    Unfortunately, it's only single-threaded which makes it
    not very useful except as an illustration of how to make
    a mini server in Python. Use delaytest.cgi for actual testing.

tee.py:
    A file-like class that can optionally send output to a log file.

termcolors:
    Display ANSI colors for the current terminal.

termsize:
    Set stty size to the size of the current terminal window,
    e.g. when logged in to an embedded Posix device over a serial line.

tklabelimage.py:
    Mini example of how to display text and images together in a label
    in TkInter, and of how to conditionally import Tk in python2 or 3.
    Doesn't do anything useful.

transimageviewer.py:
    A translucent image viewer (inheriting from imageviewer.py)
    that passes clicks and other events through to the window below.
    Useful for things like saving GPS waypoints from a map image.
    Also offers a rare example of how to use the X11 SHAPE extension
    from pygtk, including input shapes.

turtlefrac.py:
    Draw fractals (specifically a Sierpinski triangle)
    as an example of how to use Python turtle graphics.

tweet:
    Play birdsong from a specific bird. Requires ripped tracks from a
    bird song CD: for example, the Stokes, Cornell or Peterson collections.

qhtmlprint:
    Convert a set of HTML slides (e.g. in navigate.js) into PDF.
    For turning an HTML presentation into a PDF slide deck.
    Unfortunately the QtWebkit libraries this depends on
    seem to be abandoned; see qslide2pdf for a newer version.

qslide2pdf:
    Convert a set of HTML slides (e.g. in navigate.js) into PDF.
    For turning an HTML presentation into a PDF slide deck.
    Uses Qt5's QWebEngine and PyPDF2. We'll see how long that's supported.

qpdfview.py:
    A simple PDF viewer for Python-Qt5 using popplerqt5.

quickbrowse.py:
    A minimal browser in python-qtWebEngine. Fast and light,
    supposedly anonymous, no storage of cookies or other identifying
    information. Useful for things like viewing URLs from mutt or
    checking websites that don't work well with a Firefox/NoScript profile.
    Can be used standalone (ln -s /path/to/quickbrowse.py ~/bin/quickbrowse)
    and/or as a python module for derived browser-based programs.

urldownloader.py:
    Maintain a queue of URLs to download asynchronously to local files.

vcalparse:
    Parse and print an icalendar/vcalendar/ICS file using python-vobject.

viewhtmlmail:
     Take an mbox HTML message (e.g. from mutt), split it using munpack,
     and rewrite it so it can be viewed in an external browser.

viewmailattachments:
     Show all attachments to an HTML message in a Firefox window,
     first running them through unoconv or other conversion programs
     as needed to convert MS Office formats to HTML or PDF.

vol:
    A simple python-gtk volume slider. Much simpler and smaller than
    alsamixergui.

waymaker:
    Take a file and of descriptions, multi-line and separated by blank lines,
    and turn it into a collection of GPX waypoints suitable for import into
    any mapping program (e.g. Osmand or PyTopo).

weather/cwop.py:
    Download and parse readings from Citizen Weather Observation Program
    stations.

weather/noaatemps.py:
    Display and plot weather means for a set of stations,
    by downloading NOAA data files.

weather/weatherwin:
    Display a window showing temperature and today's forecast
    for several cities at once.

weborphans:
    Check a web site (perhaps localhost) against a local mirror,
    checking for broken links and orphaned files.

wikitable.py:
    Parse a data table from a wikipedia page, outputting CSV.

word2html:
    Convert .docx or .doc to prettyprinted HTML.
    Uses python-mammoth for docx, and either uniconv + python-mammoth
    or wvHtml for .doc. Uses BeautifulSoup for prettyprinting.

wordview:
    Convert a doc or docx file to html, and call a new firefox window on it.
    Predecessor to (and simpler than) viewmailattachments.

xbright:
    Adjust brightness of an X11 display up or down using xrandr.

xlsrd:
    Display an .xls spreadsheet as a formatted ASCII table, using
    the xlrd package to parse the spreadsheet.