Posts

Reassurances I Need Before I Will Consider Installing Any Australian Government Created COVID-19 Contact Tracing App

If you have been watching the news of late and let’s be honest, who hasn’t given we are a part of an unprecedented global pandemic? Then you would have heard of the announcement of a contact tracing application you install on your phone which notifies you and others if you’ve been in contact with anyone who tests positive for COVID-19. On the surface, every day Australians will hear the government say, “If everyone installs this, we can ease restrictions faster and flatten the curve by being able to control the spread” – but for those in tech like myself who are critical of the government’s ability to produce an app that won’t be a privacy nightmare, things are a little more convoluted.

How To Get The Hash of A File In Node.js

Whilst doing some work in a library I maintain, I needed to add in the ability to calculate the hash of an included file for an integrity check feature I was adding in. The resulting solution is simple and not boast-worthy, but given others might encounter a situation where they need a hash of a file, this might help. We use the fs module to open up the file we want to calculate the hash for, use the createHash method on the crypto package to then pass in our file buffer from the readFileSync method, and that’s it.

How To Use/Enable The New Tab Groups Feature In Google Chrome 81

For years the people have been asking for tab groups in Chrome. While extensions do exist, they’re somewhat fickle. Now, tab groups are natively supported in Google Chrome itself. While the feature is rolling out in Google Chrome 81, if you’re like me, you’re running Chrome 81 and the feature isn’t on for you yet. If you right-click on a tab and can’t see the new tab group options, you need to enable it. To visit the flags screen, open a new tab and visit: chrome://flags/ – in the search input, enter groups.

Freeing Up Space on Ubuntu When You Unexpectedly Run Out of Disk Space

Recently, whilst working on an open-source project I work on we found ourselves running out of space on the server. The weird thing is the projects on the server themselves were barely 100mb in total file size, but we had run out nonetheless. After a little investigation to see what is using up the majority of space, the search led to the /usr/src folder which contains source header files for Ubuntu’s APT package manager. A trove of files in here weighing around 100mb seemed to add up to 4 gigabytes of used space.

Testing Event Listeners In Jest (Without Using A Library)

I love using Jest to unit test my Aurelia applications. Sadly, one of the most popular options for mocking event listeners and simulating events called Enzyme is targeted at React applications and to my knowledge, does not work with Aurelia or any other framework like Angular. If you are wanting to test events registered using addEventListener there is an easy way to mock them. describe('My Test', () => { let sut; let events = {}; beforeEach(() => { sut = new Dependency(); // Empty our events before each test case events = {}; // Define the addEventListener method with a Jest mock function document.addEventListener = jest.fn((event, callback) => { events[event] = callback; }); document.removeEventListener = jest.fn((event, callback) => { delete events[event]; }); }); test('Test Keypress fires callback', () => { // Watch the function that gets called when our event fires jest.spyOn(sut, 'pressed'); // A method inside of our dependency that sets up event listeners sut.setupEvents(); // Fire the keypress event events.keypress({ key: 'Enter' }); // We fired an event, so this should have been called expect(sut.pressed).toHaveBeenCalled(); }); }); Inside of the beforeEach we do a few bootstrapping things before we run our tests. The sut variable is actually the thing we are testing. In this instance, Dependency is a class with some methods inside of it.

Is It Safe/Okay To Public Expose Your Firebase API Key To The Public?

Perhaps one of the most confusing aspects of building a publicly visible Firebase application hosted on GitHub is when you add in your SDK configuration details and commit them you’ll get warnings from a bot called Git Guardian and an email from Google themselves. I am not sure if everyone gets these, but I do for every publicly visible Firebase application I have on GitHub. The code in question that triggered these latest warnings for me looked like this:

Did The Australian Federal Police (AFP) Violate Its Own Charter?

Today, I came across something which quite frankly shocked me. The AFP Tweeted out the following Tweet. On the surface, this might seem like a harmless attempt to tell people about efforts to notify and help those affected by the bushfire, but this singular Tweet truly masks a horrifying truth of an allegedly impartial agency that investigates serious crimes Tweeting about a matter, not in their interests whatsoever.

Next Level Conspiracy Insanity: Direct Energy Weapons Allegedly Used To Start Australian Bushfires

I love a good conspiracy theory. Some of my favourite conspiracy theories include the Royal Family being shape-shifting lizards, part of some global reptilian elite controlling the world or Alex Jones’ famous rant where he claims the government is putting chemicals into the water turning frogs gay. The late-2019 Australian bushfires which have burned into 2020 have attracted some crazy individuals claiming all kinds of crazy things. People have lost their lives, thousands of homes destroyed, towns completely wiped, millions of hectares burned, over 1 billion animals estimated to have been killed.

What Comes Next After USB-C?

I have the weirdest and sometimes most profound thoughts about the most useless stuff. I actually asked myself this question whilst in the shower this morning: is there going to be a USB-D? Do we need a successor to USB-C or is it good enough for the time being? When these types of questions pop into my head, I have to Google them. I actually stepped out of the shower and before reaching for a towel, I grabbed my phone and had to find out. With the water dripping onto my phone screen and floor, I set out to find the answer.

Preferring If Statements over Ternary Operators In Javascript

Every so often thought-pieces will go around proclaiming that you are writing code the wrong way and that you should be writing your code this way instead. One such opinion I have seen (and will not link because this isn’t a takedown) is recommending the use of Ternary Operators in Javascript over if statements. While ternaries can make your code look cleaner in some cases by replacing multi-line if statements with one-liners, there are instances where they fall apart quite quickly. Ternary operators exist in all programming languages and the problems they can introduce into a codebase are universal.