Archive for noviembre 2012

15/11/2012

My Stellaris Launchpad finally arrived. I’ve been following this tutorial for programming it on Linux successfully.

However, I was annoyed at having to run the flashing utility as root. So I created a udev rule that gives the board’s device file the proper permissions. First, create a group called stellaris and add yourself to that group:
sudo addgroup stellaris
sudo adduser $USER stellaris

Then create the udev rule. Create the file /etc/udev/rules.d/45-stellaris.rules with the following contents:
ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="0664", GROUP="stellaris"
What does this mean? This line consists of key-value pairs separated by commas.

  1. The first two are match keys: when something is plugged in, udev checks if its vendor and product IDs match the ones here.
  2. The last two are assignment keys: if there’s a match, the device file is created with the specified permissions and group. These permissions mean that the owner (root) and members of the the group stellaris can read from and write to the file, while others can only read.

You might have to restart your terminal in order for it to recognize you’re now in the stellaris group. You can also run
exec su -l $USER

Collaborative latex editing with Dropbox and inotifywait

10/11/2012

I’ve settled on this workflow for writing lab reports in a group:

  • We share a folder with Dropbox that holds the measurements and report files (graphs, latex source files).
  • To prevent collisions we use separate .tex files for different sections, and split the sections between group members.
  • To make sure the output is consistent, only one person compiles the PDF. Inspired by this blog post I wrote a short script to build the PDF whenever a file changes:
#!/bin/bash

while true
do
    echo Compiling
    pdflatex -interaction nonstopmode -file-line-error informe.tex &>salida.log
    inotifywait -e modify -r .
done

Previously I’d tried running

make

in a loop (it only compiles if one of the input files changed). However, this script automatically checks all files for changes, without having to add them to a Makefile.