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

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

How to Install Telnet on MacOS Catalina

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. This instructions should work for MacOS Mojave and High Sierra but I happen to be running Catalina 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...

Exploring Python Metaclasses

In this post I will take a look at using the type keyword to create dynamic classes on the fly (metaclasses). I’ll focus on type first and then look at using it as it relates to creating metaclasses. Type The most widely known use of type is to determine the type of an object. Python is an object oriented language which means that everything has a type. Let’s take a look at some examples: Read more...
1 of 2 Next Page