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

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

If you’re using Ubuntu 16.04, 18.04, 20.04 whether you upgraded or freshly installed and want to use a newer version of Python from 3.7 to 3.8 you have probably seen this error message ModuleNotFoundError: No module named 'distutils.util'. 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. 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 MacOS Catalina (and Monterey)

Have you found yourself needing to use Telnet on MacOS? Rest assured that you’re not alone, as you have probably discovered Telnet has been removed from modern versions of the system software starting from MacOS Mojave and newer. These instructions should work for MacOS Mojave and High Sierra but I happen to be running Catalina Monterey and this it what I did to get Telnet back. Installing Telnet on MacOS with Homebrew First I would like to mention that there is an easier route, that is using Homebrew. Read more...

Setting up www-data for git deployment

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

Generate Wildcard SSL certificate from Let’s Encrypt using Certbot

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

Ubuntu apt update/upgrade sa-compile E: Sub-process

A quick post with some notes on how to solve this issue. When running apt update and apt upgrade on Ubuntu I received this error message: Errors were encountered while processing: sa-compile E: Sub-process /usr/bin/dpkg returned an error code (1) So I tried running sa-compile myself which returned the following: sa-compile: not compiling; 'spamassassin --lint' check failed! It wasn’t obvious to me at first but running spamassassin --lint helped. It lead me to my main. Read more...

Python One liners

A couple of helpful(?) one liners in python, I use these for quick development or when troubleshooting and testing. Start a static file http server in the current directory python -m http.server If you only want it to listen on localhost you can pass a bind parameter python -m http.server --bind 127.0.0.1 It’s also possible to specify a port (default is 8000) python -m http.server --bind 127.0.0.1 8080 If you need an smtp server for trouble shooting, it’s possible to fire one of those up in one line. Read more...

Setting up MariaDB on FreeBSD

This will briefly cover building from source and some notes for some silly mistakes that I made and how to “fix” them or at least get things working. Let’s get started. Make sure everything is up to date Before starting anything else make sure that all ports are there and up to date. root:~/# portsnap fetch update && portupgrade -a Note: If this is new install you might need to extract first, portsnap extract. Read more...
1 of 2 Next Page