While you may see some of my real hacks below, I also have a page with Ideas for new hacks. Perhaps someone else will implement them? :)
The Google Phone
sdsplit will help you partition your sdcard directly on your phone without a pc. New!
palm2droid will help you import your palm addresses to you android phone without google contacts. New!
I have patched chironfs-1.1.1 so that it is possible to make a safe self healing script. And, of course, I have create such a script also.
You can read about the usage of the script here, and some technical details about the patch here. Newer!
I have created (and use) some heartbeat 2 helper scripts and OCF agents what you might find useful.
Shell Scripting
fargs New!
This really is too cool to explain. :) No, actually you could just think of it as YAFRT (Yet Another File Renaming Tool), but it is not actually, or just, a renamer. It stands for
file args and is meant to help you manipulate file arguments before passing them to xargs to do something with them. You could just manipulate your file names with sed, but then you would end up with only the modified new name. This script helps you modify new names and also pass the old ones to xargs, exactly what you would need to perform a rename. Very nifty, and entirely too powerful! You can read the help
here.
Replicate a directory hierarchy (no files):
find foo -type d | fargs -%1s/foo/bar/ -oo | xargs -l mkdir -p
Now, replicate all the files to the new directory structure while running dos2unix on them:
find foo -type f | fargs -%1s/foo/bar/ |
xargs -l2 sh -c 'dos2unix < "\$0" > "\$1"'
sdml2txt
A script to convert SDML to UML Sequence Diagrams. SDML is an extremely simplistic UML Sequence Diagram Markup Language (which is also a hack of mine). Here is some sample SDML along with a textual representation of the diagram it describes:
SDML:
[Client, Proxy, DNS, Server
Query Name->
Answer IP<-
http GET >->
<<-html
Sequence Diagram:
Client Proxy DNS Server
| | | |
|----------Query Name-------->| |
|<---------Answer IP----------| |
|--http GET -->|----------http GET -------->|
|<----html-----|<-----------html------------|
As you can see, there isn't much to describing a diagram. SDML is simple but flexible and aims to facilitate creating sequence diagrams with minimal effort and typing. SDML is inspired by
abc music tablature notation language. For more information about writing SDML, visit
here. Perhaps someone will create an sdml2ps converter?
sdml2pic Soon!
I am in the process of adapting the sdml2txt converter to output pic which can then be used to also create graphical representations using the pic2plot tools. This should get released this weekend sometime. Martin Fick March 07, 2008, at 10:17 AM
ascii2abctab
Convert asciitab guitar notation such as you would find posted all over the net to
abctab which you can then convert to postscript with
abctab2ps to make pretty printouts. With
ascii2abctab you can take simple text like this:
T:Happy Birthday
|-------------------------------------------------------------------
|-------------------------------------------------------------------
|-------------------------------------------------------------------
|---------5-4----------7-5------9-5-5-5-4-2-10-10-9-5-7-5-----------
|-5-5-7-5------5-5-7-5------5-5----------------------------5-7-5-8--
|-------------------------------------------------------------------
and it will output something like this:
X:1
...
T:Happy Birthday
K:guitartab
| ,,,,f ,,,,f ,,,,h ,,,,f ,,,f ,,,e ,,,,f ,,,,f ,,,,h
,,,,f ,,,h ,,,f ,,,,f ,,,,f ,,,k ,,,f ,,,f ,,,f ,,,e
,,,c ,,,l ,,,l ,,,k ,,,f ,,,h ,,,f ,,,,f ,,,,h ,,,,f
,,,,i
which can then be parsed with abctab2ps to look like this:
Since I have integrated this with pmwiki, you can preview this example
live.
To get abctab2ps to render some of the higher numbered frets you may need to use these modified fonts:
itBorrono.ps or
itTimes.ps.
svnauto
An
Auto Checkin tool for subversion with per directory checkin policies. This makes it easy to use a cron job and subversion as a backup mechanism.
lock
My attempt at creating a shell script based locking mechanism for any file. This mechanism attempts to deal safely with the case of abandoned locks by first locking the abandoned lock and then deleting it (recursively if needed). I believe I have eliminated race conditions and would be curious if anyone could prove me wrong.
sequence
This shell script uses the above locking mechanism to provide a sequence generator. The current sequence number is stored in a file only to be incremented when locked. This script should be fairly robust, avoiding any loss of the sequence number, even during program interruptions. The sequence number is backed up in another file before being overwritten (incremented). This script also ensures that any number never gets used twice by verifying that the sequence is indeed incremented in the filesystem (and unlocked) before ever returning a newly incremented number. The only failures should be skipped numbers, but never duplicate ones.
mutt2csv
This awk script will convert a mutt alias file into a csv file. The column order is optimized for
squirrelmail importing, but it should be easily rearrangeable if you want. This script can handle many of the formats that mutt allows such as:
alias nick first last <user@domain>
alias nick last, first <user@domain>
alias nick user@domain (first last)
alias nick user@domain (last, first)
xdisplay
Use this little script to help keep track of where you are and set your default X DISPLAY. If your DISPLAY is set, it will be returned, but if it is not, this will return the last known value. Use this in environments where you want your display to automatically get set whenever you log into remote machines. Appropriate
stderr messages are output when invoked so that you are aware of your settings.
This display value gets stored in ~/.xdisplay
To use, put this in your path somewhere, say ~/bin and:
in csh, do: setenv DISPLAY `xdisplay`
in sh, do: export DISPLAY=`xdisplay`
PmWiki
I have created many recipes (plugins) for PmWiki, best to check out my profile there to see them.
Photo Albums
I need to document how I have created my photo albums using pmwiki
PHP
size.php
Resize any local photo to any size dynamically, cache the results locally.
ChessBoard
 | Render a URL driven chess board layout dynamically. Use this to create web pages illustrating chess without having to use a drawing or screen capture program. This page guides you through writing chess board URLs or it can be used to render a board image that you can then save |
Palm Pilot
install-todo, 2
A slight modification of the original install-todos to insert a single todo, along with meta-data about this todo such as the due-date and priority.