A watched pot never boils - now guaranteed!

Posted on Mon 02 October 2017 in Electronics

I recently watched a video, linked below, from YouTuber Tom Scott, about ideas that he never got around to developing. One of these was for a system that guaranteed a watched pot would never boil - by having a camera that looks for faces, and turning off the pot if one is found looking its way.

It was after watching the video I uttered the most murphy-inducing words - "This should be easy!"

I decided to use a kettle, as I don't have a electronic hob kicking around. Should be easy enough right?

The switching and electronics side of things was simple - a remote control 433MHz outlet, an Arduino and a 433MHz transmitter. Combined with some code from a previous home automation project, I had the hardware taken care of. The program, running on a Raspberry Pi with connected camera, connects to the Arduino via USB serial, and simply tells it when to turn on and off the switch. The image processing is done on the much beefier Raspberry Pi 3.

The image processing itself is done with OpenCV and the default front facing facial recognition haar cascade. It grabs a 320x240 image from the Pi camera, converts it to greyscale, and …


Continue reading

A Note about using UFW with Docker

Posted on Sun 06 August 2017 in Linux

UFW is a great program. It allows easy configuration of a powerful firewall, without the need to learn IPTables and the large amount of networking knowledge that goes with it.
However, when used with Docker, there is something you need to be aware of - UFW lies!

Although UFW makes changes to IPTables, it does not read back the same route tables it modifies. This means that a program that works directly with IPTables, such as Docker, could make rules that go against what you are trying to do with UFW.

For example, let's take a standard web server configuration: allow traffic on ports 22, 80 and 443. The output of UFW is as follows:

adam@ExampleHost:~$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), deny (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    Anywhere                  
443/tcp                    ALLOW IN    Anywhere                  
80/tcp                     ALLOW IN    Anywhere 

Now let's load up a Docker container that exposes port 8765 to the outside world:

adam@ExampleHost:~$ docker ps
CONTAINER ID        IMAGE                   COMMAND        CREATED             STATUS          PORTS                     NAMES
f9955df5766f        example/example         "/bin/sh"      3 minutes ago       Up 1 hours      0.0.0.0:8765->9000/tcp    ExampleProgram

Now …


Continue reading

Pacific Standard Finale: The Easy Way!

Posted on Wed 02 August 2017 in Gaming

The Pacific Standard Job is the last heist in GTA: Online - a daring raid on a high security bank. This is by far the most difficult heist finale, but also the most rewarding one, netting the 4 player team $1,250,000 of in-game money for completing it. This idiot-proof guide is a way of completing this heist in the quickest time possible, and with minimal losses.

The following blog post comes from The Kuruma Sutra, a comprehensive guide to all of the heists in GTA: Online. This is one of the most in depth and well researched pieces, so I thought I would post it here as well. Enjoy!

Tip: Voice chat is very useful for this heist! There is many spots where people need to co-ordinate as much of this heist is time critical!

This strategy requires two people have purchased Apartment 4, Las Lagunas Blvd. This costs $126,000, which can be mostly earned by doing the setup missions preceeding this heist. It is a medium end appartment with a 6 car garage.
Due to specific bugs used by this method, it needs to be completed without quick restarting. Quick restarting at any point except where mentioned …


Continue reading

Recover overwritten files using grep

Posted on Wed 02 August 2017 in Linux

Any one who has used a computer for a good amount of time has overwritten a file. A late night mv command typo'd, a drag and drop misclick. Even if you stop using the drive straight away, most disk recovery tools won't look for files that have been overwritten rather than straight up deleted. But with a bit of luck, you can use one of the simplest linux command line tools to recover your precious files!

Just a heads up before we start, this method only really works on text files. Binary files, such as music and video, are a little more difficult to search for!

The most important thing is to stop writing to the file system as soon as possible! Unplug it, power it off, STOP USING IT!

To begin with, have your device in a working linux install, but unmounted. You need to know the rough length of the file, and a small amount of text from within the file. The more you can remember, the less junk you'll have to search through.

The command we'll be using is grep. Grep can search through binary files (such as block devices!) for text strings. It has a few …


Continue reading