Skip to content

Instantly share code, notes, and snippets.

@madx
Created October 31, 2008 13:03
Show Gist options
  • Save madx/21297 to your computer and use it in GitHub Desktop.
Save madx/21297 to your computer and use it in GitHub Desktop.
Little personal snippets and tools
#!/usr/bin/env ruby
puts $stdin.read.gsub(Regexp.new(ARGV[0]), ARGV[1])
#!/bin/bash
case "$1" in
"playlist")
playlist=$(
xmms2 list |
egrep '^->' -A 5 -B 5 |
sed 's/^ //g' |
gsub ' \(\d\d:\d\d\)' '' |
gsub '^->(.+)$' '<b>\1</b>' |
gsub '\[(\d+)/\d+\]' '\1 -')
notify-send -t 4000 'Playlist:' "$playlist"
;;
"jump")
id=$(xmms2 list | head -n-2 |
sed 's/^ //g' |
gsub '^->' "" |
gsub ' \(\d\d:\d\d\)' '' |
gsub '\[(\d+)/\d+\]' "\1" |
ruby -Ku -e '
$stdin.read.each_line{ |l|
puts l.split(" ")[0], l.gsub(/^\d+ /, "")
}
' |
zenity --list --width 500 --height 600 --column '#' --column 'Song')
xmms2 jump $id
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment