Addshore

It's a blog

Page 2 of 14

Programmatically convert Github master branch to main

Back in 2020 Github said that the default settings for new repositories would change.

On Oct. 1, 2020, any new repositories you create will use main as the default branch, instead of master

Some blog post on Medium

Github provided some advice for renaming branches focused around how this can be done in the UI. But with the Github CLI tool that was also release at the end of 2020 you can programatically make this change too.

The Github CLI tool is called gh. The README for the tool has installation instructions for a variety of platforms. One of the commands that it enables is called api, which can be used to “Make an authenticated GitHub API request”.

The Github API obviously allows you to perform most actions that can be performed by the UI, this we can use the gh cli tool to rename the branches of repositories.

For example, for the addwiki/addwiki repository, we can rename the master to main branch using the following command:

gh api --method POST repos/addwiki/addwiki/branches/master/rename --field new_name='main'
Code language: JavaScript (javascript)

And you can use such a command in whatever loops etc you want to, to quickly rename a whole bunch of branches in a whole bunch of repositories.

You can read more on the API docs here and the api cli command here.

Testing WDQS Blazegraph data load performance

Toward the end of 2020 I spent some time blackbox testing data load times for WDQS and Blazegraph to try and find out which possible setting tweaks might make things faster.

I didn’t come to any major conclusions as part of this effort but will write up the approach and data nonetheless incase it is useful for others.

I expect the next step toward trying to make this go faster would be via some whitebox testing, consulting with some of the original developers or with people that have taken a deep dive into the code (which I started but didn’t complete).

Continue reading

PHP 7 composer docker image digest

At some point in the last weeks the composer docker image that can be found on docker hub switched from PHP7 to PHP8. Some projects, such as wikibase-docker, still require PHP7 for installation.

It looks like the composer image is not going to be providing an additional tag using a pre PHP 8 version, thus an old digest will be needed.

tldr; here is the digest that you want for composer with PHP7 (tag-details)

docker pull composer@sha256:d374b2e1f715621e9d9929575d6b35b11cf4a6dc237d4a08f2e6d1611f534675
Continue reading

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
« Older posts Newer posts »

© 2021 Addshore

Theme by Anders NorĂ©nUp ↑