Skip to content
hakk
  • Home
  • Blog
  • Docs
  • DSA
  • Snippets

Blog

  • Vagrant Ubuntu with Docker install

    2022-03-09

    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. Then ssh into it.

    vagrant ssh docker-1
    

    Add the vagrant user to the docker group (this could probably be added to the script).

  • Building a VirtualBox ISO with Packer

    2022-03-08

    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. So I went to GitHub where I saw a couple of issues that said set headless to true. Being new to packer, I didn’t really understand what that meant. After more reading I finally found it and decided I’d make this quick post about it.

  • VBoxManage - Manage VirtualBox VMs From The Command Line

    2022-03-07

    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.

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

    2021-02-19

    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
    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.

  • Detect Visitors DNS Provider

    2021-01-04

    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
    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.

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

    2020-10-30

    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.7/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
        from pip._internal.cli.autocompletion import autocomplete
      File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
        from pip._internal.cli.main_parser import create_main_parser
      File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
        from pip._internal.cli import cmdoptions
      File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
        from distutils.util import strtobool
    ModuleNotFoundError: No module named 'distutils.util'
    Error in sys.excepthook:
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
        from apport.fileutils import likely_packaged, get_recent_crashes
      File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
        from apport.report import Report
      File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
        import apport.fileutils
      File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
        from apport.packaging_impl import impl as packaging
      File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
        import apt
      File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
        import apt_pkg
    ModuleNotFoundError: No module named 'apt_pkg'
    
    Original exception was:
    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.7/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
        from pip._internal.cli.autocompletion import autocomplete
      File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
        from pip._internal.cli.main_parser import create_main_parser
      File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
        from pip._internal.cli import cmdoptions
      File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
        from distutils.util import strtobool
    ModuleNotFoundError: No module named 'distutils.util'
    

    Solution

    Don’t worry, it’s a pretty easy fix. The module not found error just means that the nessacary packages aren’t installed. To fix this, just run the following in the terminal:

  • How to Install Python 3.8 on Ubuntu 16.04 and 18.04

    2020-05-26

    The Zen of Python
    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. From this the Python ecosystem has grown into a massive juggernaut, encompassing everything from basic scripts to web applications, to machine learning algorithms, process automation and everything in between.

  • How to Install Telnet on Mac [2025]

    2020-05-25

    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 Sonoma and Sequoia (These are the steps that I have personally used to get Telnet back).

  • Setting up www-data for git deployment

    2020-05-25

    A brief guide about setting up the www-data account so it’s able to clone and/or pull from a git repo.

    This was done for GitHub, it will be a very similar process for other git hosting services, I believe.

    After creating a git repo and a githook listener (I’m planning a future post for this), there are a few more steps that need to be taking before the listener will be able to pull down the new code or posts. In my particular case the githook listener was running as www-data on Ubuntu.

  • Generate Wildcard SSL certificate from Let’s Encrypt using Certbot

    2020-05-24

    First make sure certbot is installed on your system, the instructions below assume that you’re using Ubuntu.

    If you just want to create the Certificate, skip to Step 2.

    Step 1: Installing Certbot

    First you’ll need to add the repository:

    $ sudo add-apt-repository ppa:certbot/certbot
    

    After that run update:

    $ sudo apt-get install certbot
    

    Now that certbot is all installed, it’s time for the certificate.

    Step 2: Generate The Wildcard Certificate

    certbot certonly \
    	--manual \
    	--preferred-challenges=dns \
    	--email letsencrypt@example.com \
    	--server https://acme-v02.api.letsencrypt.org/directory \
    	--agree-tos \
    	-d *.example.com
    

    Step 3: Verify Domain Ownership

    After executing the above step, Certbot will ask you to create a DNS text record.

  • ««
  • «
  • 1
  • 2
  • 3
  • 4
  • 5
  • »
  • »»
Recent posts
  • How to Update a File's Creation Time in PowerShell
  • How to Run PowerShell Code Only During Certain Times
  • PeopleSoft App Server Freeze Troubleshooting Checklist
  • Build Vim With Python3 Support
  • Understanding the ss Command: A Modern Alternative to netstat
© 2026 hakk
  • Home
  • Blog
  • Docs
  • DSA
  • Snippets