What class do we have next?

Timetables are one of the things my University just doesn’t get right.

You have to go on the website every now and then to either download your timetable as PDF, or export in iCal format if it’s available. But those aren’t going to be up to date if the timetable changes, and you’ll have to start over.

Up to now, there was always someone to come up with a system to provide an iCal link you could add to you calendar, which would always be up to date. This year however, the other year’s solutions are either down, or not updated for this school year… So I decided to give it a shot!

Since I know it’s possible to generate an ics from the website, I was hoping it would be possible to just call an URL and be done with it. Well, it’s not so simple; this solution doesn’t provide anything useful.

So I searched the web, and found some source code for some previous projects that access the same timetable software as me (ADE Campus).

One solution that came up, was to mimic a user interaction to generate the calendar. This ended up being kinda clunky, and didn’t really work well. Also I had no idea what I was doing.

The best solution however, came from some project who was kind enough to share their code on Google code, and it turns out ADE has a web API which is however undocumented.

This way, after getting a session key and setting a project (~school year) to use, we can retrieve XML data for a given resource (class/group).

Then it’s simply a matter of parsing the XML and creating an iCal with the extracted data.

I’ve again set up a cron job to generate the calendars every day; Once the calendars are uploded to the net, we can add their URL to our Google Calendar, and have an up-to-date timetable right on our phone!

Calendars can be found here: stic.imnotacyb.org
GitHub repo is here: github.com/JohannDickson/UDS_edt

 Update (20/01/14)
The University –finally– officially supports the export of calendars from ADE in a way that’s useful.

Posted in Software, University | Leave a comment

Jabber server with Prosody

Update: If you use Puppet, I’ve written a module for Prosody which can be found here: https://forge.puppetlabs.com/JohannDickson/prosody

I’ve recently installed a Jabber server for use within my family, it’s a great way for us to communicate since we’re split among different places, don’t really use Skype or other, and it can be more convenient than SMS or email.

So I figured I’d keep track of my installation steps, and share them here.

In preparation, you will need to set up the following DNS records:

jabber.imnotacyb.org A ...
_jabber._tcp.imnotacyb.org CNAME jabber.imnotacyb.org
_xmpp-client._tcp.imnotacyb.org CNAME jabber.imnotacyb.org
_xmpp-server._tcp.imnotacyb.org CNAME jabber.imnotacyb.org

Also open the following Firewall ports:

TCP 5222
TCP 5269


apt-get install prosody lua-sec

I’m not going to be using ‘localhost’ configuration, so I’ll remove its configuration and keys:

cd /etc/prosody
rm conf.d/localhost.cfg.lua
rm certs/localhost.cert certs/localhost.key

Create new configuration file, based on existing example:

cp conf.avail/example.com.cfg.lua conf.avail/imnotacyb.org.cfg.lua

Certificate creation:

openssl req -new -x509 -days 365 -nodes \
 -out jabber.imnotacyb.org.crt \
 -keyout jabber.imnotacyb.org.key

Fill in the info, then put the keys in their proper location (/etc/prosody/certs/)

Modify your generic (virtualhost defaults) values in prosody.cfg.lua

nano prosody.cfg.lua

Here are the general changes I’ve done:

ssl = {
    key = "/etc/prosody/certs/localhost.key";
    certificate = "/etc/prosody/certs/localhost.cert";
--c2s_require_encryption = false
--s2s_require_encryption = false
c2s_require_encryption = true
s2s_require_encryption = true
authentication = "internal_plain"
authentication = "internal_hashed"

I also removed everything to do with the virtualhost and components, as these will be added on a per-site basis.

You can set your virtualhost configuration in prosody.cfg.lua if you want, but I prefer to make a separate virtualhost file:

nano conf.avail/imnotacyb.org.cfg.lua
-- jabber.imnotacyb.org

VirtualHost "jabber.imnotacyb.org"

-- admins = { "johann@jabber.imnotacyb.org" }

ssl = {
    key = "/etc/prosody/certs/jabber.imnotacyb.org.key",
    certificate = "/etc/prosody/certs/jabber.imnotacyb.org.crt",

modules_enabled = {

groups_file = "/etc/prosody/imnotacyb.org_groups.txt"

Component "conference.jabber.imnotacyb.org" "muc"
    name = "imnotacyb.org Conferences"
    restrict_room_creation = true

Create a symlink in conf.d to enable the virtualhost, then (re)start prosody.

Create the user accounts:

prosodyctl adduser johann@jabber.imnotacyb.org

Or for batch registrations:

prosodyctl register johann jabber.imnotacyb.org secretpassword

I’ve defined a file for groups, here’s what it looks like;

[Test group]

[Test group] is the name of the group; putting a + in front of the name ( such as [+Test group]) will make it a public group, viewable by everyone registered on the server.

In this example, a user will see the contact list as such:

Test group

Basically, if you put a name after an address (and an = sign), the users will see that name, instead of the jabber address.

You can now do the following command to reload the server configuration:

service prosody reload

And connect using your favourite client. I personally use Pidgin on Windows, and Xabber on Android.

Posted in Linux, Software | Tagged , , | Leave a comment

What’s for lunch?

One thing that’s nice to know when you’re a student, is what’s for lunch at the university restaurant.

In that regard, I looked for a way to easily generate an iCal of the week’s menu. First step: scour the CROUS Grenoble website in search of the menu, because I know it’s there somewhere.

Turns out, they have the menu for the current week in .png, .pdf and an RSS feed. They also have the one for the following week, but not in RSS.

So, I started to think about how I could automate the process, and considering that BASH might not be the best for this and that I wouldn’t go about scripting in PHP, I decided to take a shot at Python.

Second step: learn some Python, analyse the RSS feed structure and get this working.

The way I’ve basically done it, is to import and parse the RSS feed, then since each item in the feed corresponds to one service (day, lunch/dinner) it’s only a matter of creating a calendar event for each one (with first parsing the date, day and service). I filter out Friday evening, and both Saturday and Sunday, since there’s never any service then. Thursday evening seems to always be at the other restaurant, but I’m not sure.

Overall, it took a small afternoon to get it all worked out, it was quite fun to work on a little project like this. I guess as long as they don’t change the structure of their feed then it should all work fine. Because the feed seems to update at 00:00 on Mondays, I’ve also set-up a cron script to check it a few times around then, and once we’ve got the new one it’ll send it to stic.imnotacyb.org/menuRU.ics. I’ve also learned a bit of how to use Git and GitHub, so the repository for this project can be found here: github.com/JohannDickson/UDS_menuRU.

Posted in Software, University, WebDev | Tagged , , , , , | Leave a comment

Kindle Screensavers

I have a Kindle. It’s a great device, it got me back into reading and I now have a bit more and better to do than just browse the same old stuff on the internet on my down time.

One feature that’s really too bad it isn’t included by default is custom screensavers. Luckily, it’s quite easy to bypass this limitation! So here’s quick guide how to do it..

Tried and tested with Kindle 4, Firmware 4.1.0

  • Connect Kindle to computer (USB)
  • Create file at Kindle root called “ENABLE_DIAGS” (no extension)
  • Eject Kindle
  • Go into settings menu, and note your Firmware and Serial ID, if you miss this you can still find them later in the diagnostics menu → device settings
  • Press menu (from settings page), and restart

Now that we are in diagnostics mode…

  • misc individual utilities
  • > utilities
  • > enable USBnet

At this point, your PC should install the appropriate drivers. If not, re-plug the Kindle.

  • Go to your network connections, there should be a new one
  • Give it an IP of
  • Use PuTTY to connect to

Use this tool: http://members.ping.de/~sven/kindle.html to find out your root password /!\ the serial is case-sensitive!

enter the following commands:

mntroot rw
mkdir /mnt/us/screensaver
mount /dev/mmcblk0p1 /mnt/base-mmc
mv /mnt/base-mmc/opt/amazon/screen_saver/600x800 /mnt/base-mmc/opt/amazon/screen_saver/600x800.old
ln -sfn /mnt/us/screensaver /mnt/base-mmc/opt/amazon/screen_saver/600x800
mntroot ro
  • exit the session (type exit, or close the window)
  • On the Kindle, go back to main menu
  • Exit, Reboot or Disable Diags → disable diags
  • Exit, Reboot or Disable Diags → reboot

Your Kindle will now reboot, and when connected it will have a folder called ‘screensaver’.


  • Images are 600*800
  • There must be a 01N.png (for future firmware updates)
  • Restart after sending new screensavers (otherwise it will blank screen instead of screensaver)


Posted in Uncategorized | Tagged , | 1 Comment

tmux cheat sheet

I’ve recently started using tmux, so here’s my cheat sheet to remember some of the basic commands:

tmux new -s bob  create new session called ‘bob’
tmux attach (at) -t bob  attach session ‘bob’
tmux list-sessions (ls)  list sessions

Ctrl + b is the action key
$  rename session
c  new window
,  rename window
&  kill current window
x  kill current pane
↑/↓/←/→  go to pane
"  split horizontally
%  split vertically
c  new window
d  detach session
l/n  last/next window
0-9 select window
?  help
: command prompt

In command prompt:

resize-pane -{D|U|L|R} 10  resize pane in direction by 10

Posted in Linux, Software | Tagged , , , | Leave a comment