Archive for June, 2011

Play the first 30 seconds of a song with mplayer

June 30, 2011 Leave a comment
mplayer -endpos 00:00:30 song.mp3

I have an alarm script that loads a bunch of MP3s and starts playing them in random order in the morning. However, some songs are very long, some of them are boring, etc. So I prefer playing just the first X seconds of each song.

This tip is from here.

Categories: Uncategorized Tags:

Gmail’s new feature: people widget. How to disable it?

June 29, 2011 Leave a comment

Gmail introduced a new feature called “people widget” that I find extremely annoying. How to get rid of it?

Go to Settings (click on the gear in the top right corner and select Mail settings). Under the General tab, you will find the People Widget. Hide it.

In this post, among the comments, you can find some alternatives. Maybe I will try them once.

Categories: google Tags: , ,

Enable insults in sudo

June 13, 2011 Leave a comment

When you use sudo and you mistype your password, you can receive some insults :) Here is how to activate it:

  • sudo vi /etc/sudoers
  • find the line that starts with “Defaults” and append “insults” to the end of the line. Mine looks like this: “Defaults env_reset,insults” (without quotes, of course).

If you want to test it, just mistype your sudo password. Have fun :)

This entry is based on this post.

Categories: bash, fun, ubuntu Tags: , ,

Remove comments from a LaTeX file

June 13, 2011 2 comments

I had to remove all the comments from a LaTeX file.

LaTeX comments start with ‘%‘. It was enough to remove comments that start at the beginning of a line.

cat file.tex | grep -v ^%

(Yeah, I know, it’s two processes, but I prefer like this…)

If your comments start with ‘#‘, use “cat file | grep -v ^#“.

Categories: bash, latex Tags: ,

Over 20.000 visitors

June 1, 2011 2 comments

From 0 to 10,000, it took 8 months. From 10,000 to 20,000, it took 1.5 months. Wow, thanks! :)

Categories: Uncategorized Tags:

Get the public Dropbox links of several files

June 1, 2011 1 comment


When you install Dropbox, you get a Public directory. It has the advantage that if you put a file in it, you can get a public http:// link on it, thus sharing files with your friends is very easy. To get the public link, just navigate to the file in Nautilus, right click on the file, then Dropbox -> Copy Public Link.

However, if you want to share several files, getting their public links via Nautilus can be a PITA. How to get the public links for all the files in the current directory?


I made a simple Python script for this task. It can show the public link of (1) one file, or (2) all files in the current directory.


$ get_public_link
$ get_public_link -a

If you want to copy the links to the clipboard, combine it with my tocb script:

$ get_public_link | tocb


The script (together with is available here, in the dropbox/ folder.

Categories: bash, python Tags: ,