Linux
Automatically create genre playlists of your music collection
Sunday, March 3rd, 2013 | Linux, Tech-savvy | No Comments
This script will create playlists based on the tags of your mp3 and flac files. Prerequisites: id3v2/metaflac command line tool (sudo apt-get install id3v2 metaflac) and tagged mp3/flac files.
Note: The id3v2 command only works up to version 2.3 of the id3v2 spec (which is pretty much the default), so this script will not work on v2.4 files. It seems a lot of people still use 2.3 as 2.4 does not give a lot of advantages and 2.3 is way more compliant with mp3 playback devices. I just came across this issue because I use EasyTag for tagging and this tool writes v2.4 by default. After setting EasyTag’s prefs to v2.3 I was good to go
#!/bin/bash # set extraction command chain for each file type EXTMP3="id3v2 -l \"_FILE\" | sed -n \"s/TCON (Content type): \(.*\) (.*)/\1/p\"" EXTFLAC="metaflac --show-tag=GENRE \"_FILE\" | sed -n \"s/GENRE=\(.*\)/\1/p\"" # delete old playlists rm *.m3u function createPlaylist { while IFS= read -r -d '' FILE; do echo Processing \"$FILE\" GENRE=`eval ${2/_FILE/$FILE}` if [ "$GENRE" ] then echo "$FILE" >> "$GENRE.m3u" fi echo "$FILE" >> "All.m3u" done < <(find . -name "*.$1" -print0 | sort -z) } createPlaylist mp3 "$EXTMP3" createPlaylist flac "$EXTFLAC" |
Basically we loop over all files and extract the genre’s nice name using a file type specific chain of commands. If a genre is found the file name is appended to the playlist that is named like the genre itself. Additionally an “All” playlist is created that holds every file found, even the ones that have no genre set.
“fast” JIRA and Confluence setup on a small VPS
Sunday, January 6th, 2013 | Linux, Tech-savvy | No Comments
I recently stumbled upon my old “fast firewalling for developers with iptables” blog and also read the comment (yeah, one!) asking how to go on from here, maybe set up JIRA and Confluence from Atlassian really fast. So here we go. We will install JIRA and Confluence using MySQL as the database, allowing only HTTPS connections. Bear in mind that this is not an enterprise setup, it’s again targeted at individuals who want to run these tools in a non-critical private small VPS environment maybe to evaluate the tools or collaborate with a friend. This is going to be easy and straightforward, no fancy admin stuff, no over the top security, simply getting the stuff up and running.
› Continue reading
Bash history at your fingertips as seen @coderwall.
Thursday, December 13th, 2012 | Linux, Tech-savvy | No Comments
The single most useful thing in bash #protip https://coderwall.com/p/oqtj8w via @coderwall
Create ~/.inputrc and fill it with this:
"\e[A": history-search-backward "\e[B": history-search-forward set show-all-if-ambiguous on set completion-ignore-case on |
This allows you to search through your history using the up and down arrows … i.e. type “cd /” and press the up arrow and you’ll search through everything in your history that starts with “cd /”.
Props go to Jude. Thank you very much for this. Upvote done.
Goodbye Fedora, Hello Ubuntu
Tuesday, September 11th, 2012 | Gadgets, Linux, Tech-savvy | No Comments
Fedora pretty much blew my mind until recent updates rendered the system unusable. After a kernel update VirtualBox stopped working (had to install recent header files by hand) and my FreeMind had some dependency issues I didn’t even bother to solve. I like to have a system that is as versatile as any modern Linux, yet I need a stable environment as well. So I thought fudge it, let’s give *the* “standard” Linux a try – I installed the recent Ubunutu 12.04.1 LTS and man it rocks!
- Ubuntu 12 at a glimpse:
- Unity is a Desktop Environment that is easy and pleasant to work with.
- The dash is pretty kewl as well. I don’t know how much I like the tight integration with pretty much everything, but it seems to be a nice concept.
- Terminals come with a decent colour scheme – may sound petty, yet a sloppy set-up terminal is a major annoyance to me.
- Ctrl-Alt-T – how come it never occurred to me that a terminal shortcut will make life so much easier?!
- Ubuntu’s default font is a feast for the eyes – love it!
- bash history size is already set to 2000 (instead of Mint’s 500) – no need to pimp this one as well
- ls aliases already present, yet needed some personal flavour tweaking
I have to say that Ubuntu 12.04 has been the most flawless and out-of-the-box experience in quite some time. Awesome!
- Brief post-installation task as a reminder to self:
- fix vim movement issue
- hide windoze hdds in nautilus @see http://www.nick-prosch.de/?p=4265
- fix .local name resolution in /etc/nsswitch.conf if you are on a m$ driven network
- we like to be united – my wife and me use the same usergroup and still like to have 002 umasks instead of non-username group’s umask of 022 @see https://blueprints.launchpad.net/ubuntu/+spec/umask-to-0002 for more info
- all beloved ones shall use the same group
- edit /etc/login.defs s/UMASK 022/UMASK 002/
- install Adblock Plus, Firebug
- install VirtualBox + extension pack and add users to vboxusers group
- install Audacious
- install TrueCrypt
- set up ssh environment, keys and the like
echo set nocompatible >> ~/.vimrc |
hosts: dns files mdns4_minimal mdns4 |
sudo usermod -g users username |
sudo usermod -a -G vboxusers username |
I am about to get a new shiny device at work. I am looking forward to see how Ubuntu subsists in every day’s developer’s business. Stay tuned.
Fedora 17: post installation tasks
Monday, September 3rd, 2012 | Linux, Tech-savvy | 1 Comment
Okay, as promised, my personal Fedora 17 post-installation tasks are:
- Change terminal environment
- Install Adblock Plus
- Hide unwanted devices in Nautilus
- Install Fedora Utils
- Install TrueCrypt
- Install Audacious
- Install Nautilus Open in Terminal extension
- Install VirtualBox
- Install Thunderbird
- Install Office suite
- Install Gimp
- pimp Gnome
- Windows Alt Tab
- Native Window Placement
- Remove Accessibility
- Status Icon Fixer
- increase terminal history size
First thing I do is open a terminal and wonder who likes to work on a small piece of paper? This is a terminal, not a word processor. Edit -> Profiles… -> Default, 132×43 size, colour scheme: Gray on black, transparency 10%, Scrollback 5120, done.
Adblock Plus seems to me like the essential FireFox plug-in in any kind of browsing environment.
Get rid of windoze partitions and the like showing up in Nautilus. See my previous post on this topic.
Fedora Utils is a script that lets you install essential (proprietory/closed-source) software. Use it to get access to multi-media codecs and DVD playback or software like Google Earth and Skype. Nice! Save a lot of handiwork. There maz be better alternatives around, but as this is my first Fedora run I cannot say which one does the job best.
Nice encryption tool. Make sure you disable the requiretty option in the sudoers file for GUI support.
My favourite Linux Winamp clone. Love it or leave it.
sudo yum install audacious |
Fiddling in Nautilus and need a Terminal? Right click -> Open in Terminal. Done.
sudo yum install nautilus-open-terminal |
If you installed Fedora Utils you should already have a current VirtualBox in your repositories.
sudo yum install VirtualBox |
Download and install the extension pack for USB support.
Make sure you are a member of the vboxusers group:
usermod -a -G vboxusers username |
Fedora ships with Evolution, I prefer Thunderbird.
sudo yum install thunderbird |
I guess Libre Office is the suite to go with.
sudo yum install libreoffice |
What? No Gimp? That@s pretty darn “pure” too me
sudo yum install gimp |
I only install a bare minimum of Gnome Extensions, namely
A replacement for Alt-Tab, allows to cycle between windows and does not group by application. First I tried AlternateTab, but that gave a small preview of the window instead of the program’s icon. It can be quite tedious to search for a window’s content rather than an easily recognizable icon.
Arrange windows in overview in a more compact way.
Remove the accesibility button from the top panel.
Fixes Dropbox, Skype, vlc and others into the status bar; not perfect, but ok
I like this little devil a lot. I used it to fix Audaciuos status icon to appear where I want it to. Edit ~/.local/share/gnome-shell/extensions/status@gnome-shell.2jk.org/extension.js to suit your needs.
From a previous post: Remember that wicked command you entered a few weeks ago? No? Increase your history size to something that lives up to the term “history”. Open your ~/.bashrc and enter something like export HISTFILESIZE=10000
I’d like to point out one more time that Fedora 17 ships with working multi-monitor support and vi movements are working out of the box as well, no more echo set nocompatible >> ~/.vimrc needed. I also already encountered a few problems, like VirtualBox no longer working after Kernel update or FreeMind having some dependency issues at some point. I have to say that it seems bleeding edge comes with a few characteristics that render the OS not work-compliant. Maybe next time I’ll go for a plain Ubuntu LTS and hope it just works…
Linux Mint 12: More post installation tasks
Wednesday, May 16th, 2012 | Linux, Tech-savvy | No Comments
I started to write down my personal Linux Mint post installation tasks as of version 10. After installing a few Mint 12 machines I had to update the list. As always, highly personal, take whatever info might be useful, ignore the rest.
- Add favorite programs to autostart
- Disable extension overkill
- Install VirtualBox with USB support
- Use the users group as the default group
- Increase history size
GNOME 3 has no point-and-click tool to add autostart options, at least no default shortcut for it. Alt-F2 and gnome-session-properties does the trick. I have essentials like my browser, media player and ssh-add in my autostart.
Whether you use MATE, GNOME 3 or Cinnamon is up to you. I kinda like the new GNOME, but not all the default “extensions” that come with Mint 12 extend my user experience in a good way
I decided the following options work the best for me:
Well, installing VirtualBox is a little confusing, as you have multiple versions (virtualbox-ose, -nonfree, -4.1) in your available software list. Some people suggest adding new repos and installing the latest version, I just stick to what’s being delivered by the default repos. Makes me feel better for some reason.
The VirtualBox site states that the “standard” installation names are the ones with the major version at the end, so I just went for the -4.1 (writing this 4.1.14 is the latest stable, the official Mint repos provide 4.1.6, yeah, whatever…)
If you want USB support you have to add the appropriate extension pack. Go to http://download.virtualbox.org/virtualbox/ and get it for your installed version. You also have to make all users that want to use VirtualBox members of the vboxusers group. As there is no GNOME 3 default group editor simply open a shell and enter
nick $ sudo adduser username vboxusers |
Your group memberships will be updated the next time you log in.
Finally, add USB devices in your VBox config’s USB section (select the desired machine, click “Change”, choose “USB”). After that you should be ready to go. What a drag.
I share my computer. I share a lot of files, like pictures and stuff. I don’t like that my user – nick – also has his primary group called “nick”. So ownership of files is nick:nick. This makes little sense to me and I’d rather have it like this: nick:users and nickswife:users so that I can easily access the same files as my picture taking wingman. So issue
nick $ sudo usermod -g users username |
for each user that should have the “users” group as the default group. (The sticky bit approach cd /our/pics; chgrp -R users .; find . -type d -exec chmod 2770 {} \;; find . -type f -exec chmod 660 {} \;was not sufficient for me, by using the same primary group I hope we won’t have any permission troubles in the future again)
Remember that wicked command you entered a few weeks ago? No? Increase your history size to something that lives up to the term “history”. Open your ~/.bashrc and enter something like export HISTFILESIZE=10000
That’s it for today. Have phun!
Temporarily switching X desktop resolution
Monday, April 16th, 2012 | Linux, Tech-savvy | No Comments
My experience with multi-monitor environments in Linux is that it can be quite tedious to set up. You may not agree and have no issues, lucky you!
Currently I have a 24″ screen as the “main” screen and right of it my laptop display, mainly for displaying logs and stuff. Anyway, every time I boot my system without the monitor everything seems fine, except my system still thinks I have the space of the non-existing monitor available. So sometimes apps open at their former location naturally being off-screen now … Alt-F7 to the rescue? Not really. I recently wanted to show some robot tests to a client that all opened and closed off-screen … well, at least they were all green
Anyway, Google is my friend and told me about xrandr (the X resize, rotate and reflect extension)
Xrandr is used to set the size, orientation and/or reflection of the outputs for a screen. It can also set the screen size.
Well, every screen setup that comes with your favourite *nix flavour is able to change resolution, right? Still, xrandr became my weapon of choice because it does not touch your X config and it works on the fly, no need to restart your whole X session. Next time you fire up your system (or X respectively) everything is back to normal. Neat.
There’s even a little GUI available, just try sudo apt-get install lxrandr (developed for LXDE, works fine with GNOME 3 as well). I tried this with Mint 12 x86_64 GNOME 3. If you have similar issues and – maybe better – solutions, drop a comment. I heard a colleague of mine is using several X configs to choose from depending on the desired environment. From my perspective the whole screen setup / multi monitor / beamer handling is one thing that works a lot less painful in Windoze environments… *sigh*
Mint 12 (/Ubuntu): Set up Java alternatives
Saturday, February 18th, 2012 | Java, Linux, Tech-savvy | 2 Comments
Your modern Linux distro will provide you with a more or less decent Java setup by default. Mint 12 comes with a Sun JDK 1.6.0.26 pre-installed. To switch between installed versions of your Java runtime use the
update-java-alternatives --list |
command to list installed alternatives and
update-java-alternatives --set alternative |
to switch them. If you still want to have different versions of the JDK you can always download them manually, untar and use them directly. So far so good.
I wanted to be able to switch my downloaded JDKs as easy as the pre-installed ones, so I was looking for a way to add my JDKs to my system’s repository. So here is how it’s done (it’s basically a copy of a nice post I found, I just wanted to spread the knowledge) – it’s a bit painful but made me feel quite good when I was done
› Continue reading
Mint 12: Hide unwanted devices in Nautilus
Friday, February 10th, 2012 | Linux, Tech-savvy | No Comments
My laptop consists of quite a few partitions, different OSs and file systems. Nautilus displays everything that will be mounted to /media as a device in the places sidebar. This became an annoyance, because I really don’t need to see my Win7 system partition and my old Mint 10 partitions on a regular basis. I tried the easy way: right-click on an item and say “remove” or something – naaat!
I was looking for an easy solution and came across some pretty old forum posts and workarounds that simply don’t work (any more). Here is how I managed to get rid of the unwanted device entries fairly easily: you simply have to explicitly mount the unwanted volumes and use a folder other than /media – basically /mnt will do. This way you don’t have the unwanted file systems listed in Nautilus directly yet can access them easily by navigating to /mnt/mountpoint.
Step by step:
- open nautilus
- mount all unwanted files systems by selecting them one after another
- open a terminal
- list mounted devices
nick@mintbox ~ $ mount
- look for the entries that resemble the unwanted files systems
- write down the /dev/sdx and type attributes
- create mountpoints for each device in in /mnt
nick@mintbox ~ $ sudo mkdir /mnt/exampleMountPoint1 nick@mintbox ~ $ sudo mkdir /mnt/exampleMountPoint2
- open fstab
nick@mintbox ~ $ sudo gedit /etc/fstab
- add a fstab entry for each device (first is a Win NTFS partition, second a ext4 Linux one)
/dev/sda6 /mnt/exampleMountPoint1 ntfs-3g defaults 0 0 /dev/sda7 /mnt/exampleMountPoint2 ext4 defaults 0 0
That should do the trick.
Treasures of the toolbox: SequoiaView / GdMap
Tuesday, February 7th, 2012 | Gadgets, Linux, Tech-savvy | No Comments
A few years ago I stumbled across a tool (SequoiaView) that graphically displays the contents of your hard drive using a so called cushion treemap. It’s a fast and easy way to get an overview of your (probably messed up) file system.
This is one of the gems I considered part of my Swiss “computer tools” army knife.
Now that I use Linux as my desktop OS I had to find an alternative to this Windows-only tool. Luckily there are quite a few similar tools available for Linux. I am pretty happy using GdMap.
So, whether you are using Windoze or Linux, try one of these cushion treemaps to get an idea how of your file system looks like from a distance. (…and get rid of these old ISO images in your temp dir
)
Happy housekeeping!
Search
Categories
- (X)HTML/CSS (5)
- Activities (29)
- Gadgets (35)
- Insights (2)
- Java (22)
- Certification (1)
- IDE (10)
- JSP (1)
- Language (16)
- Quirks (9)
- Vocabulary (10)
- Linux (16)
- Misc (58)
- Photography (16)
- Reviews (69)
- Tech-savvy (81)
Tag Cloud
Archives
- May 2013 (3)
- April 2013 (1)
- March 2013 (1)
- February 2013 (1)
- January 2013 (1)
- December 2012 (3)
- November 2012 (1)
- October 2012 (3)
- September 2012 (3)
- July 2012 (1)
- May 2012 (1)
- April 2012 (1)
- February 2012 (7)
- January 2012 (1)
- December 2011 (2)
- November 2011 (4)
- October 2011 (5)
- September 2011 (3)
- August 2011 (3)
- July 2011 (2)
- June 2011 (4)
- May 2011 (1)
- April 2011 (2)
- March 2011 (2)
- February 2011 (2)
- January 2011 (6)
- December 2010 (2)
- November 2010 (5)
- October 2010 (7)
- September 2010 (13)
- August 2010 (6)
- July 2010 (4)
- June 2010 (3)
- May 2010 (3)
- April 2010 (2)
- March 2010 (2)
- February 2010 (1)
- January 2010 (1)
- December 2009 (1)
- November 2009 (2)
- October 2009 (5)
- September 2009 (1)
- August 2009 (3)
- July 2009 (5)
- June 2009 (5)
- May 2009 (6)
- April 2009 (3)
- March 2009 (3)
- February 2009 (2)
- January 2009 (1)
- December 2008 (9)
- November 2008 (15)
- October 2008 (15)
- September 2008 (13)

