Show newest NZBs in Conky

This script will prepare a text file containing the latest posts in for reading in Conky.


Here’s the Conky script I use for displaying the information:

# General
background no
alignment bottom_right
no_buffers yes
out_to_stderr no
update_interval 60
double_buffer yes

# Font
font ubuntu:size=8
xftfont ubuntu:size=8
use_xft yes
draw_outline no
draw_shades no
override_utf8_locale yes

${execp sed '1!d' nzbs.txt}
${execp sed '2!d' nzbs.txt}
${execp sed '3!d' nzbs.txt}
${execp sed '4!d' nzbs.txt}
${execp sed '5!d' nzbs.txt}
${execp sed '6!d' nzbs.txt}
${execp sed '7!d' nzbs.txt}
${execp sed '8!d' nzbs.txt}
${execp sed '9!d' nzbs.txt}
${execp sed '10!d' nzbs.txt}
${color lightgrey}${alignr}Updated: ${exec stat -c %y nzbs.txt | cut -d . -f 1}

Note that I have Conky update every 60 seconds. The source information doesn’t change that quickly.

Because of the length of the titles it is probably a good idea to put this in a Conky of its own.

This version marks scifi films in green.

If you have any suggestions for improvement please do leave them in the comments. I wrote this script mainly for trying my hand at screenscraping in Linux.

This script uses recode to recode html (e.g. replace “& a m p ;” with “&”). I had to install recode first by doing

aptitude install recode

Schedule with

crontab -e


Here’s the script. It probably needs some more error handling.


# Directory to work from
cd /home/vorkbaard/conky/

# Number of results

# This is my custom filter. Read's documentation
# to create your own. This shows all hd movies except in the genres:
# music;musical;sports;war.


echo Download info from
wget -O raw.txt $nzburl
# Wait for download to complete

echo Cut out the interesting lines
cat raw.txt | head -198 | tail -$results > code.txt

echo Retrieve title from code
cat code.txt | cut -d \> -f 8 | cut -d \< -f 1 > titles.txt

echo Retrieve genre from code
# NOTE: THE FOLLOWING MUST BE ON ONE LINE (cat ... genres.txt)
cat code.txt | cut -d { -f 2 | cut -d } -f 1 | sed 's/.*.Genre":"//' | sed 's/","Type":"Movie"//' > genres.txt

echo Combine genres with titles
paste --delimiters=\| titles.txt genres.txt > nzbstemp.txt

echo Clean up the text a bit
# Add spaces around pipe between title and genre
sed -i 's/|/ | /g' nzbstemp.txt
# Replace html by ascii code
recode html nzbstemp.txt

# I want all Science fiction films to show up green in Conky
# Delete fmtnzb file if it exist
if [ -e fmtnzb.txt ]; then
  rm fmtnzb.txt

while read film; do
 if [ "${film/Science\ Fiction}" = "$film" ] ; then
   # regular film
   echo $film | sed 's/^/\${alignr}/' >> fmtnzb.txt
   # Science fiction film
   echo $film | sed 's/^/\${color green}\${alignr}/' >> fmtnzb.txt
done < nzbstemp.txt

# Copy new nzbs to Conky
mv fmtnzb.txt nzbs.txt

How to show Twitter mentions in Conky

You can pipe just about anything to Conky and your Twitter mentions are no exception. We do need to consider the Twitter api’s request limit though. At the day I am writing this that limit is 15 requests per 15 minutes. I believe Twitter’s website, TweetDeck and TweetDeck’s web and app versions are not taken into account towards the limit. Still I recommend being conservative with Twitter api requests, just to be sure.

I’m using Debian Wheezy but you should be good to go on Ubuntu and other Debian derivatives (e.g. Linux Mint) as well and other distros.

Conky showing Twitter mentions
Conky showing Twitter mentions

Here’s how we’ll go about it:
1. Set up TTYtter, a Perl and command line based Twitter client.
2. Use a script to periodically retrieve your mentions.
3. Set up Conky and have it show your mentions.

Install TTYtter
Download TTYtter from this site: The script is usually called <VERSIOM>.txt. At the moment of writing the latest version is 2.1.00.

$ wget

Rename and move the script to a logical name and place:

$ sudo cp 2.1.00.txt /usr/bin/TTYtter

Make the script executable

$ sudo chmod +x /usr/bin/TTYtter

Set up your Twitter account in TTYtter

$ ttytter

Now follow the on-screen instructions about allowing TTYtter to use your account.

wheezy (Working Conky) -14-30_19

wheezy (Working Conky) -14-30_31

Setting up your Twitter account in TTYtter
Setting up your Twitter account in TTYtter

Start TTYtter and make sure it is working.

$ ttytter -vcheck

-vcheck tells the client to look for updates to the script.

If it complains about SSL try

$ ttytter -vcheck -ssl

Type /quit to quit your interactive TTYtter Twitter session.

Use a command to print your last four mentions:

$ echo "/replies +4" | TTYtter -script -notimeline -ssl

Your last four mentions should appear in your terminal. If it doesn’t, troubleshoot until it does. Keep in mind you are allowed 15 requests per 15 minutes.

Now we *could* add this to ~.conkyrc:

${exec echo "/replies +4" | TTYtter -script -notimeline -ssl}

The problem: by default Conky updates every second. TTYtter needs a couple of seconds (let’s say 6) to pull your mentions from the database. This means that after about a minute and a half you’d have burnt your alotted db requests.

We work around this by writing a little shell script to pull your mentions from the db and write them to a local file, then having Conky read that file. We’ll store everything nicely away in a hidden folder so you can forget about it later.

The script

Create a folder ~/.conky

$ mkdir ~/.conky
$ cd ~/.conky

(The accountname I’m using on my test machine is ‘test’. Its home folder is /home/test/. Adapt the following accordingly.)

Create the file and write this in it:

echo "/replies +4" | TTYtter -script -notimeline -ssl > /home/test/.conky/newreplies.txt
if [ -s /home/test/.conky/newreplies.txt ]; then
  mv /home/test/.conky/newreplies.txt /home/test/.conky/replies.txt

We need to use absolute paths to prevent confusing Cron.

-script tells TTYtter you are running it in a script and therefor do not want introductory and courtasy output printed.
-notimeline tells it you don’t want to see your timeline.
-ssl tells it to use ssl, which is never a bad idea and probably mandatory for the api.

The if-clause makes sure that while TTYtter is collecting your new mentions the replies.txt file is not empty so as not to show a gap in Conky’s space on your desktop.

Now make the script executable:

$ chmod +x

Test the script:

$ ./readmentions
$ ls -l

Script showing Twitter mentions
Script showing Twitter mentions

A file called replies.txt should be created. Check its contents:

$ cat replies.txt

Your mentions should be in there.

Make sure this part works before continuing.

Install Conky

$ sudo aptitude install conky
$ cp /etc/conky/conky_no_x11.conf ~/.conkyrc

Run Conky and detach it from the current terminal so it doesn’t close when you close your terminal emulator.

$ conky -d

Customize Conky. It automatically reloads when you save the changed config file.
The config file is ~/.conkyrc. Add this to it:

${exec cat /home/test/.conky/replies.txt | fmt -w 40}

fmt -w 40 is the format command that wraps the lines somewhat intelligently at 40 characters.

Conky should show your mentions as soon as you save its config file.

Now we just need to schedule the script so it updates the replies.txt file periodically. Open your crontab:

$ crontab -e

Add this line to it:

*/5 * * * * /home/test/.conky/

Scheduling the script
Scheduling the script

Then save it. This will retrieve your mentions every five minutes. The following line will retrieve them every two minutes; the next every single minute:

*/2 * * * * /home/test/.conky/
* * * * * /home/test/.conky/

Smaller intervals aren’t possible with Cron; if you need near-realtime streaming try this instead:

$ TTYtter -vcheck -dostream -ssl

Script to take screenshots of VirtualBox VMs

Here’s an AutoHotKey script to take screenshots of Oracle VirtualBox VMs. The script takes a screenshot, saves it to your disk and places the image on your clipboard.

It uses IrfanView (free) to put the image on the clipboard. It assumes the path to i_view32, IrfanView’s main executable, is on your path.

F10 is the key to create the screenshot.

#SingleInstance, Force
SetTitleMatchMode, 2


WinActivate, [Running] - Oracle VM VirtualBox

;Get VM name
WinGetTitle, VmName, [Running] - Oracle VM VirtualBox
StringReplace, VmName, VmName, [Running] - Oracle VM VirtualBox

;Take screenshot
SendInput, {RCtrl Down}e{RCtrl Up}
WinWaitActive, Select a filename for the screenshot
SendInput, %FileName%{enter}
WinWaitClose, Select a filename for the screenshot

;Copy screenshot to clipboard
Run, i_view32.exe %FileName% /clipcopy /killmesoftly


How to install Google Chrome Remote Desktop on Debian Wheezy 64bit

Installing Google Chrome Remote Desktop on Debian Wheezy 64bit is possible but there is a caveat:


If you run Chromium you can install the Remote Desktop app but it won’t run.

(I don’t think there are any differences between the 32 and 64bit versions of the browser and the extension; I’m just doing this on a 64bit system and haven’t tested on 32.)

So if necessary first uninstall Chromium. No use running Chrome twice. You can, I suppose.

Second, go to and download the appropriate .deb file (mine was called google-chrome-stable_current_amd64.deb). Then install it:

# dpkg -i google-chrome-stable_current_amd64.deb

If aptitude mentions unmet dependencies, do

# aptitude install -f

Third step: download the Remote Desktop App from the Apps page (or just Google it). My .deb file was called chrome-remote-desktop_current_amd64.deb.
Install the app:

# dpkg -i chrome-remote-desktop_current_amd64.deb

If necessary fix dependencies:

# aptitude install -f

Then run the app from the app page in Chrome. It asked me about ten times to authorize but in the end it worked and I was able to run the Google Chrome Remote Desktop app without any problems.


Some notes:
– Google says they create a logfile in /tmp/Chrome* but I haven’t been able to find it.
– Adding your Linux machine to the My Computers list not yet supported on the day of this writing.
This page may be of use.
– Chrome has excellent Active Directory group policy support. I’m planning on switching from UltraVNC and TeamViewer to Chrome Remote Desktop for tech support to my users.
– There’s a feature in GCRD called Curtain Mode. This is essentially the difference between msrdp and msrdp /admin. The ‘/admin’ equivalent is the default in GCRD: to take over the computer and the user’s session so that the user (your co-worker for example) can see what you are doing on her computer. Enabling curtain mode on her computer disconnects her from her own session so she’ll see the ‘Press ctrl alt del to logon’ screen while you’re working in her session. Your activities are hidden (or ‘curtained’) for her. Here’s how to enable it: and bunch of other settings. This only works on Windows computers that allow Remote Desktop.