active_corners.py (formerly kde_gui_fixes.py)
A quick script to let me bind arbitrary actions to clicks and scrolls in the
corners of the screen.
Works by creating un-managed, shaped, windows (4px by 4px) in the corners which
receive and act on events.
Requires: PyGTK, dbus-python (optional, default configuration only)
(I may switch it to PyQt when I can spare the time)
Some code based on the shaped window example from the PyGTK 2.x tutorial.
A simple little script to convert Microsoft Word files into Konqueror .war
archives (an HTML file and it's dependencies inside a renamed .tar file)
- Add a file magic check to identify and rename RTF files with .doc extensions.
# By: Stephan Sokolow
# A wrapper script to allow KAudioCreator to encode to both Ogg Vorbis and FLAC
# in one run Also normalizes the input file to avoid the need to do so twice
# later on.
# Licensed under the GNU GPL 2 or later.
A crude script for identifying audio files that generate duplicate waveforms
Originally written as an experiment in identifying files that differ only in
metadata. Supports anything sox does.
It's CPU-bound, but because of sparse documentation on the MP3 format, it's
the best I can do for now.
Probably best to use FDMF (http://w140.com/audio/) with some stricter-than-
default thresholds until I find the time to rewrite this to be I/O-bound.
prints duplicates to stdout (one per-line) with groups of duplicates separated
by empty lines. Status messages are sent to stderr.
Warning: Seems to get stuck on .mpg files.
Find Dupes Fast
By Stephan Sokolow (ssokolow.com)
Inspired by Dave Bolton's dedupe.py (http://davebolton.net/blog/?p=173) and
Reasonable Software's NoClone.
A simple script which identifies duplicate files several orders of magnitude
more quickly than fdupes by using smarter algorithms.
This script supports both comparison by SHA1 hash and, to eliminate the
vanishingly-small but present risk of hash collisions, also supports exact
(Exact comparison does a lot of seeking, so it will be significantly slower
on a traditional hard drive, but may be noticeably faster on a solid-state
drive since it reads files incrementally and can stop as soon as a difference
Grouping by size and doing a preliminary pass to compare file headers are both
used to significantly reduce the amount of comparison necessary. This also
serves to limit both the memory consumption and the number of open file
handles when doing exact comparisons.
Finally, unlike with fdupes, under no circumstances will the --delete option
allow you to accidentally delete every copy of a file. (No --symlinks option is
supported and this script will not be confused by specifying the same directory
multiple times on the command line or specifying a directory and its parent.)
Note: This file has full Epydoc API documentation.
A simple clone of the KDE Fuzzy Clock widget for use in other desktops.
The time appears as a tooltip if you hover your mouse over the tray icon.
If you'd like additional levels of fuzziness, just ask.
A convenience wrapper for building and installing a new kernel on Gentoo
Linux, complete with some extra bits to make maintaining a couple of
backup kernels easy. Also handles mounting and unmounting /boot and calling
module-rebuild to regenerate external kernel modules.
This only writes a tertiary kernel if none exists to prevent two builds
in a row from deleting the only good kernels available, so you'll want to
add this to your /etc/conf.d/local.start:
if [ -e /boot/old_kernel_emergency ]; then
echo " * Boot considered successful. Purging tertiary kernel."
rm -rf /boot/old_kernel_emergency
Read the source for the rest of the details.
- Should I have this regenerate the fbcondecor initrd?
- Better instructions. Possibly a zip bundle with a README
A quick script to fix a couple of my KDE pet peeves:
- The screensaver disabling mechanism doesn't guarantee it'll get re-enabled.
- There's no way to ensure scrolling in the corners will switch desktops.
Requires: PyGTK, PyDCOP (optional, default configuration only)
(I used PyGTK because I'm more familiar with it than PyQt and I was rushed)
Some code based on the shaped window example from the PyGTK 2.x tutorial.
- Merge this with another idea of mine and whip up a nice GUI for it.
A single-file Python CGI script for effortless sharing of other single-file
scripts. If you're viewing a "Useful Hacks" list on my website, this is the
code behind it.
Simply put your desired description into each file's docstring (for shell
scripts, it takes every commented line starting with the shabang and ending
with the first non-comment line) and drop them into a folder along with
this script. Currently supports Bourne-compatible shell scripts and Python
scripts. Other languages under consideration.
- Hyperlinks URLs and obfuscates e-mail addresses in script descriptions.
- Configurable license name hyperlinking
- The HTML templating is a quick hackjob. I'm not kidding.
- Don't forget to remove the template bits specific to my site.
- Switch to a proper templating solution? (No longer a single-file script)
- Add caching eventually (current run time for my site, 0.1 seconds)
- Add a 5px inset border and subtle "rounded CRT glare" gradients to <pre>
A pure-Python module for identifying and examining RAR files developed without
any exposure to the original unrar code. (Just format docs from wotsit.org)
It was, however, influenced by the zipfile module in the Python standard
library as, having already decided to match the zipfile.ZipFile API as closely
as feasibly possible, I didn't see a point to doing extra work to come up with
new ways of laying out my code for no good reason.
@todo: Determine how rarfile (http://rarfile.berlios.de/) compares to this in
various target metrics. If it is superior or close enough on all fronts,
patch it as necessary and plan a migration path. Otherwise, do the following:
- Complete the parsing of the RAR metadata.
(eg. Get data from archive header, check CRCs, read cleartext comments, etc.)
- Optimize further and write a test suite.
- Double-check that ZipFile/ZipInfo API compatibility has been maintained
- Support extraction of files stored with no compression.
- Look into supporting split and password-protected RARs.
- Some password-protected RAR files use blocks with types 0x30, 0x60, and 0xAD
according to this code. Figure out whether it's a bug or whether they're really
completely new kinds of blocks. (Encrypted headers for filename-hiding?)
- When the appropriate code is available, use the following message for failure
to extract compressed files::
For reasions of patent, performance, and a general lack of motivation on the
author's part, this module does not extract compressed files.
A quick-access auto-saving, auto-hiding scratchpad for jots, multi-step
copy-pasting, and anything else where a more specialized app is over-thinking
the problem and opening a plain old plaintext editor (like leafpad, notepad, or
kedit) is inefficient and potentially clutter-inducing.
Recommended: GtkSourceView and its Python bindings (Undo/Redo support)
Usage: Run it and then click the white line along the left edge of the desktop.
(Also supports drag-and-drop)
- Include a "pushpin" icon/button in the lower-right corner to lock the tray open.
- Pressing escape should collapse the tray
- Implement some form of multi-note support for storing stuff that needs to be
"backgrounded". Maybe tabbing. (Similar reason to having a few virtual
- Support some sort of resize handle or handles.
- The window hides while the context menu is visible (harmless but unintuitive)
- Quitting by closing the X connection (xkill) doesn't commit pending changes.
- A drag-and-drop which sends a drag motion event to this but then ends in a
drop to another window will temporarily confuse the auto-hide.
- ScratchTray currently depends on fcntl... which is non-portable. I'll update
it to use a portable wrapper once I've made appropriate preparations so that
my index.cgi script accepts zipped bundles.
- Resizing the tray on resolution change is currently broken. I'll take a look
at it soon.
A horrendously CPU-bound but functional script for swapping the audio-track
byte order in cdrdao .BIN files so that a .CUE file generated by toc2cue can
be mounted by DOSBox or CDEmu.
- Optimize and, if necessary, rewrite in C.
Automatically generates /etc/hosts from /etc/hosts.local and the MVPS
ad-blocking hosts list.
Put this file in /etc/cron.monthly and chmod it executable.
Edit the ADHOST_SUFFIX_WHITELIST variable if you want. (Default is to allow only
Project Wonderful because I respect them and they don't serve up flash ads)
- Use If-Modified-Since and ETags on the MVPS file so I can safely run this
more often. (Perhaps also use the ZIP download to save bandwidth?)
- Add a mode which doesn't require the local hosts file to be moved to