Check spelling on multiple LaTeX files using multiple languages

Consider that you have several directories and sub-directories, e.g., the organization of a thesis document in which each chapter has its own directory and several .tex files. And your goal is to check the spelling on all the .tex files in this tree of directories, recursively. Moreover, you want to check the spelling in different languages, some circumstances require that, such as the abstract of the thesis was written in multiple languages. Here is my approach for that, explained step-by-step:

First, in order to check the spelling, we are going to use aspell. Therefore, we rely on its dictionaries, which are packeged on Debian as aspell-[language], e.g., aspell-fr is the package for French dictionary. Install the packages referent to the dictionaries you want. To check which language dictionaries you have installed do:

aspell dump dicts

Then take note of those you gonna use, we gonna need them later on.

Now, back to our .tex spell check. First, lets get the content of all the .tex files, from here on lets consider you are in the root directory of your document’s tree:

find . -name '*.tex' -exec cat {} \;

Second, to spell check the words from text that resulted from the command above using, at the same time, many languages, for example, English from US and Brazilian Portuguese , we use aspell as following:

aspell --lang=en_US -t list | aspell --lang=pt_BR -t list

the -t indicates that we are going to check LaTeX files, i.e., to discard its directives and the list parameter outputs the words that were not found in the dictionary.

A final touch would be write to a file only unique instances of the misspelled words alphabetically sorted, thus the whole command is:

find . -name '*.tex' -exec cat {} \; | aspell --lang=en_US -t list | aspell --lang=pt_BR -t list | sort -u > typo.txt

Now you can proofread the typo.txt file and see if there are problematic words in there.

Wifi Disconnects and it is Unable to Reconnect, “device not ready” on Debian and Ubuntu

On both Ubuntu and Debian I’ve faced a problem with the Wifi that would get disconnected and would not be able to reconnect. On some circumstances, even brand-new Debian Jessie, Network Manager 0.9.8 would show a “device not ready” message instead of a list of wireless networks.

On both Debian Jessie and Ubuntu 10.04 I’ve solved that by removing and reloading modules, though different modules were targeted.

Ubuntu 10.04 (and it will probably work for newer versions):

sudo rmmod iwlagn
sudo rmmod iwlcore
sudo modprobe iwlcore
sudo modprobe iwlagn

Debian Jessie

rmmod iwlmvm
rmmod iwlwifi
modprobe iwlmvm
modprobe iwlwifi lln_disable=1 swcrypto=1

Installing Moodle 1.9 in Ubuntu 12.04

Step 1: Install and set up MySQL

  • sudo apt-get install mysql-server (assuming password ‘123456’)
  • mysql -u root -p123456
    • CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    • GRANT ALL PRIVILEGES ON moodle.* TO moodleuser@localhost IDENTIFIED BY ‘123456’;
    • GRANT SELECT,LOCK TABLES on moodle.* TO moodlebackup@localhost IDENTIFIED BY ‘123456’;
    • QUIT

Step 2: Install Apache

  • sudo apt-get install apache2
  • sudo gedit /etc/apache2/httpd.conf
    • ServerName localhost
  • sudo chown -R www-data:www-data /var/www/
  • sudo /etc/init.d/apache2 restart

Step 3: Install PHP

  • sudo apt-get install php5-ldap php5-odbc
  • sudo apt-get install libapache2-mod-php5 php5-gd php5-mysql

Step 3: Install Moodle

  • cd /var/www
  • sudo wget
  • sudo tar -zxf moodle-latest-19.tgz
  • sudo mkdir /var/www/moodledata
  • sudo chown -R www-data:www-data /var/www/moodledata
  • sed -i ‘s:/var/www:/var/www/moodle:g’ /etc/apache2/sites-available/default
  • sudo /etc/init.d/apache2 restart
  • sudo chmod -R 755 /var/www/moodle/
  • sudo chown -R www-data:www-data /var/www/moodle

Step 4: Set up Moodle


How to creates a free micro instance at Amazon

Step 1: Creates your AWS account

  1. Enter in
  2. Creates an Amazon account, the same used to purchase books (requires a valid credit card)
  3. 3. Completes the form..
  4. Verifies your telephone

Step 2: Creates a micro instance

  1.  Enter in
  2. Goes in ‘Account’ > ‘AWS Management Console’
  3. Click in EC2 (default hostage: US East N. Virginia)
  4. Click in ‘Launch instance’
  5. Select ‘Classic Wizard’
  6. Choose an image (Ubuntu 12.04 LTS)
  7. Selects instance ‘T1 Micro, 613MB Free Tier’ (On demand)
  8. Skips Advanced Instance Options (choose specific kernetl or RAM disks)
  9. Storage (8 GB)
  10. Skips Tags
  11. Createa key pair named ‘microaws’ (do NOT proceed without a Key Pair)
  12. Skips configure firewall (which will creates group quick-start-1, allowing SSH at 22)
  13. Review instance info and
  14. Launch it

Step 3: Access instance via ssh

  1. Change key pair file permission
    • chmod 600 microaws.pem
  2. Connects to remote host:

Step 4: Enables port 80

  1. Enter in
  2. Goes in ‘Account’ > ‘AWS Management Console’
  3. Click on ‘Security Groups’
  4. Select group ‘quick-start-1’
  5. Click on tab ‘Inbound’
  6. Add rule > Create a new rule > HTTP
  7. Apply Rule Changes
  8. Tests port 80
    • telnet <EC2-HOSTNAME> 80


ADB List of Devices “???????????? no permissions”

Suddenly ADB was not listing my device, and everything I could see with “adb devices” was a bunch of interrogation marks and “no permissions”. It happens while I was coding an Android application with Eclipse.

To solve that go to your “android-sdk-linux” directory, mine is on my home, therefore:

cd ~/android-sdk-linux/platform-tools
./adb devices
List of devices attached
????????????	no permissions # ok, lets fix it

./adb kill-server
sudo ./adb start-server
./adb devices
List of devices attached 
0D3AACA1DDE1001C	device # and here is our device!

That is it.

Twitter Stream Mysterious 401:Unauthorized Status with Oauth and Clock Issue

I’ve been facing the following problem with Twitter Stream while using Python: The REST API was working fine, but the Stream API was returning me 401:Unauthorized.

Both, REST and Stream were working fine when using curl with the command provided by the Oauth tool, but while I was trying to make it work with Python, I was not being successful at all, only receiving the 401-thing. At that point nothing seemed to be strange, the response header was:

Content-Type: text/html
WWW-Authenticate: Basic realm="Firehose"
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 1505
Connection: close

After 2 months struggling with that problem, I discovered that Twitter API will return 401 if your clock is not synchronized. To solve this you need to execute ntpdate. On Ubuntu you can execute the following command:

sudo ntpdate

and I guess that you will be able to connect with the Twitter Stream again. On the end, I discovered that this happened because I’ve moved to a different country, and I changed only my clock, without changing my Zone Time. I discovered this because the hour on my clock changed to the one from my home country when I used ntpdate. If this is your case, and you are using Ubuntu, change your Zone Time with the following comand:

sudo dpkg-reconfigure tzdata

Well, I learned a bunch of things in a row🙂

Unknown or ambiguous terminal type; type just ‘set terminal’ for a list

This appeared when I tried to “set terminal pdf” on Gnuplot. Im using Ubuntu 10.04.  Making the long story short, I needed to install the Maverick (10.10) packets for Gnuplot.

The direct links for those packages, depending on the arch, are amd64, gnuplot-nox and gnuplot-x11. For i386, gnuplot-nox and gnuplot-x11. Download, install and the same output should be something like

gnuplot> set terminal pdf
Terminal type set to 'pdfcairo'

and that is it!