Recovering deleted files

Today I accidentally deleted all files in my /home/Documents directory and had to recover some of them.
Luckily, there’s an easy way with the extundelete program.

First of all, umount the target partition:
sudo umount /home

Note: if you get the ‘device is busy’ message, you can add the lazy option:
sudo umount -l /home

Then install extundelete (if you don’t have it already):
sudo apt-get install extundelete

Now recover the files that were deleted from that directory, for which you need to specify the mount point (use df -h for that):
sudo extundelete --restore-directory /home/Documents /dev/sda5

This will create a RECOVERED_FILES directory with all the file structure of the deleted directory, containing the files that could be restored.

Finally remount the target partition:
sudo mount -o remount,rw /dev/sda5 /home

That’s it!

Advertisement

How to check processes bandwidth consumption

With nethogs you can monitor network bandwidth usage on a per-process basis. Just install it from source to avoid a socket error:
wget -c https://github.com/raboof/nethogs/archive/v0.8.5.tar.gz
tar xf v0.8.5.tar.gz
cd ./nethogs-0.8.5/
sudo apt-get install libncurses5-dev libpcap-dev
make && sudo make install

And execute it as sudo, pointing to the network interface you wish to monitor, for instance:
sudo nethogs wlan0

nethog

Human or Machine?

favicon

We’re conducting a quick survey in order to (sort of) replicate a previous study on digital signatures¹ but this time focused on stroke gestures. Can you guess which gestures were drawn by a human and which gestures were drawn by a machine? The test can be completed in 30 seconds or less, at the end of which you’ll see your score. So, how well did you perform?

____
¹ Galbally, J., Plamondon, R., Fierrez, J., Ortega-García, J., 2012. Synthetic on-line signature generation. Part II: Experimental validation. Pattern Recogn. 45 (7), 2622–2632.

Enabling SSL in Nginx

Last year I quickly commented how to enable SSL on Apache. Now I’ll do the same for Nginx, which has been my primary HTTP server choice since then, BTW.

First, create the certificates:
cd /etc/nginx/
sudo openssl genrsa -out localhost.key 1024
sudo openssl req -new -key localhost.key -x509 -out localhost.crt
sudo chmod 600 localhost.*

Then edit /etc/nginx/sites-available/default and put the important parts:
server {
listen 443 ssl default_server;
ssl_certificate /etc/nginx/ssl/localhost.crt;
ssl_certificate_key /etc/nginx/ssl/localhost.key;
}

Finally reload Nginx:
sudo service nginx reload

That’s it!

PS: These tips are for development pruposes. In production you’ll need a chained certificate (aka certificate bundle).

How to use Type 1 fonts in a multilingual LaTeX document

Recently I had to deal with a font encoding issue in our MobileHCI’14 paper about phrase sampling methods. The thing is that we wrote some example sentences in 10 different languages, and LaTeX seemed not to like the Russian ones to begin with.

The first approach was to put this in the preamble:

\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}

This generated a “valid” PDF via pdflatex, although it was using Type 3 fonts. So I received a kind email from Sheridan Printing (Lisa M. Tolles, we miss you!) saying that Type 3 fonts are not allowed in material appearing in the ACM DL. The paper must use exclusively Type 1 fonts.

Therefore I had to google for a while until finding the following solution. BTW, this was tested on Ubuntu 14.04 with Tex Live 2013.

First, install the UCS package:

sudo apt-get install texlive-latex-extra

Then put this in the preamble:

\usepackage[T2A,T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[russian,english]{babel}
\usepackage{pslatex}

And enclose with \textcyrillic{} the corresponding text.

Finally, you can proceed this way:

latex file.tex
dvips -P pdf -o file.ps file.dvi
ps2pdf file.ps

That’s all, folks!

Spain, no country for postdocs

It’s been about two years since I got my PhD from the Universitat Politècnica de València (UPV) and nothing has changed, research-wise. I was hired in tranScriptorium as research support staff, where I keep doing the same things as before graduation. Don’t get me wrong, I love what I do and am pleased to work with a really competent and skilled team at the PRHLT research center. However, at the UPV there are no possibilities of promotion or tenure. Not at all. And it seems to be the case for most of Spanish universities as well.

Gone are the glory days when your PhD gave you direct access to a tenure track. Currently, Spanish researchers who retire are no longer replaced. That’s insane. As a result, the vast majority Spanish postdocs are basically wasting their time. This is the fate of most people that get their PhD today in Spain. Simply put, Science is not a priority in Spain.

I don’t know what would be the best solution for this pressing problem. Moving to another country? Perhaps, but this decision should be optional for the brave postdocs, not mandatory because they have no choice. Actually, this is leading to a massive brain drain, which is bad for science and therefore bad for everyone. Running a startup or a spin-off? Perhaps (actually that’s what I did), but not all researchers are ready for entrepreneurship. In my opinion, good researchers should be given the opportunity to get some kind of internal promotion. For instance, being able to lead some research project or appearing as principal advisor in master’s theses, PhD theses, or final degree projects.

PS: As a side effect of all of this, there are many departments filled with affluent peers that no longer do research. But that’s a story worth of another blog post.

Enabling SSL in Apache

Recently I had to do this task twice in the last month at different localhosts, so I’m writing this post as a personal note (all this blog is meant to be a sort of memo book, though).

This mini-guide is heavily based on pradeepchhetri’s answer on stackexchange and this tutorial from 2012, so credit goes to them.

First, create the certificates:
cd /etc/apache2/
sudo openssl genrsa -out localhost.key 1024
sudo openssl req -new -key localhost.key -x509 -out localhost.crt
sudo chmod 600 localhost.*

Then edit /etc/apache2/sites-available/default-ssl and put the important parts:
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/localhost.crt
SSLCertificateKeyFile /etc/apache2/localhost.key
</VirtualHost>

Finally activate SSL and reload Apache:
sudo a2enmod ssl
sudo a2ensite default-ssl
sudo service apache2 reload

That’s it!

PS: These tips are for development pruposes. In production you’ll need a chained certificate (aka certificate bundle).

On link removal requests

I use to receive tons of spammy emails weekly. Thanks to email filters most of the spam stuff is automatically redirected to /dev/null. However, some time ago I received one that looked presumably legit–Note: I’ve anonymized it to preserve the identity of both parts.

Dear Webmaster,

It has come to our attention that your site contains backlinks to <awesome_company>. As part of an ongoing link clean-up and proactive link profile management program for the company, we have identified that these links that point to our URL are violating Google’s link quality guidelines and also our internal link guidelines.

Therefore could we please have these links removed at your earliest possible convenience. They are located at the following URL’s.

<one_url_at_one_of_my_websites>

If you would like help on getting these removed please do not hesitate to contact us directly through this email. If no action is taken we will be adding your site into our Google disavow file which helps Google to better combat web spam and also effectively cuts the link between your site and ours.

Please advise us if you have been able to successfully remove the links. We really appreciate your effort and urgency on this issue.

Regards,
Name – <awesome_company>

So this looked like legit to me at first. But then I realized that it was someone from that company who put that link on one page at my website. Moreover, a quick Internet search revealed a number of interesting write-ups:

In the end I did nothing. I don’t know what happened, but honestly I don’t care. Let the Internet take its natural, chaotic course.

How to give a scientific presentation

Recently I stumbled upon an excellent compendium of tips and advices for giving a scientific presentation. Since I can’t agree more on the vast majority of the contents covered there, I’m just sharing the link to the PDF document. Credit goes to by Kevin D. Lafferty.

The document also covers 3 types of presentation outlines: paper, essay, and plot. So even if you work outside academia you would benefit from paying attention to those advices.