Thursday, December 26, 2013

Installing Armory

The Armory installer isn't quite up to date. The installer I found on their website: had RAM leaking issues.

sudo apt-get install git-core build-essentials python-dev \
    python-psutil swig pyqt4-dev-tools bitcoind

git clone
cd BitcoinArmory/cppForSwig
make swig
cd ..

Note: '' is run by 'make swig'. I ran it first just to make sure I have all the dependencies, since make swig swallows the errors in ''

Now you can run, just to make sure everything works:

I decided that I wanted to "install" it, so I copied the folder to /usr/lib/
cd ..
sudo mv BitcoinArmory /usr/lib/armory

Adding the desktop icon:

I decided to update the armory icon, since it was pointed to an icon pack I didn't install.
cd /usr/lib/armory
sed -ie "s/Icon=.*/Icon=\/usr\/lib\/armory\/img\/armory64x64.ico/" \

chmod +x dpkgfiles/armory.desktop

Then copy it to your list of local applications:
cp /usr/lib/armory/dpkgfiles/armory.desktop ~/.local/share/applications/

Now the a launcher shows up in unity, with the right icon.

Friday, September 13, 2013

Downloading and trimming clips

There are two ways to download the clips, and get them the converted for Mythtv (the right times, etc)

1) twitchtv:
# youtube-dl ""
downloads many parts
# for i in *.flv; do echo "file '$i'"; done > inputs.txt
# ffmpeg -f concat -i inputs.txt -c copy output.mp4

Youtube doesn't need this, because they show up as one file. However, they do still need to be trimmed. If you need to trim it then, mark the times.

For example:
'input.webm' start: 5:27:00 end: 8:28:28
Then you can convert the file with ffmpeg:
# ffmpeg -y -ss 5:27:00 -t 3:01:28 -i 'input.webm' -c copy 'output.webm'

Monday, September 2, 2013

Django logging

Django has a pretty configurable logging facility.

The other day I had to customize error emails in django.

I did this by copying django's AdminEmailHandler, to a local file, and then pointing the logging utility to this.

The django guide has a large configuration that you can strip. Let's strip it down to this:

    'version': 1,
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler',
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': False,
Note the default configuration for the class. This is also where you copied the AdminEmailHandler. Point it to the new location that you saved it. I wasn't sure of a good place so I saved it in 'project/middleware/' and referenced it: "project.middleware.custom_email.AdminEmailHandler"

Now all you need to do is change the email handler to return emails the way you want. I stripped out the file so that it was just the classs and the required dependancies, because I didn't want to override other things that I didn't need to.

Friday, August 16, 2013

Icinga bouncing menus

I got annoyed with the bouncing menues in icinga. Basically they added a 'on hover' to the links, that increases the padding.

You can remove it by deleting the jquery hover:

--- /usr/share/icinga/htdocs/js/menu.js
+++ /usr/share/icinga/htdocs/js/menu.js
@@ -18,13 +18,4 @@

-    // Links
-    $("div#menu ul li a").hover(function( e ) {
-        var speed = 200,
-            padding = 10,
-            mode = e.type === "mouseenter" ? "+=" : "-=";
-        $(this).parent("li").animate({
-            paddingLeft: mode+padding+'px'
-        }, speed );
-    });

Saturday, July 6, 2013

Vanilla forums: Batch Decline participants

Our Forum in Kenya was spammed. I had decidd to use vanillaforums as the forum software (a choice I'm not so sure about anymore).

I decided to set the registration as "approval by moderator", which meant that the spam bots were filtered into a "Applicants queue". After ~2-3 weeks the applicant list was 5 thousand.

Clicking each one was not feasible. So I wrote this javascript:

if (typeof String.prototype.startsWith != 'function') {
    "use strict";
    String.prototype.startsWith = function (str){
        return this.slice(0, str.length) == str;

var time_wait = 0,
    string_check = '[url=http://',
    action = 'decline',
    forum_url = '',
    pause_time = 10000;
$('[type=checkbox]').each(function () {
    "use strict";
    var curelem = $(this),
        parent_group = curelem.parent().parent().children(),
        request_text = $(parent_group[1]).children()[2].textContent,
        key = $($(parent_group[2]).children()[0]).attr("href").split("/").reverse()[0];

    var user_call = function (id, action, time, key) {
        console.log("val = " + id + ", time_wait = " + time);
        window.setTimeout(function () {
                url: 'http://' + forum_url + '/user/' + action + '/' + id + '/' + key,
                type: 'POST',
        }, time);

    if (request_text.startsWith(string_check)) {
        user_call(curelem.val(), action, time_wait, key);
        time_wait = time_wait + pause_time;

This will go through and fire off an ajax call, which will decline each user. It does this in increments of 10 seconds.

It had to be 10 seconds, because with around 5 thousand applicants, the list was 3M. (I've used up ~2G on our host, just from trying to load this applicants page).

I've created a ticket about this issue:

In the meantime if you dont' feel like waiting the 10 seconds, and want to edit php:
Open up 'applications/dashboard/controllers/class.usercontroller.php'
Find 'public function Decline'
The last line of the function is
change this to
$Action = $this->Form->GetValue('Submit');

With this change, the calls took ~400ms, so I changed time (in the script) to 1000.

This worked for me in Vanilla Forums v2.0.18.8