Ben's Corner

Listening to Videos on Android with the Screen Off 2018-12-10 | 109 words

Android apps can make it surprisingly difficult to listen to videos. Often times, I want to turn on a video, then just turn the screen off and listen to it. Luckily, FireFox with some plugins will let me do that.

A Simple Go JSON API Server with Tests 2018-12-10 | 1429 words

I’m trying to make a small bookmarks server. I’m using code similar to this to create a server, and test 2 GET APIs. I’m incorporating the following ideas from Advanced Testing in Go:

Subtests/Table driven tests Golden files Test fixtures

Jupyter Lab on Docker 2018-10-24 | 341 words

Assuming you have Docker installed, setting up a basic Jupyter Lab environment is pretty easy! I’m going to be installing the jupyter scipy-notebook. The following command mounts a directory with the correct permissions for the Docker user to access it.

Setting Up Static IPs and DNS 2018-10-09 | 304 words

I want machines on my network to be able to talk to each other via hostnames (fqdns). Here’s how I set that up.

Short BASH Snippets 2018-09-09 | 684 words

Run a Server and open a browser with the link

Logging in Python 2018-09-05 | 752 words

The logging module is rather confusing, so I use it with code similar to the following.

Go Notes 2018-09-04 | 365 words

These are things I want to remember in Go

My Favorite Text Diagram Tools 2018-08-20 | 264 words

I love that diagrams can make difficult concepts intuitive. I hate that generally they’re stored in opaque binary formats, which make them difficult to version control, and that generally they’re created by clicking and dragging buttons and boxes around. Typing is generally much faster and less frustrating.

Pork Loin with Apple 2018-07-31 | 51 words

One day sometime last year (2017), I woke up and put the following into the crock pot for my turn at cooking the family meal. I don’t remember the exact measurements, but it was delicious.

Grandma Howe’s Povitica Recipe 2018-07-10 | 740 words

This isn’t my usual computery blog post, but it might be the most technical. This is a seriously complicated bread to make.

Grandma Howe’s Cheese Ball Recipe 2018-07-10 | 193 words

This is a cheese ball recipe Grandma Howe gave to us on a recipe card that’s delicious and not too hard to make. When I was younger, we kids would help Mom make this.

Learn Git 2018-03-26 | 392 words

Git is a famously powerful and famously confusing version control system used by software engineers everywhere. Increasingly, as other types of work begin to look more like software engineering (in my case network and systems engineering), git becomes useful for those folks as well. In that regard, here are some…

Short Python Snippets 2018-03-14 | 669 words

This is just a collection of Python snippits that are too small for their own posts. All code is for Python 3.

Ansible User Notes 2018-02-01 | 801 words

Ansible has two types of users: become_user and remote_user (and the deprecated ssh_user and sudo_user that I won’t cover). Here’s how to use them:

Printing Objects in Flask 2018-01-22 | 711 words

Recently I needed to painlessly enumerate a (simple) Python object’s properties in HTML to make a web page. I was creating different types of objects and I just wanted an easy way to print them. This post is how to do that in Flask.

Polymorphism in Handmade Hero 2018-01-12 | 1002 words

A while back, while watching Handmade Hero, I watched Casey demonstrate one way to produce polymorphism without inheritance (and the vtable pointer dereferencing penalty it carries). He did this by using a tagged union to hold the derived classes, and switching on the tag in the polymorphic method (actually a…

Fixing HTTPS CA Cert Issues 2018-01-11 | 972 words

Disclaimer: I’m very new to understanding SSL, and I haven’t yet put in the effort to be authoritative about this subject. This post describes how to work with a modified chain of trust from a VM without the last certificate installed.

Auto-printing Python Classes 2017-12-19 | 1317 words

This article examines different ways to generate repr functions. But, just to be clear, here are my recommendations in order:

An Isolated and Reproducible Ansible and Vagrant Setup on Mac 2017-10-27 | 1594 words

Ansible is a great tool for automating system maintenance. This is how I install it. My notes differ from the official ones in the following ways:

Learn SQL 2017-10-10 | 381 words

SQL is one of the best benefit/cost skills to learn. It’s fairly easy to learn, and it immediately becomes useful for many jobs- including software engineering, accounting, law, or any other job that deals with data.

Simple Blog Post Stats 2017-10-08 | 854 words

I got curious about the word count in my blog. When I generate the static site, I simply count whitespace separated strings as words, but this will automatically include code sections. To find out how much prose I wrote, I need to process each blog post, ignoring the front-matter (information…

Anaconda Python Bash Functions 2017-10-07 | 434 words

Conda Env Management

REST Server and Client in Python 2017-09-22 | 482 words

I recently demonstrated a very quick REST backend server and client in Python for an intern, and I thought I’d paste the code here.

Ansible Plus Flask 2017-08-24 | 516 words

I was lurking on the networktocode Slack channel, when someone asked how to get variables from an external system into an Ansible playbook. Intrigued, I mocked up a quick Flask server to serve a REST API, and a playbook to consume it. This proof of concept happily ignores a lot…

Changing words quickly with Vim 2017-08-11 | 541 words

I try to use Vim shortcuts to automate repetitive text-editing tasks. Here are two examples.

Dropbox as a systemd service 2017-08-04 | 413 words

If you’ve ever worked with Dropbox on Linux, you know that you basically download a script, untar it, and execute it.

Tiling Crosses (Linear Algebra in disguise) 2017-08-03 | 857 words

I was doodling with crosses on graph paper and was surpised to see that I could cover the graph paper with only cross shapes. They also look pretty neat when colored oddly, so I wrote code producing images similar to the below image to play with them more efficiently. While…

RSync From Android 2017-07-18 | 294 words

Every once in a while, I like to transfer a folder from my Android phone to my Mac. This folder has new content added every once in a while, and the files get large, so I don’t want to re-transfer the already-sent files. Rsync is a perfect tool for this….

Reproducible Python Environments with Conda 2017-05-17 | 1043 words

By default, Python doesn’t handle binary dependencies very well. There have been several occasions when I’ve tried to pip install library and it just choked on me because it was trying to compile something and I didn’t have the magic combination of compiler versions and build tools needed. At the…

Windows Volume Control with AHK 2017-05-13 | 145 words

This is some code I use at work to control my laptop’s volume and mute it when the I locked the device. It was born from the frustration I felt when frantically tying to silence my music while my coworkers laughed at me that one time I locked my screen…

Path Name Conventions 2017-05-03 | 192 words

I recently did some BASH scripting that dealt a lot with paths. I want to record here for posterity the conventions I used to keep things straight, copied straight from the code.

Creating a shared folder in Linux 2017-04-25 | 285 words

Sometimes it’s useful to change a folder’s setting so multiple users can access it.

Troubleshooting Connections 2017-01-30 | 917 words

I recently had to set up a server with some legacy code that needed two database connections that just wouldn’t connect. This is how I troubleshooted it

Clearing Large Files 2017-01-23 | 443 words

I have a couple methods to clear large files. First of all, if the files are repetitive, logrotate looks to be the best way to roll.

Easiest way to turn a Jinja2 template into an HTML file 2017-01-17 | 103 words

The docs talk about using the environment or whatever, but for my use case, I usually prefer the FileSystemLoader:

Vim Color Schemes 2016-12-18 | 1030 words

One of the joys of [Neo]Vim is the amount of color schemes available. The editor ships with several colorschemes by default, but adding more is what Vim was made to do!

On Errors in Repeated Functions 2016-12-16 | 996 words

Recently I found myself parsing several similar XML files in Python. The XML had a deeply nested structure I wanted to get stuff out of, which means using Python’s xml.etree.ElementTree’s find and findall methods:

Saving YouTube Playlists to Android 2016-09-25 | 135 words

I use the following method to update the songs on my Android phone:

Removing Passwords from a Git Repo 2016-09-19 | 344 words

When googling how to remove passwords from a git repository, I found this very helpful link.

BASH Logging Function 2016-09-09 | 150 words

This is a small BASH logging function to record the output of a command:

Saving For Retirement 2016-07-16 | 703 words

I got an email a couple of months ago from a coworker about saving for retirement that included the following graph:

Setting Up PowerShell Updated 2016-07-14 | 226 words

I’ve streamlined and improved my method of installing PowerShell:

Save Git Passwords 2016-07-13 | 49 words

I save my github usernames on my local machine with the following command:

SQLite3 Conveniences 2016-07-11 | 497 words

Using the sqlite3 command prompt is a pain on my linux box. For some reason, the standard keyboard shortcuts don’t work over SSH, so I can’t backspace, get previous commands, or use other basic shell manipulation commands.

Vagrant and Chef 2016-06-23 | 406 words

Using Vagrant to play with Chef

Quick Python Diff 2016-06-13 | 180 words

If you need a quick, cross-platform diff between files that makes a nice HTML document for your perusal, Python has your back:

MySQL To File 2016-06-06 | 198 words

How To Use a MySQL command on the BASH command line

Visual Studio with SourceTree 2015-03-23 | 439 words

When working on long or complicated projects, source control can save a lot of heartache. Git is becoming the standard source control tool, and I use a program by Atlassian called SourceTree to easily manage my repositories. In this blog post, I’m going to set up a repository (uesually shortened…

How I Blog 2015-03-23 | 717 words

Here are some notes about making blog posts (especially easily adding images).

Wallpapers From Reddit 2015-02-28 | 514 words

A while back, I found a nice script to download wallpapers from Reddit. It originally only downloaded wallpapers from one subreddit at a time, so I made a fork to handle multiple subreddits and use a JSON configuration file (the multiple subreddits feature has since been merged into master).

Setting Up PowerShell 2015-02-23 | 890 words

This is a post about how to use Powershell, the text-based interface to Windows. Now, why would we want to use Powershell? The biggest reason is automation. A person who knows Powershell can automate repetitive tasks away.

My First Real Post!! 2015-02-23 | 17 words

I hope to do many exciting things here!