Scripts

Here are some handy scripts.

amarok_slider_helper.pl

download
Shows a very wide slider allowing you to adust amarok's song position with much greater accuracy and ease than with amarok's GUI. Hit Escape and it will go away. Have a look in the script itself for other key bindings.
Requires: perl DCOP module

group-rename (v1)

download
A quick file-renamer for just editing any common prefix that all the files have.
For example you can quickly rename a bunch of the.daily.show.2007.whatever-blah.avi files to TDS-2007.whatever-blah.avi

Version 2 (coming soon) will support changing any common postfix also.
Requires: pgprompt and Gtk2-perl bindings.

truncate-file

download
Requires pgprompt
A utility for truncating a file to a specific length. It can be used in scripts and can use pgprompt to ask the user for confirmation. I take absolutely no responsibility for any loss of data caused by possible bugs in this program. Use it only at your own risk.

sleeptill

download
Example:
sleeptill 7:30am && wake-me-up

exec-in-bg

download
Allows you to execute a command and args in the background without having to tack on an ampersand " &".

Example: In the following code snippet, using exec-in-bg avoids having to generate a command string including all the files in @files and then tacking on an & . In addition to being simpler and clearer, it avoids all sorts of problems with files that have spaces in them which would need to then be quoted.

#!/usr/bin/perl
my @files=(@ARGV);
my @command=("do_something","or","other",@files);
system("exec-in-bg",@command);
something_else();
    

exec-in-xterm

download
Executes the command (specified on the command line) in an xterm.
Example:
  exec-in-xterm iftop
or
  exec-in-xterm tail -f /some/log/file
 

exec-and-wait

download
Waits for you to hit Enter after the command finishes.
Example:
  exec-and-wait tail -n 100 /some/log/file
or
  exec-in-xterm exec-and-wait tail -n 100 /some/log/file	       
	      

humanify

download
Filters numbers in it's output - turning them into human-readable numbers (converts to K,M,G units etc).

hexconv

download
Converts numbers between different units on the command line.
Example:
$> hexconv x0a=d
x=0a  ==>  d=10

$> hexconv d10=x
d=10  ==>  x=0x

$> hexconv d10=x
d=10  ==>  x=0x

$> hexconv x0a 0d ab cd
x=0a  ==>  d=10

x=0d  ==>  d=13

x=ab  ==>  d=171

x=cd  ==>  d=205

	      

unmap-window

download
Unmaps an X11 window.
Example:
  unmap-window $x11windowid
	      

pointer-position

download
Prints the X11 pointer position.
Requires: perl X11::Protocol
This may or may not work for you. It used to work for me but now it doesn't.