Archive for the 'Utilities' Category
Stakeout
This program monitors a bunch of files and runs a command when any of them changes.
The idea was pilfered from Pragmatic Automation. This program uses fcntl and thus only works on Unix derivatives.
Here’s how you might use it:
find -name \*.py | xargs ./stakeout.py src/TestAll.py
Download: Python source, Example shell script
No commentsArchos compatible videos
The Archos Multimedia Jukebox is a nice portable player but unfortunately picky when it comes to playing AVI files. Thus, here is an empirically crafted script that will encode almost any movie file to an Archos-friendly format.
The script uses mencoder from MPlayer, specifically with the following options:
mencoder -audio-preload 0 -oac copy -o OUTPUT -ovc lavc
-lavcopts vcodec=mpeg4:vqmin=2:vqmax=20:vhq:keyint=250:vme=4:v4mv INPUT
Note: If the audio track isn’t encoded with MP3, replace -oac copy above with e.g. -oac mp3lame -lameopts preset=standard
Usage:
make-archos-video.sh input.avi output.avi
Download: make-archos-video.sh
No commentspyhtml
PHP-style inline code in Python.
Here’s a sample html file:
<html> <body> The square of 5 is <? print 5*5 ?> . </body> </html>
Note that the opening and closing tags (<? and ?>) must be in separate lines.
Installation for Apache
Add the following to your httpd.conf and copy this script into your
cgi-bin directory:
AddHandler python-parsed-html .pyhtml Action python-parsed-html /cgi-bin/pyhtml.py
Also, make sure you have the actions modules (mod_actions) loaded or the above won’t work.
Download: pyhtml.py
No comments