My name is Aleksander Skjæveland Larsen. I am a masters student in Information Science at the University of Bergen. I enjoy coffee, music, old computers, programming and hacking around in general. Both me and my wife are left handed. I prefer the keyboard over the mouse any day.
There is a lot of data I need to extract from archives, nested deeply within a silly folder structure. Doing it manually is out of the question. I had to modify this script I found at the Unix Stack Exchange slightly, in order to make it run as I wanted. It will run until it doesn’t find more .zip archive files, as it deletes them after extraction.
I put this into a file:
#!/bin/bash
shopt -s globstar nullglob
while set -- **/*.zip; [ $# -ge 1 ]
do
for z
do
( cd -- "$(dirname "$z")" &&
z=${z##*/} &&
unzip -- "$z" &&
rm -- "$z"
)
done
done
then made it executable with chmod +x and stuck it on my path. Now I can easily unzip all the archive files recursively, from the folder where I call the script.
Update 2nd September 2011: It seems I forgot to write how to configure gnome-terminal to keep the original title. In Profile Preferences go to Title and Command and set When terminal commands set their own titles to Prepend initial title.
Stumpwm is an excellent tiling window manager written entirely in Common Lisp. It is fully keyboard driven and hackable to the fullest. The wm is running in it’s own CLisp REPL, so you can connect with Slime+Emacs and hack directly. It is super easy to customize the wm, simply re-evaluate and you are good to go!
cmus is an equally awesome program I enjoy using, a very efficient music player that runs in a terminal emulator.
I wanted to have a keybinding either bringing cmus in focus, or starting it if it isn’t running. As cmus is running in a terminal emulator, it wasn’t straight forward how to achieve this. I am using the Gnome Terminal, so this solution will have to be modified to work with other terminals. Of course, the code is added to the .stumpwm file, but you could also just evaluate it to try it out.
(defcommand cmus () ()
"Run or switch to CMus"
(run-or-raise "gnome-terminal -e cmus -t cmus"
'(:instance "gnome-terminal" :title "cmus")))
Now I just have to bind the command to an appropriate key
(define-key *root-map* (kbd "C-p") "cmus")
This works because I set the title of the terminal when I launch it. cmus changes the title based on what song is playing, so it will not work without doing this.
2 comments