Category Archives: Random

Random stuff I’ve managed to break

AWS Installing AWS Inspector Agent on Windows EC2 Instance

Hi everyone,

Just a quick post on installing the AWS Inspector Agent on a Windows EC2 instance.

Open PowerShell and run the following command:

(new-object System.Net.WebClient).DownloadFile('','C:UsersAdministratorDesktopAWSAgentInstall.exe')

On your desktop, right click on AWSAgentInstall.exe and select run as administrator. Follow the prompts.

Go to run, and execute services.msc. You should now see the Amazon SSM Agent:

If you go to your amazon console > amazon inspector > assessment targets > Click on your relevant target > Preview Target:

Your agent status should now be healthy.

Thanks to these links for the info:


Dynamic Robots.txt with Web Api 2

Hi everyone,

For a project I’m currently working on I needed a dynamic robots.txt. Because our test environment is public facing we want to keep it from being indexed by Google etc. It took a bit of Googling to find a solution that worked, but in the end it was actually pretty simple.

Here’s the action in one of the API Controllers:

    public class UtilitiesController : CustomBaseApiController
        public HttpResponseMessage GetRobotsFile()
            var resp = new HttpResponseMessage(HttpStatusCode.OK);
            var stringBuilder = new StringBuilder();

            if (Helpers.IsProduction())
                // Allow bots in production
                stringBuilder.AppendLine("user-agent: *");
                stringBuilder.AppendLine("disallow: ");
                // Don't allow bots in non-production environments
                stringBuilder.AppendLine("user-agent: *");
                stringBuilder.AppendLine("disallow: *");

            resp.Content = new StringContent(stringBuilder.ToString());

            return resp;

Also need to add the following to your web.config so that the robots.txt file can processed by the routing handler. Without this IIS will attempt to serve it as a static file and will return a 404 when it’s not found:


In production you’ll end up with the following:

user-agent: *

And any other environments:

user-agent: *
disallow: *

Thanks to these answers on stackoverflow for the info:

Adding a Link to a Drawer – Material UI and ReactJS

Hi everyone,

I ran into a bit of an issue turning a menuitem into a link with Material UI and React-Router. The main problems being that underlines appeared and threw the spacing out.

To summarize, use the component attribute on the ListItem:


The official docs cover it here:

See the following stackoverflow post for more info:

Remote Desktop: An authentication error has occurred. – This could be due to CredSSP encryption oracle remediation.

Hi everyone,

I ran into an auth issue with remote desktop today:

An authentication error has occurred.
The function requested is not supported.
Remote computer: XXXX

This could be due to CredSSP encryption oracle remediation.
For more information, see hhtps://

The solution is to add the May 2018 Windows Security Update on both the remote and local machines. If that’s not possible a registry entry can be added to the local machine to circumvent the issue. This can be done by running the following command in a command prompt as administrator:

REG ADD HKLMSoftwareMicrosoftWindowsCurrentVersionPoliciesSystemCredSSPParameters /v AllowEncryptionOracle /t REG_DWORD /d 2

You can also add the entry manually via regedit.

The cause is actually because of a security update in windows. If either the remote or local machine has the update and the other does not the error is triggered. There’s more info available on the following page:

Using INA219 (GY-219) with the Raspberry Pi

Hi everyone,

I’ve just setup an INA219B Voltage/Current sensor on my RaspberryPi. Just thought I’d link the tutorials and libraries I used – there’s a lot of really useful info out there.

Install the following library via git:
sudo pip3 install pi-ina219

Follow this tutorial:

Misc Notes

  • Common ground is required
  • Vin – and Vin+ are attached to +, neither goes to ground

Custom Sensor Address
na = INA219(SHUNT_OHMS, MAX_EXPECTED_AMPS, address=0x41)

Can be configured via the following:

Enable Low Power Between Reads
while True:
print "Voltage : %.3f V" % ina.voltage()

If you’re getting the following error:

OSError: [Errno 121] Remote I/O error

Run the following command:

i2cdetect -y 1

And check to ensure that your device is showing up on 40. If it’s a different number you’ll just need to update the address in your code e.g. (0x40, 0x41, etc.)

wget or curl on Windows

Hey everyone,

Just a quick post on a Window’s equivalent to wget/curl.

To start, you’ll need to open PowerShell (run > powershell.exe). To retrieve the page, you’ll just need to enter the following one liner:

(new-object System.Net.WebClient).DownloadFile('','C:my_output_file.txt')

The page contents will be stored in the output file provided as the second parameter to DownloadFile. To view it, just open the file in a text editor.

If you’d rather something with a GUI, winwget has been recommended on SuperUser.

Australian Tax File Number Generator (TFN)

Hey everyone,

I came across an old VB Script used to generate random TFNs for testing. I’ve just done up a quick JavaScript bookmarklet to replace it. Just drag the link below to your bookmarks bar and you’ll be able to generate random TFNs.

Click to Generate (or drag to your bookmarks bar): TFN Generator

A bookmarklet to generate random TFNs

A bookmarklet to generate random TFNs

For info on how it all works, checkout the Wikipedia page: Australian Tax File Number

Sample Australian Tax File Numbers/Test Australian Tax File Numbers:

If you’re using IE, right click on the link and press add to favourites. Once you’ve added it, click the link in your favourites sidebar. The generator will appear in the top right hand corner of the page.

Let me know if you have any trouble. If you’d like to a custom or corporate copy please contact me.

var a = document.getElementById(‘testertester’);
a.href = ‘javascript: /* Check whether to include jquery */ if (!($ = window.jQuery)) {script = document.createElement( “script” ); script.src = “//”; script.onload=initialise_tfn_bookmarklet; document.body.appendChild(script); } else {initialise_tfn_bookmarklet(); } /* Initialise the bookmarklet */ function initialise_tfn_bookmarklet(){generate_container(); generate_tfn(); } /* Generate a random tfn */ function generate_tfn(){/* Create vars */ var tfn = Math.floor(100000000 + Math.random() * 900000000); var sum; var zero = 13; var weights = [10, 7, 8, 4, 6, 3, 5, 2, 1]; /* Loop through each */ while(zero != 0){/* Reset vars */ sum = 0; tfn = parseInt(tfn) + 1; product = 0; /* Loop through each number */ for(var i = 0; i < String(tfn).length; i++){/* Check digit */ sum = sum + (String(tfn).substr(i, 1) * weights[i]); } /* Check if valid */ zero = sum % 11; } /* Show TFN to user */ $("#txt_tfn").val(tfn); } /* Closes the tfn generator */ function close_tfn_generator(){$("#cjo_tfn_generator").fadeOut(500, function(){$(this).remove(); }); } /* Append TFN to body */ function generate_container(){/* Define container */ var button_styles = "padding%3A%203px%205px%3B%20background-color%3A%20%23F5F5F5%3B%20border-radius%3A%203px%3B%20border%3A%201px%20solid%20%23E9E9E9%3B%20text-shadow%3A%201px%201px%201px%20white%3B%20color%3A%20%23A7A4A4%3B%20cursor%3A%20pointer%3B%20box-shadow%3A%201px%201px%201px%20%23FFF%3B"; var container = "%3Cdiv%20id%3D%27cjo_tfn_generator%27%20style%3D%27z-index%3A%209001%3Bposition%3A%20fixed%3B%20top%3A%2050px%3B%20right%3A%2010px%3B%20width%3A%20200px%3B%20padding%3A%2010px%3B%20background-color%3A%20%23FFFFFF%3B%20border%3A%201px%20solid%20rgb%28201%2C%20201%2C%20201%29%3B%20border-radius%3A%203px%3B%20box-shadow%3A%201px%201px%201px%20%23FFF%3B%20text-align%3A%20center%3B%27%3E" + "%3Ca%20style%3D%27font-size%3A%2010px%3B%20color%3A%20%23555%3B%20font-family%3A%20consolas%3B%27%20href%3D%27http%3A//" + "%3Cinput%20type%3D%27text%27%20style%3D%27text-align%3A%20center%3B%20width%3A%20auto%3B%20margin-right%3A%2010px%3B%20margin-left%3A%2010px%3B%20text-shadow%3A%201px%201px%201px%20rgba%28158%2C%20162%2C%20159%2C%200.28%29%3B%20color%3A%20%23555%3B%20font-weight%3A%20bold%3B%20padding%3A%203px%3B%20border-radius%3A%202px%3B%20border%3A%20none%3B%27%20id%3D%27txt_tfn%27%20/%3E" + "%3Cbutton%20onClick%3D%27generate_tfn%28%29%3B%27%20style%3D%27" + button_styles + "%27%3ENew%20TFN%3C/button%3E" + "%3Cbutton%20onClick%3D%27close_tfn_generator%28%29%27%20style%3D%27" + button_styles + "margin-left%3A10px%3Bposition%3Aabsolute%3Btop%3A5px%3Bright%3A5px%3B%27%3E%26times%3B%3C/button%3E" + "%3C/div%3E"; /* Append container to body */ $("body").append(unescape(container)); } /* – Chris Owens */';