Pages

22 April 2013

Scrobbling to libre.fm as seen by elinks


In my .bashrc you can find (among many others):
 # Export browser && homepage

 export BROWSER="elinks"
 export WWW_HOME="http://chalsattack.com"
Elinks is the heck of a console browser for many reasons: It is a full featured browser with few limitations, it has mouse support for following links and scrolling up and down and it has tabs like so many other graphical counterparts. And the best thing of it all is that it is so easy to use them that once you get used to them you just cannot do without.
t opens a new tab.
<> move between tabs.
c closes tabs.
Ctrl + r reloads a tab/page.
Nevertheless I must admit that I also use w3m on the tty if I need to see the pics andlynx for browsing gopherspace. One curious thing is that elinks does not support the gopher protocol out of the box. You have to compile it with gopher support in case you want to take advantage of it, but if you type a gopher url in elinks it automatically opens a lynx instance to display the gopher hole. Awesome :)
In this screenshot you can see my libre.fm page while I'm scrobbling with cmus as seen by elinks.


21 April 2013

Screenshot of the week 4


This is an screenshot of what my dual head desktop looks like on a typical weekend. (I must admit that it looks very much the same in my free time on a regular day).
You can see two small terminal emulators on the left. The one on top is in charge of taking the screenshot with scrot but before that it was running several of my aliases and functions. Specificallytt (or Terminal Title, alias tt='xfce4-terminal --geometry 90x55 -T $1') and aptget (alias aptget='apt-get update && apt-get --yes upgrade && apt-get clean')
The other small terminal is running cmus all day long in a tmux session and scrobbling to http://libre.fm
On the other terminal on the left side I am fixing fuzzy stings in a translation inside a git repository.
Now on the right side of the screen (the other head so to speak) there is irssi running in a screen session in my shell account at http://sdfeu.org
And last but not least, there is my homepage in the impressive lynx web browser. Here I'm lying a bit to you. I usually use elinks on the cli but it didn't look so cute for a screenshot. You can see the terminal title reads "elinks" but it is in fact "lynx".


17 April 2013

cmus

Throughout my relatively short (or long, it's hard to tell) experience with gnu/linux systems I have used a variety of console music players. If I remember correctly the first one I used, years ago, was music123, then mocmplayer...I had recently settled with nvlc because I found it very handy to start it on an ssh/tmux session to be able to control it from any corner of my network. See post on nvlc for details.
But now I have definitely and absolutely switched to cmus the single best console music player I know so far. Why?
Well, to begin with, I can still use it inside tmux or screen and use ssh to control it over the local network.



Secondly I can scrobble with it to http://libre.fm so that the songs I listen to are immediately published online.



cmus does not scrobble out of the box by itself. In order to make it scrobble I downloaded a script named last-cmus.py (linked from cmus official site) and modified it a bit. The process is pretty simple. Download the script to $HOME/.cmus, make it executable, edit username, password and url to use "http://turtle.libre.fm/". Finally, in cmus interface set status_display_program=/home/chals/.cmus/last-cmus.py


And last but not least. I can know which song I'm listening to at any time since it is echoed by conky.



Again, cmus does not directly communicate with conky. I had to download another script I found on the internet to make it work. Then I edited my .conkyrc adding this:
 ${color #ffcb48}Now Playing ${hr 1}

 ${color lightgrey}
 ${execi 2 /home/chals/Dropbox/bin/cmux-conky}
Notice that this time in order to make this setting more portable inside my own network, I added the script to my Dropbox folder so that I can access it from all my machines.


Awesome, huh!

14 April 2013

Tomato 2013

First tomato plant of the year.



09 April 2013

Clean (script)



I really do not know if this can be achieved automatically in a different/more effective way. The reason why I wrote this simple script is that I wanted to clean certain directories in my filesystem. The idea started with /tmp but I decided to include other directories such as the Trash bin.
What the script does is: One after the other, it tests whether the directories are empty or not. If they are empty it does nothing. If they contain files the script removes them, including the dot files.
BUGS: The script has, at least, one bug. Since it is set -e it stops after the very last iteration if there are hidden files in /tmp which cannot be removed if you run the script by hand as normal user. That is why I put /tmp in the last place. When it stops, all the other files are already deleted so it does not really matter whether it stops or not.
Why do I use set -e? Because I think that the rm -rf command toghether with a * wildcard is way too dangerous to let it loose.
Why keeping a log file? Because I can :)
Why to log ${DIR} is empty? This way I can adjust cron/anacron timing. For example, if I run it weekly and after a week the ${DIR} is empty, I may prefer to run it after two weeks or so. Do you get the idea? ;)
Why does the log file not include a list of all the deleted files? Who cares about the contents of Trash or tmp anyway? Especially after they have already been deleted.
Why not write a log function instead of redirecting the output to a log file?Because I'm too lazy to do that? Now seriously, the idea was in mind but the script is too simple to do that. Perhaps one day it will get better and grow bigger, and I do finally write that function then. (Note: That is not likely going to happen).
What is the best way to use this script? To tell you the truth, the best way to use this script is simply NOT using it. I mean that it really is very dangerous to remove files like that, hence the 'Big Fat Warning' on the header of the script. But still, if you want to give it a try, first read it, understand what the script does and adapt it to your needs.
Then, I recommend you add the script to, say, /etc/cron.monthly so that it is run by your system on a monthly basis.
Here is the script:
 #!/bin/sh

 set -e

 # Script to clean directories. The ls -A means that it does not list . & ..
 #
 # BIG FAT WARNING: rm -rf is potentially dangerous. Use this at your own risk!

 # Directories to clean.

 TRASH="/home/chals/.local/share/Trash/files" # Trash in Xfce
 DIR_TO_CLEAN1="/home/chals/tmp"
 DIR_TO_CLEAN2="/tmp"

 # Where to write the log file.

 LOG_FILE="/home/chals/clean.log"

 # Let's do it!

 for DIR in ${TRASH} ${DIR_TO_CLEAN1} ${DIR_TO_CLEAN2}
     do
         if [ "$(ls -A ${DIR})" ]
             then
                 rm -rf ${DIR}/* && rm -rf ${DIR}/.??* > /dev/null 2>&1 # Remove dot files too.
                 echo "$(date) Cleaning ${DIR} :) " >> ${LOG_FILE} 
             else
                 echo "$(date) Nothing to be done, ${DIR} is empty :( " >> ${LOG_FILE}
         fi
     done

07 April 2013

Potato

The first potato plant of the year in the kitchen garden.


Mona 2013


On Easter Monday we celebrate Mona's day. The tradition is going out to the countryside and have a picnic with our families and/or friends.

We have lunch and eat an special cake called The mona, hence the name of the celebration. The cakes often include the traditional chocolate eggs and these beautiful coloured feathers.

This year, we did go out to the country but it was really windy and we had to eat inside the cottage by the fireplace but on the bright side we had two cakes this year, one for each nephew