hakk

software development, devops, and other drivel
Tree lined path

Blog

Update Browser URL Without Page Reload (JavaScript)

When building a single page web app it’s important to update the URLs without refreshing or reloading the page. This will also enable the user to easily copy and share or revisit the current page. Using the History API Browsers provide a History API that allows the page URL to be updated that works great for this use case. The API does allow for sharing other data but has limitations; with that in mind it would be better to find another way to share any data especially if it’s sizable. Read more...

Deploy WordPress on KataCoda Kubernetes

A step by step guide to deploying WordPress on Kubernetes provided by the KataCoda website. Please note that this shouldn’t be used for a production deployment and should only be used for learning and/or practice. Create a Secret for the MySQL Password The first step is to create a secret that can be used to store the MySQL database password. Later in the deployment this will be used in creating the MySQL database pod and then used by the WordPress pod to connect to the database. Read more...

Vagrant Ubuntu with Docker install

Creating an Ubuntu VirtualBox and installing Docker. Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "ubuntu/bionic64" config.vm.define "docker-1" do |node| node.vm.hostname = "docker-1" config.vm.box_check_update = false config.vm.network "public_network" config.vm.provider "virtualbox" do |vb| vb.name = "docker-1" vb.memory = "2048" vb.cpus = "2" end node.vm.provision "install-docker", type: "shell", :path => "ubuntu/install-docker-2.sh" end end install-docker-2.sh cd /tmp curl -fsSL https://get.docker.com -o get-docker.sh sh /tmp/get-docker.sh vagrant up Wait for the virtual machines to get created and started. Read more...

Building a VirtualBox ISO with Packer

I wanted to try building my own Vagrant base box, I decided to use one of the chef bento templates for ease. It was moving along nicely, downloaded the ISO, verified the checksum and suddenly this error appears. VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine packer Not quite sure where to start I decided to do a quick Google, read some posts about VirtualBox modules. I was quite sure that wasn’t my issue. Read more...

VBoxManage - Manage VirtualBox VMs From The Command Line

VirtualBox is a fantastic tool, previously I had been using it from the GUI. However, recently I started running it remotely on a server and using VNC to connect and manage the virtual machines. I decided that I would rather use the command line for this task as well. However, remembering all the commands is proving difficult. So I’m going to create a list and hopefully help myself and others along the way. Read more...

Go embed example of serving static files at the root URL path

Go 1.16 introduced the embed package which allows serving static files from directly within the binary without the need for any external package. Screenshot of the example web page Here are two example’s showing how to serve from the root URL path. example.go shows an example of how to use the new io/fs package and the Sub func. The comments offer a word of caution however that it may not prevent access outside of the subdirectory. Read more...

Detect Visitors DNS Provider

Recently I had bought a new router and was in the process of setting it up, during that process I started looking for various DNS-over-TLS and DNS-over-HTTPS providers. That’s when I came across NextDNS, on the setup page I saw the following: NextDNS Setup page I thought what!? How do they know that? After some investigation it all made sense, I’ll share what I found and a demo implementation. Enter Dev Tools The first place I start when investigating interesting finds such as this is my browsers trusty Developer Tools. Read more...

ModuleNotFoundError: No module named 'distutils.util' on Ubuntu

Not on Ubuntu? If you’re using Ubuntu 16.04 or newer and want to use Python 3.7 and newer with pip you have probably seen this error message ModuleNotFoundError: No module named 'distutils.util'. On later versions of Ubuntu the error message will be: ModuleNotFoundError: No module named 'distutils.cmd'. This fix will still work. bmcculley@hakk:~$ pip3 Traceback (most recent call last): File "/usr/local/bin/pip3", line 5, in <module> from pip._internal.cli.main import main File "/usr/local/lib/python3. Read more...

How to Install Python 3.8 on Ubuntu 16.04 and 18.04

Page Navigation Building Python Install with Apt Update the default Python Troubleshooting The Zen of Python Python is one of the most popular and most widely used programming languages in the world at this time. The philosophy behind the Python programming language is most likely the reason. It’s very easy to learn with its simple syntax, that same syntax makes the language very readable, therefore easy to understand what someone else wrote. Read more...

How to Install Telnet on Mac [2023]

Page Nav Using Brew Building from Source Alternatives Need to use Telnet on your Mac? Only to find out at the most inopportune time that Telnet is no longer on MacOS? Well, take solace in the fact that you’re not alone. Telnet has been removed from modern versions of the system software starting from MacOS Mojave and newer. These instructions will work for MacOS Mojave and newer, including Ventura and Sonoma (These are the steps that I have personally used to get Telnet back). Read more...