Addshore

It's a blog

Go Docker SDK, Raw Terminal Ctrl+C handling

I spent my weekend in working on a new project called dockerit. It’s a simple wrapper around Docker written in Go and making use of the Docker SDK.

One of the biggest sticking points for me, being fairly new with the Golang world, was trying to pass stdin stdout and stderr between the container and host terminal correctly, while also having good performance and doing the expected things (like Ctrl+C to cancel).

The full code for setting up and, interacting with and removing my container can be found here. The main steps are broken down below.

Continue reading

Simple Go defer code example

In Go, a defer statement will execute a function call just before the function it is called from returns.

I found that most of the examples of a Go defer call online seemed to do complicated things with numbers. So here is a nice simple example with just text output.

Example

You can run this code yourself in The Go Playground! You can also find a similar example in the Go Tour.

package main import ( "fmt" ) func main() { // This will output first (in order) fmt.Println("One") // This will output last (before this function finishes) defer fmt.Println("Two") // This will be called before the above defer call "Two" secondary() } func secondary() { // This will output after Four (before this function finishes) defer fmt.Println("Three") // This will output (in order) fmt.Println("Four") }
Code language: JavaScript (javascript)
Continue reading

My Git Aliases

Overtime key presses really add up, especially when you use certain tools all throughout the day.

Here are the bash and git aliases that I use for git to avoid doing some of these keypresses.

I’m not sure how many times a day I use these shortcuts, or how many key presses I skip, but I’m fairly sure my keyboard is thanking me.

Continue reading

2020 Year Review

Another year is up, and what a year it has been. I finally open sourced wbstack, I complained about fake news, looked at Minecraft mods and took a look at how COVID-19 was affecting Wikipedia page views.

I make this post mainly for me to be able to look back at each year in a small snapshot. You can find similar posts for previous years in 2019, 2018 and 2017.

Currently I generate this post in a very manual way, sifting through data from WordPress stats, Twitter Analytics and my Github user page. Maybe I should change that for next year!

Blogging

On the whole this blog continues to grow year on year, both in terms of content and readers.

Continue reading

Google outage article by The Express ‘This could be 9/11 of hacks’

Image

I’m here after a certain Google outage lead to at least 1 sensational headline misleading some people that contact me asking for an opinion. I was aware of the outage at the time as I was trying to use Google products. The article headline that I dive into below just made me laugh at the time and I had to dive into it a bit more.

On the 14th December 2020 Google had a pretty large outage for nearly an hour due to problems with their User ID service, which makes up part of their authentication infrastructure. The postmortem of the incident is up explaining exactly what happened, as well as a less technical blog post.

On the day, and following the incident, there was quite a bit of media coverage on the topic. One article by The Daily Express stood out to me really aimed to mislead with its headline: Google DOWN: ‘This could be 9/11 of hacks’ Security expert admits grave concerns.

Continue reading

Auto reloading pi kiosk script from Github

While at Newspeak House in 2020 I found myself wanting to change how the screens dotted around the place worked. A little bit of context is needed here. These screens were dotted around the communal areas, each attached to as raspberry pi, and each running a kiosk script to load a browser and website when they first boot up. The code for the screens is on Github, and the pis do not have SSH enabled…

I wanted to change the website that they pointed to. In essence this mean going around and modifying the kiosk script on 6 or so pis using a small bluetooth keyboard and mouse. While doing that, to avoid anyone needing to do it again in the future, I modified the kiosk script to automatically reload itself from Github.

Continue reading

Open Sourcing WBStack

wbstack organization on Github

Open Sourcing the code and config for WBStack has always been part of the plan, although functionality came first throughout the first year or so. Finally there is a github organization for wbstack containing 16 public repositories that make up the entire deployment for wbstack.com.

This effort took a few weeks trying to split sensible components out of the original mono repo that was started back in 2017 that now has over 1600 commits, making sure that no secrets were swept up along the way, and also trying to preserve git history where possible.

Although everything is now on Github that doesn’t mean that it is clearly understandable just yet, or in the most sensible layout, that will come with time.

Continue reading

Creating a new replica after purging binlogs with bitnami mariadb docker images

I have been using the bitnami mariadb docker images and helmfiles for just over a year now in a personal project (wbstack). I have 1 master and 1 replica setup in a cluster serving all of my SQL needs. As the project grew disk space became pressing and from an early time I has to start automatically purging the bin logs setting expire_logs_days to 14. This meant that I could no longer easily scale up the cluster, as new replicas would not be able to entirely build themselves.

This blog post walks through the way that I ended up creating a new replica from my master after my replica corrupt itself and I was all out of binlogs. This directly relates to the Github issue on the bitnami docker images of https://github.com/bitnami/bitnami-docker-mariadb/issues/177

The walkthrough was performed on a Google Kubernetes Engine cluster using the 7.3.16 bitnami/mariadb helm charts which contain the 10.3.22-debian-10-r92 bitnami/mariadb docker image. So if you are using something newer expect some differences, but in principle it should all work the same.

Continue reading

2020 Election, Registered voters misinformation #voterfraud?

On November 4th 2020 I managed to get an overview of exactly how misinformation and “fake news” can start so accidently, and spread so rapidly.

While scrolling through Twitter during the 2020 US Presidential election, I spotted some tweets saying that more people had voted in Wisconsin than were originally registered in the state. You can find a bunch of them using this twitter search.

After performing a quick Google search looking for some data I found a worldpopulationreview.com list of states by registered voter count for 2020 as the first result, interestingly with the same value as included in the tweet, 3,129,000. Looking into the “Sources” of the page helpfully listed by the author I couldn’t see data being referenced for 2020, only for 2018 and 2016. This page has the wrong title!

Some more research lead me to what appeared to be the first fact check article also confirming that the number being circulated appeared to be from 2018, not 2020.

Rather than leaving it there, for whatever reason I decided to get more involved, dig a little deeper, talk to some people on twitter and see what I could change as this misinformation continued to be spread.

Continue reading
« Older posts

© 2021 Addshore

Theme by Anders NorénUp ↑