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…
Goodbye Mint, Hello Fedora
Tuesday, July 31st, 2012 | Misc | No Comments
Seems Mint 13 finally finished me. I have to say that Mint 10 was the last “flawless” version of Mint (I’ve been there since Mint 4 “Daryna”). Right now I am still using Mint 12 on my home machine, tried 13 on my business laptop – and decided that I don’t want to take part in the desktop environment wars any more. Again, the multi-monitor setup in Mint was a pain and trying to preserve the Gnome 2 / XP way of working is a huge step back IMHO. I am okay with Gnome 3 (didn’t try Unity yet) and I was looking for a “pure” unfiddled Linux experience. After checking some major distros I decided to give Fedora 17 a more serious go and I have to say I did not regret it. “Mint” Linux, no clutter, bleeding edge (wow, finally including a mulit-monitor setup that seems to work). You could argue that setting up the system takes longer, because Fedora does not ship with things like proper multimedia support or propitiatory software like Flash, VirtualBox or Skype. I think that’s pretty kewl. You should understand why mp3 playback is not available out-of-the-box and that you have to explicitly install it at your own will.
Anyway, right now I am compiling a few Fedora 17 post installation tasks that will show there’s a bit more to do (no Gnome 3 extension installed by default – very pure indeed
), stay tuned.
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!
It’s always the same commands you tend to forget?
Tuesday, October 25th, 2011 | Linux, Tech-savvy | 2 Comments
It used to be the command for untaring a tar.gz file (xvzf is pretty easy to remember after all), but today I know that I am having the hardest time to remember the Linux find in files command. I always do it wrong and have to ask Google. This sucks. I hope by blogging about this (reverse psychology) I will never forget this find/xargs/grep expression again.
find . -name filename | xargs grep 'string' |
If you don’t need a recursive search a simple grep string filename will do as well. Writing this I am wondering if there is a recursive option for this simple command as well. Turns out there is one. How could I ever question this in the first place? I fell like a complete idiot now.
grep -r string filename |
This will do the job just fine and is far more easy to remember. Even if the first command looks kewler
Linux Mint 10: Common post installation tasks
Saturday, February 12th, 2011 | Linux, Tech-savvy | 3 Comments
I installed a few Mint boxes lately, mostly due to the release of Mint 10. You already get a lovely OS out of the box, but there are things I like to “fix” after an installation that others may like to do as well. Inspired by urfix‘s “25 command” posts (25 best Linux commands, plus even more 25′s listed in “popular posts”) I collected the x things to do after an initial installation. Have phun!
- Fix vi movement problem
- Install the nonfree version of VirtualBox (3.x) for USB support
- Change terminal colour scheme
- Enable .local name resolution for your M$ network
- Enable CP1252 in eclipse for your M$ originated source code
- make sure CP1252 is available
- open a new workspace
- close eclipse and edit .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
- restart eclipse
- start checking out CP1252 source code
- Enable (full) localhost name resolution
- Disable / cripple fortune
- Use SSH keys
Having trouble moving in vi’s input mode? Strange characters appearing when you try to move in your text? Try to disable the vi compatibility mode (yes, you are not using vi but vim):
echo set nocompatible >> ~/.vimrc |
If you need USB support do not install VirtualBox OSE but the nonfree version.
apt-get install virtualbox-nonfree |
After that, make sure your user is member of the virtualbox group, otherwise you won’t be able to access your USB devices.
As of version 4 of VirtualBox, Oracle decided to make the main VirtualBox software open-source, and now licenses a proprietary ‘extension pack’ containing the RDP server and USB support. I have not fiddled with this package yet.
The default white scheme is not easy on my eyes. Ouch! IMHO a terminal has to have black background (slightly transparent if you like) and grey (for the hardcore: green) text colour. It’s still a computer screen, right?
Trying to resolve some .local Windoze DNS lookalike? Try editing your /etc/nsswitch.conf file, change
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 wins |
to
hosts: dns files mdns4_minimal mdns4 |
I work at a company that mainly uses Windoze boxes. This is not an excuse not to use UTF-8 as your default encoding, but we have a lot of source code encoded with Windoze default encoding, namly CP1252. Still, its pretty easy to participate in the hacking using a *nix box:
locale -m | grep CP1252 |
encoding=CP1252 |
This may seem a bad way to solve the problem, because you can easily change your default encoding using Window -> Preferences -> General -> Workspace -> Text File Encoding, but guess what, CP1252 is initially not listed here. So you have to tell eclipse the hard way
Sometimes I need more names for my loopback interface than localhost or the real name of my box. In fact, as I am also an OpenCms developer, I have to have multiple localhost DNS names to access my multisite installation. OpenCms maps sites using DNS name. So, if you need to add some names to your localhost for local development, don’t add names using the IP4 loopback 127.0.0.1 but use IP6′s loopback, otherwise you won’t be able access your site with e.g. Firefox (even though a terminal’s ping works flawless using just the IP4 loopback).
Edit /etc/hosts
... ::1 silentbox localhost6.localdomain6 localhost6 *add-name-here* 127.0.1.1 silentbox *not-here* ... |
Only problem: restarting the system the network manager rewrites the file with default settings, thus deleting your precious changes. I still have to figure out how to solve this.
Just recently I was told “You will be divorced within a year.” I really don’t need that distraction. Mint doesn’t even bother to separate the offensive ones from the non-offensive ones.
vi /etc/bash.bashrc |
and then delete the following line or make it a comment
#/usr/bin/mint-fortune |
You could also delete just the fortune files you don’t want to be bothered with, they are located here: /usr/share/games/fortunes/
This is so common I almost forgot to mention it. Read about using SSH keys for authentication here (sorry, Andreas, I know you don’t like “here” links).
I know this list is highly personal, talking about colour schemes and pimping eclipse to work with CP1252 code. Still, some may find something of interest in this. Do you think a common set up task is missing? Just let me know, I am always keen to learn a new trick or two that enhances your every day computer work.
Installing Linux Mint 10 VirtualBox Guest Additions
Saturday, December 18th, 2010 | Linux, Tech-savvy | 3 Comments
I had some trouble installing the VirtualBox guest additions to my Mint 10 VM using the “standard” way (via the “Devices” menu). It failed setting up a proper X driver (Warning: unknown version of the X Window system installed. Not installing X Window system drivers). I was stuck with a 800×600 resolution.
After some research (and a few not so successful hints) I came across a pretty neat solution. Fire up your VM and simply install the guest additions using apt inside your VM:
user@vm ~ $ sudo apt-get install virtualbox-ose-guest-utils |
dkms and x11 packages will be installed automatically. Now restart your VM and your guest additions should be up and running … hopefully
Search
Categories
- (X)HTML/CSS (5)
- Activities (30)
- 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 (70)
- Tech-savvy (81)
Tag Cloud
Archives
- May 2013 (4)
- 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)
