f-log

just another web log

25 Sep 2019:
rocking a reboot crontab for speedy pi
New power cut, old problem.

When the power came back on one of my Pi units booted quicker than the router and did not get a IP address on the network.

So I concocted the following, not sure it will work and as the number of power cuts in the area is less than one per year maybe I never will.


sudo crontab -e
@reboot sleep 120;ifconfig wlan0 | egrep "inet 219\.260\.0" || echo "ERROR IP address not wifi ready">/var/log/reboot.log; shutdown -r now


On boot roots crontab will wait 2 mins then check to see if the wlan0 network interface has an IP address in the expected range and if not logs and error and reboots.
Hopefully by that time the Wifi and router will be up.
21 Sep 2019:
squirmy wormy worm blended under the skin
A quick creepy wiggly worm under the skin animation :)

There was an interesting question on the Blender Stackexchange about creating the effect of a worm under skin

A number of replies created great results, but the example using Vertex Weight Proximity looked a bit flat when I tried it out. So I added a Lattice modifier to compress and decompress the worm as it travels.

the result is a bit unsettling ...


14 Sep 2019:
right sed lowercase fred
Random Sed tip

Taking a text file of
Firstname Lastname

I needed to create
firstnamelastname, Firstname, Lastname

and in each case the "case" is important.

cat names.txt | sed -re "s/(\S+)(\s)(\S+)/\L\1\3\E,\1,\3/"

Which breaks down to
(\S+)
Creating match no. 1 containing only non Space characters one of more times.

(\s)
Creating match no. 2 containing only single Space character.

(\S+)
Creating match no. 3 containing only non Space characters one of more times.

Then
\L\1\3\E
Lowercases matches 1 and 3, with the \E ending the lowercasing action. Otherwise everything else in the replacement string will be lowercased to the end.

,\1,\3
just adds the commas and the required matches.

The real instance was more complicated, but this will be enough if I ever need it again.
02 Sep 2019:
where we are going we do not need debuggers sharks wait
Was doing some Shark work last night and hit a snag.

Something I had done was causing the page to hang. I thought it was an infinite loop. Spent some time trying to remove anything I had done recently and commenting out huge chunks, but nothing worked :(

I realised I had removed most of the functioning code so next I tried adding break-points at various places, but they were not being hit and the page still showed it was never loaded.

Worried I created a new empty page with just two lines of JavaScript and one of those being
debugger;

This should have acted as an instant break-point, but again was not being hit ...

Fast forward to today and after a lot of Googling and trying new Firefox profiles etc I found the fix.

about:config
set
devtools.debugger.new-debugger-frontend = false (was true)

This is Firefox 60.8
01 Sep 2019:
lost ffmpeg found in another universe
After the debacle with the Windows PC taken over by a child's account I was left with a new local account and I had to reinstall Ubuntu via WSL

All I needed was for FFMpeg to work, and having done this a few times of the last few years I thought it would be straight forward.

NO!
E: Unable to locate package ffmpeg

and even avconv had the same issue. Found lots of info about older Ubuntu releases, but nothing matched.

The fix, for my reference is to add the universe and multiverse to the available packages and update

sudo add-apt-repository universe multiverse
sudo apt update
sudo apt upgrade
sudo apt install ffmpeg


not doubt I will have to refer to this again in the future. Hi! future me.
01 Sep 2019:
a name by any other name might just work
Javascript is usually pretty reliable. Run here, run there, no problem. Until, well, me.

I needed to pull some information off a web page. I opened the Dev tools and Console and wrote bits of Javascript that would get what I needed. All the individual tests worked fine, but when I came to put it in a loop the wheels came off.

The key thing to note was up until this point I was just allowing the results to be displayed in the Console, the next step was consolidating them.

"one two three".split(' ');
returns an Array
['one','two','three']
split is function of Javascript String. It takes a separator and "splits" the string on that. Simple and very useful.

so you would expect
name = "one two three".split(' ');
name[0];


would produce 'one' as the first element of the new Array, but instead it returns 'o'
and Array.IsArray(name) returns false;

but

aname = "one two three".split(' ');
aname[0];


returns 'one'

and yes, the only change is from "name" to "aname".

It appears name is window.name and even using
var name = "one two three".split(' ');
does not fix it!

talk about pulling my hair out.

So why is this not more well known?
It will only affect users typing directly into the console, as most code will be in a function/object and be isolated from the global window.name

The window.name prototype converts everything to a String not just Arrays.
Mozilla developer reference

window.name will convert all values to their string representations by
using the toString method.

01 Sep 2019:
setting fire to the foxing the minecraft hack
And the same Minesweeper hack process works in Firefox.

Sadly, it is proving rather difficult and although I consistently reach about 200 mines, 50% completed, I am not getting any further.

A worthy, if time consuming challenge, indeed.
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!