Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
352 lines (263 sloc) 11.2 KB
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 tiny Python module to make it easier to list files on an
Android device using adb, and copy individual files to the device.
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.
chatsounds.py:
An xchat Python script to handle nick (and other special-case) sounds.
Also a rare example of an xchat Python script.
cellaut.py:
Simple cellular automata simulation in Python. Slow.
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.
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.
doc2html:
Run wvHtml on a .doc file, but then use BeautifulSoup to clean
up at least some of the mess wvHtml makes.
docx2html:
Run mammoth on a .docx file to convert to HTML, then prettyprint
it with BeautifulSoup.
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.
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.
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.
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.
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.
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.
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.
preso:
A lightweight presentation program for displaying HTML slides.
pyclip:
Read the X clipboard.
pykey:
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.
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.
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.
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).
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.
quickbrowse:
A very minimal browser in pygtk. 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. I use it to check URLs that don't
work in my regular Firefox profile, either because of noscript/cookie
issues or because of Firefox compatibility issues.
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.
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.