Automatically tweet new Hexo entry via IFTTT

In the absence of Wordpress’ Publicize, I have decided to use IFTTT in conjunction with Hexo Feed Generator, to automatically publicize my Hexo entries.

IFTTT, which stands for If This Then That , is a tool that automates tasks using triggers and actions. IFTTT connects two services, and then triggers an action on one service when you perform an action on the other service. It works with all of the major social networks, including Facebook, Twitter, Instagram, LinkedIn, Tumblr, and YouTube.

After connecting my twitter account, I chose to use a new rss feed entry as the ‘trigger’, and a new tweet as the ‘action’. My recipe can be found here.

Instructions for applications can be found by traversing the links provided.

Plex Home Theatre on Debian Wheezy

Plex Home Theatre on Wheezy requires packages from 2 additional repos, and a specific Ubuntu font package. The following instructions illustrate this:

  • Add repos:

sudo apt-get install curl

sudo curl http://shell.ninthgate.se/packages/shell-ninthgate-se-keyring.key | sudo apt-key add -

echo "deb http://www.deb-multimedia.org wheezy main non-free" | sudo tee -a /etc/apt/sources.list.d/deb-multimedia.list

echo "deb http://shell.ninthgate.se/packages/debian wheezy main" | sudo tee -a /etc/apt/sources.list.d/plex.list

sudo apt-get update

sudo apt-get install deb-multimedia-keyring
(press Y to confirm)

sudo apt-get update

sudo apt-get dist-upgrade

cd /tmp && { curl -O http://mirrors.kernel.org/ubuntu/pool/main/u/ubuntu-font-family-sources/ttf-ubuntu-font-family_0.80-0ubuntu2_all.deb ; cd -; }

sudo dpkg -i /tmp/ttf-ubuntu-font-family_0.80-0ubuntu2_all.deb

  • Install Plex Home Theatre

sudo apt-get install plexhometheater

Quick Git Hints (Work-In-Progress)

A compilation of Git commands I have found useful so far:

  • Merge multiple pushed commits, and push to remote

For example, for 4 most recent commits:

`git rebase --interactive HEAD~4`

In interactive dialog, squash (merge) commits 2-4 - by replacing “pick” with “squash”

Save session (e.g :wq in vi), and choose new commit message. Then:

`git push origin +master`
  • Highlight word changes

This only highlights the changed words, nicely inline. Try:

`git diff --word-diff`
  • To quickly discard unstaged changes:

    git stash save --keep-index
    git stash drop

  • My ~/.gitconfig file - explanations can be found in individual commits to my github repo.

Configure Filebot for Opensubtitles.org in Windows

FileBot in Windows is a bit tricky to use when it comes to batch subtitle downloads.

In particular, OpenSubtitles.org prevents leeching by requiring login details to be passed to Filebot. This isn’t so straightforward in Windows with no gui configuration available.

We are required to use the console version of FileBot from the windows commandline

Firstly, get into the commandline:

<win-R> cmd

Then do:

cd C:\Program Files\FileBot

Your prompt should now show:

C:\Program Files\FileBot>

Then do:

filebot.exe -script fn:configure

Enter OpenSubtitles username: ******
Enter OpenSubtitles password: ******

Testing OpenSubtitles... OK
Done

Finally, with all movies in a network-mounted Y:, for example, do:

filebot.exe -script fn:suball "Y:" --lang en -non-strict

My elaborate movie-format rename scheme follows:
{n.space('_')}_({y})_[{af.lower()}_{ac.lower()}_{(int)video.framerate.toFloat()}fps_{(video.bitrate.toFloat()/1000).round()}kbps_{vc.lower()}_{vf}]

  • yielding something like:
    12_Years_a_Slave_(2013)_[6ch_dts_23fps_4324kbps_x264_720p].mkv

Filebot on Debian Wheezy

In Debian Wheezy AMD64, the default version of Java is OpenJDK 6. In order to switch Oracle’s v8 Java, do the following:

# su -
# echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
# echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
# apt-get update
# apt-get install oracle-java8-installer

And confirm that you’re using the correct Java implementation:

$ java -version
$ javac -version

java version “1.8.0_25”
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

Next, download the Filebot deb, and install:

sudo dpkg --force-depends -i filebot-*.deb

CIFS on Debian Wheezy

I’ve reproduced this reported bug - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=641894 - on my Waldorf machine, and have arrived at the following solution:

As root, open the existing /etc/fstab file and comment-out your existing CIFS mount(s)

Unmount all existing cifs mounts:

# sudo umount -a -t cifs

Install autofs:

# sudo aptitude install autofs

Open (as root) new file /etc/auto.master:

# sudo vi /etc/auto.master

If you want the mounted directories under /data, add the following line:

/data /etc/auto.misc --timeout 60 --ghost

The “ghost” option ensures that even unmounted directories are always visible. Remove this if you prefer to only see the directory when you enter the path to the mounted directory.

Open (as root) new file /etc/auto.misc:

# sudo vi /etc/auto.misc

Add line(s) at the end for your mount directories in a similar format to your /etc/fstab file:

downloads1 -fstype=cifs,rw,username=ootput,password=<cifs_pass>,uid=1000,gid=1000 ://192.168.1.2/downloads2

  • where ‘downloads1’ refers to a local mountpoint under /data, and ‘downloads2’ to the remote cifs share, respectively.

Start the autofs service:

# sudo service autofs restart

Additionally, I enabled all SysRq functions to address stalled shutdown procedures by adding to /etc/sysctl.conf:

kernel.sysrq=1

ootput Burst on Github via Hexo

Thanks to Hexo, I am slowly migrating my wordpress.com site towards Github. Github Pages reminds me of Nanoblogger in many ways - sans the excruciating pace of deployment. I love Github’s free-of-ads hosting, and the fact that I can tinker with the content framework in the comfort of my beloved Emacs editor. I also don’t mind the fact that I work with a local repository of text-based version-controlled blog entries.

Check out my work-in-progress at http://ootput.github.io

Changes to vanilla Hexo are courtesy of fine Hexo documentation at http://jr0cket.co.uk/hexo/

QOS on VPN Client Tunnel in Tomato

From this page, I was able to have QOS functioning on an OpenVPN tunnel in Tomato.

Essentially, I had to add the following snippet to the ADMIN->SCRIPTS->FIREWALL field (note the different device names used):

1
2
3
4
5
6
7
8
9
10
cp /etc/qos /tmp/qos-tun11
sed -i 's/vlan2/tun11/g' /tmp/qos-tun11
sed -i 's/imq0/imq1/g' /tmp/qos-tun11
chmod +x /tmp/qos-tun11
/tmp/qos-tun11
iptables -t mangle -A FORWARD -o tun11 -j QOSO
iptables -t mangle -A OUTPUT -o tun11 -j QOSO
iptables -t mangle -A PREROUTING -i tun11 -j CONNMARK --restore-mark --mask 0xff
iptables -t mangle -A PREROUTING -i tun11 -j IMQ --todev 1
ifconfig imq1 up