Fabian

Python: Using Flask to upload files

If you are looking for basic HTTP file uploading using Flask, you can use the code in my python-flask-upload-files project on github as an example. This project exercises multiple scenarios: Upload a single file in chunked mode (not forced to save entirety to disk) Upload a single file Upload multiple files Error message shown when Python: Using Flask to upload files

Python: Using Flask to stream chunked dynamic content to end users

If you are using Flask to generate dynamic content of significant size, such as large binary images/pdf or large text-based datasets, then you need to consider streaming to minimize the memory footprint of Flask and preserve scalability. Using an inner generate function and a yield allows Flask to return chunks of data back to the Python: Using Flask to stream chunked dynamic content to end users

Zabbix: Using Docker Compose to install and upgrade Zabbix

Zabbix distributes Docker images for each component.  Not only does this mean you can quickly standup the monitoring solution, but upgrades also become a simple matter of trading up images. In this article, I will show how to stand up and then upgrade a zabbix installation using docker-compose.

Docker: Installing Docker CE on Ubuntu bionic 18.04

Update Dec 2021: I have written an updated article for installing Docker on focal 20.04 Docker is a container platform that streamlines software delivery and provides isolation, scalability, and efficiency with less overhead than OS level virtualization. These instructions are taken directly from the official Docker for Ubuntu page, but I wanted to reiterate those Docker: Installing Docker CE on Ubuntu bionic 18.04

Python: Using inspection to view the parameters of a function

The ability to use introspection to dynamically determine the current code context and frame/stack can be a powerful tool for a developer. Introspection can be applied for debugging, logging, metrics collection, or method overloading based on type.  I will show a simple example of its usage in this article.

Python: Getting live output from subprocess using poll

Using subprocess.Popen, subprocess.call, or subprocess.check_output will all invoke a process using Python, but if you want live output coming from stdout you need use subprocess.Popen in tandem with the Popen.poll method. In this article I will show how to invoke a process from Python and show  stdout live without waiting for the process to complete.  Python: Getting live output from subprocess using poll

Python: Parsing command line arguments with argparse

Especially when writing small Python utility programs, it can be tempting to use sys.argv to retrieve a small list of positional parameters from the command line.  But small utilities turn into successful tools over time, and manually parsing optional parameters and switches will quickly overwhelm your code logic. In this article I will show how Python: Parsing command line arguments with argparse

OpenWrt: Installing tcpdump from opkg

For troubleshooting deep rooted network issues, you may be accustomed to using tcpdump against a network interface on Linux. This same utility can be used on OpenWrt to troubleshoot network issues.   The Opkg Package manager makes this easy to install.

KVM: Creating a bridged network with NetPlan on Ubuntu 18.04 bionic

UPDATE September 2022: New article for bridged networks written for Ubuntu 22.04 In order to expose KVM virtual machines on the same network as your Host, you need to enable bridged networking. In this article, I’ll show how to implement KVM bridged networking on Ubuntu 18.04 bionic using Netplan.  This bridged network will expose the KVM: Creating a bridged network with NetPlan on Ubuntu 18.04 bionic

Git: BFG for removing secrets from entire git history

If you accidentally pushed a secret or password into a git repository, the BFG Repo-Clean utility is a convenient option for removing all traces of the secret from the entire git commit history. It is also possible to use ‘git-filter-branch‘, but I find BFG more convenient and faster.

VMware: Using the govc CLI to automate vCenter commands

The vSphere web GUI is a nice visual tool, but if you need to retrieve vCenter information in bulk or perform mass operations across VMs, then a command line tool such as govc in invaluable. govc is written in Go, which means it has support on Linux as well as most other platforms.

Ubuntu: X2Go on Ubuntu bionic for remote desktop access

Updated April 2023: Tested on Ubuntu 22.04 LTS with X2GO sever 4.1.0 X2Go provides remote desktop access for Linux, similar to VNC or xRDP.  It tunnels over ssh which can provide SSH public key authentication for security and is easily understood when opening firewall rules. Additionally, it is optimized for narrow bandwidth requirements, making it Ubuntu: X2Go on Ubuntu bionic for remote desktop access

Git: client error, server certificate verification failed

Especially with private git repositories that may be self-signed or have private CA, you may get the following error from the git client after a certificate has been updated: fatal: unable to access ‘https://git.mycompany.com/myuser/myrepo.git/’: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none This means that the git client cannot verify the integrity of the certificate Git: client error, server certificate verification failed

CloudFoundry: CLI error, unexpected end of JSON input

If you receive this error upon trying to run commands from the CloudFoundry CLI: “Error read/writing config: unexpected end of JSON input” This is most likely due to an error in the “$HOME/.cf/config.json” file.  Make sure the user has full ownership: ls -l ~/.cf/config.json chown $USER:$USER ~/.cf/config.json chmod 755 ~/.cf/config.json And if that does not CloudFoundry: CLI error, unexpected end of JSON input

CloudFoundry: The lifecycle of a simple BOSH release

BOSH is a project that unifies release, deployment, and lifecycle management of cloud based software. Software to be deployed via BOSH is called a release, and in this article I will use a very simple release to illustrate how to create, deploy, version, and revert these releases.

CloudFoundry: Installing a BOSH Director on AWS

BOSH is a project that unifies release, deployment, and lifecycle management of cloud based software.  It also serves as the underlying infrastructure for deploying the CloudFoundry PaaS. In this article, I will lead you through deploying the BOSH Director to Amazon EC2 which is the first step in deploying both CloudFoundry CFAR as well as CFCR CloudFoundry: Installing a BOSH Director on AWS

AWS: Installing the AWS CLI on Ubuntu

Amazon EC2 provides a web interface for managing IaaS, but for repeatable infrastructure deployment what you really want is the ability to deploy and manage this infrastructure using an API or command line tool. In this article we want to focus on the CLI (command line interface), which shields us from the API innards and AWS: Installing the AWS CLI on Ubuntu