Archive for November, 2008
Bash: Choose a random value out of a set
Posted by JohannesTheDeveloper in Happy Hacking on November 28th, 2008
The best scripts are the shortest.
This chooses one of the arguments randomly. $# is the number of arguments
#!/bin/bash
echo ${BASH_ARGV[ $(( $RANDOM % $# )) ]}
Example:
$ bash randomchooser.sh 1 2 3 4 5 6 7 8 9 120
3
Ultra fame
Posted by JohannesTheDeveloper in Happy Hacking on November 13th, 2008
If you have a reasonable new Videolan VLC Player (say, 0.9.6), open up Help>About>Thanks. Go to J like Johannes.
I contributed that you can use the hotkeys Ctrl-1, Ctrl-2, Ctrl-3, Ctrl-4 to resize the window to 1:4, 1:2, 1:1, 2:1 size of the original movie size, and that you can go to fullscreen.
The 0.9.6 version is a really nice release. You have to get used to the new interface, but it’s nice. Check out the puzzle game mode!
If you have a reasonable new GNOME deskbar-applet, you probably use the calculator I, not wrote, patched. The main work I did was that it works together with the converter plugin (which is not distributed within deskbar-applet).
Anyway, GNOME (2.24) picked it up and the feature is on the release notes page of GNOME with a screenshot!
In the source package, you can find my name in the beginning of the file deskbar/handlers/calculator.py.
In newer distributions (like Ubuntu 8.10 for example), you’ll find my name in something like /usr/lib/deskbar-applet/handlers/calculator.py.
What this means is that my name will be on ten thousands to millions of computers, wasting space … haha ;-)
The thing that didn’t make it into a package is dualscreen presentations for evince (PDF viewer). It’s a cool idea, and it works.
But the patch adds a new window and has bad reuse, and is harder to maintain. Also, it has some usability issues. The patch and bug is in GNOMEs bugzilla, so someone else can continue the work.
PDF merge/join/split
Posted by JohannesTheDeveloper in Happy Hacking on November 13th, 2008
You always wanted it to be this simple. Now it is.
.
Download:
=> 8KB pdfjoin-nosrc.tar.bz2
14712KB pdfjoin.tar.bz2 (with Ghostscript sources)
I programmed it in Python+Glade+GTK. It uses ghostscript as backend.
Unpack and run “python pdfjoin.py”.
I’ll make a Windows package sometime.
Recent Comments