You can use the Inkscape extension Tex Text to insert and render LaTeX within your Inkscape graphics.

You can find the latest version here. I'll include all the commands I ran below to get this up and running with the current latest version of Tex Text and Inkscape 0.91 r13725

wget http://pav.iki.fi/software/textext/textext-0.4.4.tar.gz

tar -xvzf textext-0.4.4.tar.gz

cp textext.inx textext.py .config/inkscape/extensions/

Restart inkscape (if required).

Within Inkscape and you can find the new extension under Extensions > Tex Text.
Type in some LaTeX text and it will insert the rendered text into your document.
This was posted on Fri 08 Jan 2016 (3 years, 5 months ago) by Ryan McConville
I have a lot of data and I would like to keep this data safe. For example, I have way too many pictures going back way too long, and I would like to keep these forever!

That means I need a good data backup strategy, and for this I have mostly settled on a combination of tools and scripts. Perhaps I'll write about my backup strategy in detail in the future. For this post it will suffice to say that the tool which handles the backup is duplicity (bonus, encrypted!) and one of the remote locations it backs up to is rsync.net, which I highly recommend.

So far, rsync.net can accept my data at the fastest rate I can push it. However this typically means that the rest of my Internet experience suffers when backups are running as my bandwidth is being saturated.
I had a little look around and came across a nice little tool called tricke which can limit the download/upload bandwidth of a process, all in userland!

It seems to be quite configurable but all I had to do was prepend 'trickle -u 800' to my backup scripts to limit duplicity to using at most 800Kb/s of my upload bandwidth. I quickly verified this with nethogs. Perfect!
This was posted on Fri 08 Jan 2016 (3 years, 5 months ago) by Ryan McConville
So QUB have begun rolling out a new WiFi solution across the campus, deprecating qub_sec.
The settings for _QUB_WIFI have changed, so for convenience sake I'll list them here.

EAP Method (Authentication): PEAP
Phase 2 Authentication: MSCHAPv2
Identity: student number
Anonymous Identity: leave blank
Wireless Password: your password

Unlike before, after the first time you connect to _QUB_WiFi you need to sign in via some sort of web based portal. Going straight to Google or Facebook won't work due to HTTPS, so try example.com in order to be redirected to the _QUB_WiFi sign in page.

I've tested this on my Linux computer and Android phone.
This was posted on Thu 07 Jan 2016 (3 years, 5 months ago) by Ryan McConville
Newsbeuter is an open source RSS feed reader for terminals.
It's great for quickly consuming lots of information from websites. One nice feature is that it allows you to 'bookmark' specific links, and that's where LinkiePie comes in.
LinkiePie is a personal project of mine for storing and organising links, somewhat like Pocket and Instapaper, and I would like to send my links directly from newsbeuter to it.
It has a basic API for externally accessing some functionality and accounts are automatically generated API keys. The following is a quick guide for sending your bookmarked newsbeuter links straight to your LinkiePie account.

The first step, of course, is to get a LinkiePie account. When you have registered check out https://linkiepie.com/settings/ to get your API key. This is all you need to programmatically add and retrieve your links with LinkiePie.

Next we will setup a simple script that will interface with newsbeuter. Save the following code in a convenient directory or download it from here.
#!/bin/bash
URL="$1"
USERNAME=YOUR_USERNAME
API_KEY=YOUR_KEY
curl -k -H "Content-Type: application/json" -X POST --data "{\"url\": \"${URL}\"}" "https://linkiepie.com/api/v1/links/?username=${USERNAME}&api_key=${API_KEY}"

Make sure to change YOUR_USERNAME and YOUR_KEY to your own details.
Assuming you have the script in a file called linkiepie-bookmark.sh and have placed it in your home directory, the next step is to update your newsbeuter config file (.newsbeuter/config) with the following:
bookmark-cmd "~/linkiepie-bookmark.sh"
bookmark-autopilot yes

The final step is to set the executable bit on the script so newsbeuter can execute it.
chmod +x linkiepie-bookmark.sh

Restart newsbeuter and try it out by pressing Ctrl+B with an article highlighted or selected. You should then see that article in your LinkiePie account along with an archived version of the important text.

You can retrieve your data from LinkiePie via the API as well. The following request will return the the url, title and extracted text from the links you've added.
https://linkiepie.com/api/v1/links/?username=YOUR_USERNAME&api_key=YOUR_KEY&format=json&limit=10&offset=0

The number of results returned for each request is controlled by the limit parameter and adjusting the offset parameter, which specifies where in the list of results to start from, will allow you to move between these sets of results.
This was posted on Tue 16 Dec 2014 (4 years, 6 months ago) by Ryan McConville
Using dbus and ConsoleKit it's easy to power off your computer from the terminal. This is useful when you're not using a desktop like GNOME or Unity and you want to shutdown without superuser privileges.

dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

Of course it's probably a good idea to create an alias for this rather long command.

alias turnoff='dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop'

For the sake of completeness you can also restart and suspend your computer using dbus and ConsoleKit.

To restart use:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

To suspend use:
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend


This was posted on Sun 30 Nov 2014 (4 years, 6 months ago) by Ryan McConville
I wanted to use the key combination 'Fn+F2' to lock my computer with xscreensaver, but wasn't sure how to represent this key combination in the awesome wm rc.lua configuration file. Unfortunately you can't just insert combinations using 'Fn' like you would 'Ctrl', instead you must use the relevant 'Fn' combination keycode.

It turns out that you can use a tool called xev to print out events such as keypresses that occur in a X11 window. Running xev and pressing the desired key combination will output to a terminal information for this event, including the keycode. Doing this I discovered that 'Fn+F2' translated into keycode 160.

Adding the following to the key binding section of my rc.lua worked great.
awful.key({}, "#160", function () awful.util.spawn("xscreensaver-command -lock") end),
This was posted on Fri 31 Oct 2014 (4 years, 7 months ago) by Ryan McConville
A quick and easy way get a readable version of a webpage directly from your terminal is to use the dump argument of the lynx text based web browser.

This is great for times when you are working from your terminal and want to view a website, for example to view a link received via IM, but would prefer not to leave your terminal to do so.

While tools like curl and wget will return the HTML file, including the HTML tags, lynx will parse it and return a much more readable version.

The following will output a readable version of this webpage directly to your terminal via stdout.
lynx -dump https://ryanmcconville.com/blog/

lynx

Sometimes you may want to save a readable copy of a webpage to a text file to read later. This can be done by redirecting stdout to a file.
lynx -dump https://ryanmcconville.com/blog/ > blog.txt

Lynx can also be used interactively for browsing the web by dropping the dump argument. For a program that predates the world wide web, it works suprisingly well on many modern websites.
This was posted on Thu 30 Oct 2014 (4 years, 7 months ago) by Ryan McConville
Sometimes I am running experiments on a remote computer but doing the analysis of the experiments on
a local computer. Rather than manually copying or periodically syncing the results data for analysis, it's easier to mount the remote directory locally so that the remote files can be treated as if they are on the local filesystem. SSHFS (SSH Filesystem)
is one such tool that allows you to do this. All you need is SSH access to the remote server and SSHFS installed on the client.

The following instructions were tested on Ubuntu 12.04.
apt-get install sshfs
Now that sshfs is installed we can use it to mount the remote filesystem locally. First we will make a directory where we would like the remote filesystem mounted.
mkdir ~/rfs
Now we use sshfs to mount the remove filesystem...
sshfs user@dest:/dir/anotherdir ~/rfs
..and lets check the contents of the remote directory we just mounted.
ls ~/rfs
If you want to unmount the remote filesystem you can do so with the following...
fusermount -u ~/rfs
This was posted on Wed 03 Sep 2014 (4 years, 9 months ago) by Ryan McConville
If you prefer Debian over Ubuntu (and Ubuntu derivatives) but like the appearance of Xubuntu, then here’s some steps for making Xfce on Debian Wheezy look a lot more like Xubuntu. These steps are far from complete, but they make it look close enough to the default appearance of Xubuntu for me.

I’m going to assume you already have Xfce installed. I typically do this during the Debian install procedure but if you didn't do that you can still replace the default GNOME desktop environment with Xfce. Here’s a nice overview of how to do both. The key to the appearance of Xubuntu is the Greybird Xfce theme that it uses by default. I prefer to get the latest version directly from the Github repository of The Shimmer Project rather than relying on potentially older packaged versions.

First let's get the theme itself.
wget https://github.com/shimmerproject/Greybird/archive/master.zip
unzip master.zip
su -c 'mv Greybird-master /usr/share/themes/'
rm master.zip


Now, let's get the Greybird icons.
wget https://github.com/shimmerproject/elementary-xfce/archive/master.zip
unzip master.zip
su -c 'mv elementary-xfce-master/* /usr/share/icons'
rm master.zip


The next step is to enable the theme. First go to Settings->Appearance and select 'Greybird-master' under the 'style' tab. Then under the ‘Icons’ tab select 'elementary Xfce dark'. Under the 'fonts' tab I typically enable anti-aliasing, set hinting to slight and set the sub-pixel order to RGB.

After doing this, you should be seeing a theme that looks similar to Xubuntu, but not quite. The next step is to go to Settings->Window Manager and under 'style' select 'Greybird-master'.

After doing this I find that my Debian installation looks close enough to Xubuntu for me, and certainly much better than the rather dated default Xfce theme.

screenshot
This was posted on Sat 19 Jul 2014 (4 years, 11 months ago) by Ryan McConville
As part of my research I tend to be working with relatively large files. One 150GB file I work with particularly often involves moving an updated version of it from one directory to another. On my Ubuntu desktop this causes everything to become unresponsive for the duration of the transfer.

One solution to this is ionice which lets you set the IO priority of processes. It's kind of like regular nice but for IO specifically. I found that the follow command, which sets the scheduling class to be 'Idle', let my desktop remain completely responsive while the transfer was taking place.

ionice -c 3 cp $src_file $dst_directory
This was posted on Tue 24 Jun 2014 (4 years, 11 months ago) by Ryan McConville
Recently I got an Acer C720 Chromebook and wanted to write a little bit about what I think of it. Basically, it's a small 11.6 inch screen laptop but instead of running a more typical operating system such as Windows 7 or Debian/Ubuntu (more on that later), it runs an operating system from Google called ChromeOS. To the user, it's pretty much just the Chrome web browser with some basic but nice operating system type features around it, such as a lock screen and notification area. While the world seems to be heading towards a cloud-based-always-online type environment, I'm not so keen on that idea on my own personal computers. So why did I get it? I got it because of its low price point (~£200), good battery life, good build quality, and its ability to run a more conventional operating system such as Debian or Ubuntu.

First, the build quality feels very good for the price point. I have used laptops that cost twice the price but don't feel as well built. It has a very plain appearance, definitely not as quirky and fun as it's competitor the HP Chromebook 14, but that's a positive for me. It's weighs just over 1.1 kg, which is a nice change compared to my older laptop that weighs about 2.7 kg. So while I may notice and appreciate the lightness more than some, I find it very portable. The 11.6 inch screen has a resolution of 1366x768 so while the pixel density for the screen size is pretty good, the quality of the display itself leaves a lot to be desired due to the dull washed out colours and poor viewing angles. The battery life on the C720 is fantastic however and I'm getting around 8 hours of use on a full charge, not much less than Acers claimed 8.5 hours.

To be honest, I haven't spent very much time in ChromeOS since my current way of working just doesn't fit into the web based workflow that ChromeOS kind of forces you to have. However, what I did see in the short time I used it was promising. The experience was smooth and everything worked nicely. I would have no hesitations recommending it to someone who doesn't need access to a more traditional operating system. However not using ChromeOS much doesn't mean I haven't been using the C720 chromebook much! In fact, it's quite the opposite. One of the first things I done when I unboxed it, after a quick tour of ChromeOS, was setup Ubuntu using crouton.

Crouton is a set of scripts that makes setting up a chroot extremely easy. If you aren't familiar with what a chroot is, don't worry. Crouton has abstracted away all of the messy details and all you really need to know is that it's a way of getting another Linux distribution running on your chromebook. It requires enabling 'developer mode' and you can do this by holding down esc and refresh and then pressing the power button. This puts it into 'recovery mode' and if you press CTRL+D at the recovery screen, you will reboot into ChromeOS with developer mode enabled. This process wipes all user data stored on the device including ChromeOS user accounts. Once you are running ChromeOS with developer mode enabled you can follow the instructions found in the README in croutons github repository to get your new operating system up and running.

However a brief overview of the steps required is as follows:
Download the crouton script from the following URL: https://goo.gl/fd3zc This will save to your 'Downloads' directory.

Open a crosh shell using CTRL+ALT+T in ChromeOS and then type shell. Note this only works in developer mode.

Now type sudo -e ~/Downloads/crouton -r precise -t unity -e .

This will install the 'precise' release of Ubuntu with the Unity desktop. The final -e switch encrypts the chroot.

Simply running sudo -e ~/Downloads/crouton will provide you with more information, including how to find out about other releases that you can install.
The rest is pretty much automated and after it's complete you will have your chroot setup.

I typically enter my chroot with the command sudo -b startunity. The -b switch backgrounds the process so you can close the ChromeOS tab.

You can switch between the chroot and ChromeOS with CTRL+SHIFT+LEFTARROW and CTRL+SHIFT+RIGHTARROW.

Since the C720 has a x86 CPU, it doesn't suffer from having a restricted set of applications like ARM based chromebooks when running an OS like Debian. The C720 contains a dual core 1.4GHz Celeron CPU (2955U) with the current generation Intel Haswell microarchitecture making it an efficient and capable little device. So while I won't be keen to run any very intensive tasks on it, due to the limited 2GB of RAM and 16GB of SSD storage, it can run pretty much all of the applications you would expect.

While using crouton does have a negative effect on the default security of the device, you can take steps to recover some security. These are just some general tips and in no way comprehensive. First, make sure you set a root password on ChromeOS since it's not set by default when developer mode is enabled. You can do this with the following command:
sudo chromeos-setdevpasswd
Crouton supports encryption of your chroot and this is done by using the -e switch with the crouton script.
When using Unity on 12.04 I found that it was not possible to lock your computer on a default install, but that can be solved by installing the relevant package (gnome-screensaver) manually.

In summary, I am very happy with the C720 as it's a lightweight, long lasting and reasonably well performing Linux laptop.
This was posted on Tue 11 Feb 2014 (5 years, 4 months ago) by Ryan McConville