Ben's Corner Blog
SSH to a Shell 2024-12-20 | 180 words
I have a project on a VM I always need to start the same way: ssh myvm zsh # start zsh manually because I don't wnat to change the startup shell cd ~/path/to/project Today I figured out how to r…
Two Phase Initialization 2024-11-20 | 224 words
I recently ran into two phase initialization at work but didn't remember the name. Basically, two phase initialization looks like this: type Object struct { Res Resource } func NewObject() *Object {…
My Favorite Things in California 2024-07-30 | 147 words
TODO: flesh this out, add pics and such. Ben’s Maps Want to go: https://maps.app.goo.gl/nDS3WKLqhExcpBM66 Favorites: https://maps.app.goo.gl/AcbbEnE28rxxEzen6 Favorite Hikes: https://maps.app.goo.gl/…
SQL Naming Conventions 2024-03-27 | 1003 words
Let's have some fun writing some SQL naming conventions/standards so I can keep envelope's database sane. I feel like I might be over-engineering by creating my own, yet another, SQL naming standard, …
Taiwan Family Trip 2024-03-07 | 55 words
I want to keep some notes and photos of our Oct 2023 family Taiwan Trip! TOOD: flesh this out when I have more time - add pictures and thoughts on places! Food Some of the unique foods we ate are: Fe…
App Launcher Showdown 2024-02-19 | 330 words
Background I currently use Spotlight search to open apps. Clifford suggested I use RayCast. I really just want something Requirements Settings that are easily version controllable launch apps run tic…
Favorite Things 2024-01-24 | 787 words
I figure it might be fun to write down some of the more useful and interesting things I've acquired, both to remind myself how to find them and also to smirk at younger me's favorite items as the year…
The Perfect Schedule 2024-01-23 | 172 words
Even if I can't get 100% to this "perfect schedule", generally the closer I get, the happier I am. Making sure I have a "spot" for everything I want/need to get done relieves guilt about not listening…
Go Code Notes 2023-12-27 | 1920 words
These are notes on writing good Go Code. Also see Go Developer Tooling. and Go Project Notes Notes on testing Some notes on testing in Go. A lot of these notes came from Advanced Testing in Go (Hashim…
Go Project Notes 2023-12-27 | 1533 words
Engineering is programming integrated over time - Titus Winters Motivation I'm managing enough Go side projects now that they have "weight" - I'm duplicating and modifying config files for each repo…
Family Picture 2023 2023-12-11 | 92 words
Here's what we and my side of the family look like these days! It's been over a year since I last visited Arkansas (days before my son was born) and I want to make this pic easy to share with family a…
Argparse Template 2023-08-29 | 617 words
Subcommand Skeleton Python's argparse library is super flexible. I want to use it to design CLIs like the azure-cli, with the following structure (imagine a conversation-generator CLI): conversation-g…
Floating Point Notes 2023-08-18 | 1829 words
Back on January 26, 2023, I presented What Every Computer Scientist Should Know About Floating-Point Arithmetic to a small book club I attend. Printing out that appendix turns it into like a 30 page p…
Exercises For Knee Pain 2023-08-18 | 338 words
I started going to the gym a lot more Dec 2022 to lower my A1c, and in April, I got some persistent knee pain, especially when doing squats and lunges. I got a lot of advice, and, as of Aug 2023, a co…
Monthly Banking Report 2023-08-05 | 1287 words
After commenting on Hacker News, a few people asked me how I use Polars to process my banking CSVs. While I don't feel comfortable open-sourcing the repo because the code contains information about th…
Copy URL as Rich Text 2023-08-01 | 352 words
Last time I tried the MS Edge browser, I really liked the "copy URL from the address bar and get a rich text link containing the title and URL" feature. In contrast, copying the URL from the address b…
Go Developer Tooling 2023-02-18 | 99 words
My Go repos use several tools to make development easier. I develop on a Mac, so install instructions are MacOS-focused. See example-go-cli for a repo using these tools. Also see Go Project Notes. pan…
Baby Activities 6-9 Months 2023-02-05 | 3188 words
Our hospital gave us a PDF with this information for our child. The information is great, but the PDF font is small so I've copied it into my blog. There was no source for this information in the PDF,…
Go Dependency Injection With Functions 2022-02-24 | 447 words
I'm writing warg to parse my CLI apps. In some cases, I want to be able to read an environmental variable into a data structure. I started doing this and it worked fine: func Work() { // ... lots …
How I Take Notes 2022-02-11 | 1700 words
Background This section is a little wordy... feel free to skip to Requirements for the meat of this post. As an SRE, I work with a number of protocols, systems, and languages, but also get interrupted…
Azure Functions With Terraform 2021-12-13 | 5309 words
Over the last several months, I've been prototyping with Azure Functions and Terraform when I have time. Ideally, I see Azure Functions as a great way to manipulate Azure resources in response to even…
Mac Menu Bar Meeting Apps 2021-11-28 | 236 words
At work, I go to a lot of virtual meetings and it seems like each one uses a different video calling app (in reality, there's only two or three, but this is my blog and I'll exaggerate if I want to). …
Password Management 2021-09-12 | 387 words
I use a password manager to hold all my username/passwords and I love it. I used to try to reuse passwords and write them down on paper, but as everyone who does that knows, it doesn't work very well.…
Azure Resource Naming 2021-08-02 | 270 words
Naming Azure resources can be difficult. You want to include relevant information into the name, but also not make it too long too remember. You want to keep your names consistent, but some things are…
A Fancy Makefile 2021-07-28 | 182 words
Once in a while, I need to create a Makefile to shorten some tasks running. Makefiles have weird syntax, and don't usually have help generated, but I found this one, shortened it, and added some comme…
Creating an OpenSSL CSR 2021-06-12 | 837 words
If you want to make a TLS certicate, you need a Certificate Signing Request (CSR). Let's make one! I've verified that this produces a CSR suitable for pasting into DigiCert to get a certificate. Makin…
Learn SSL 2021-06-08 | 1253 words
SSL is one of those weird niche subjects that no one learns until they run into a problem. It's confusing because there's a lot of moving parts, file formats, and terminology. For example, SSL (Secure…
LinkedIn Recruiters Over Time 2021-05-30 | 871 words
I try to reply to every message I get on LinkedIn, and, every week, it seems like more messages appear. Recently, I downloaded all messages every sent from my Member Data Page and used SQLite to poke …
Tracking Work Faster With Command Line Jira 2021-02-11 | 727 words
Thank you Matt Doar and Josiah Bradley for reviewing this post. TL;DR: go-jira is super nice. Creating Jira tickets is necessary, slow, and annoying Tracking my work is super important. At Linkedin, w…
SQL Schemas from the Terminal with SchemaSpy 2021-01-17 | 306 words
I'm building an app backed by MySQL and I need to easily see what its columns are and how they relate to each other so I can write good SQL queries against it. Fortunately, the database geniuses inven…
Creating an Azure Key Vault Certificate with Go 2020-11-29 | 1004 words
So... I need to make a TLS certificate in an Azure Key Vault with Go. I thought this would be easy - just authenticate, then make the certificate. However, the Go SDK seems mostly auto-generated and i…
My Workstation 2020-11-15 | 607 words
Desk - I bought an Uplift Desk from https://www.upliftdesk.com/: Desktop Style: Rustic Reclaimed Fir (+$500.00) - in hindsight bamboo would have been cheaper, probably lighter, smoother (the reclai…
Sad Work-from-home Meals 2020-11-01 | 109 words
When the office closed during the pandemic, my work stopped feeding me daily and I, like so many Bay Area tech workers, was forced to cook for myself. We bedraggled individuals banded together on our …
JSON JQ Snippets 2020-05-02 | 114 words
Here are some snippets for use with jq and some other random JSON tips. See "path" to element Open it in VS Code, put your cursor on the part you want to know about and check out the breadcrumbs on th…
Long Shell Oneliners Without the Pain 2020-04-16 | 463 words
I love working in my terminal. It has a ton of useful programs that you can stitch together to do useful things. However, sometimes these commands can get long. For example, here's a command I use to …
Checklists And Sayings 2020-12-17 | 1034 words
These are fairly small lists that I want to read every once in a while. Releasing Software for Humans Design from the user perspective Don't advertise until close to finishing Timing is important. Do…
Software Engineering Ideas That Influence Me 2020-09-10 | 2007 words
I watch a lot of conference talks on YouTube and I read a lot of software engineering articles. Some of that media has really helped me become a better engineer. As a relative newcomer to engineering,…
Bible Verses About Charity 2020-12-10 | 2984 words
These are some of my favorite verses about love. Click the header to go to read the entire book chapter and the text to expand the verse selection inline. All verses are in the King James Version (KJV…
My Favorite things in Arkansas 2020-02-09 | 270 words
Some of my favorite things in Arkansas: Food Maddie's Place Great steak Lindsey's Hospitality House BBQ / Soul Food! Corky's Ribs & BBQ Love the dry ribs with extra dry rub Eat My Catfish Great …
Getting Started with Podcasts 2019-07-21 | 429 words
Do you like history or news or science fiction? Do you drive a lot or like to listen to things while you work? If so, you should really try out podcasts! Podcasts are audio shows that you can find on…
Learn Python 2020-09-04 | 792 words
Python has exploded in popularity recently. There are great reasons for this. It's famously one of the easiest programming languages to learn and it has a bunch of great libraries for things like data…
Jupyter Notebooks with Plotly 2019-04-18 | 273 words
Plotly is my current favorite Python graphing library. Here's how to use it with Jupyter Notebooks Install Anaconda Python Install from the website. If it gives you the option to add Python to the PAT…
A Simple Go JSON API Server with Tests 2018-12-10 | 441 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…
Listening to Videos on Android with the Screen Off 2018-12-10 | 126 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…
Jupyter Lab on Docker 2018-10-24 | 282 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 …
Setting Up Static IPs and DNS 2018-10-09 | 297 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. Router On my local router (a TP-Link Archer C3150), I set up static IPs for each device.…
Short BASH Snippets 2021-01-20 | 1263 words
BASH script starter I put this at the top of all my scripts because most of the time I want scripts to fail on errors, and half the time I want the script to run in the directory it's in. #!/bin/bash …
Logging in Python 2019-11-05 | 1067 words
Setting up logging with the tweaks I want The logging module is rather confusing, so I use it with code similar to the following. Logging is fun to add when netmiko isn't doing it's ***ing job and I h…
Diagram Tools 2019-04-08 | 558 words
I love that diagrams can make difficult concepts intuitive. Here are some of my favorite diagram tools. When possible, I prefer open source tools and text -> image diagram makers. Quick Database Di…
Learn Git 2019-01-26 | 1348 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…
Short Python Snippets 2021-01-29 | 1021 words
This is just a collection of Python snippits that are too small for their own posts. All code is for Python 3. Also see Logging-in-Python Inline Multiline Strings This is a quick post on inline multil…
Ansible User Notes 2018-02-01 | 659 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: remote_user is the account that logs into the machin…
Printing Objects in Flask 2018-01-22 | 520 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 …
Polymorphism in Handmade Hero 2018-01-12 | 693 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 us…
Fixing HTTPS CA Cert Issues 2018-01-26 | 903 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 with…
Auto-printing Python Classes 2017-12-26 | 963 words
This article examines different ways to generate __repr__ functions. But, just to be clear, here are my recommendations in order: Immutable data: typing.NamedTuple (Python >= 3.5) collections.nam…
An Isolated and Reproducible Ansible and Vagrant Setup on Mac 2021-02-08 | 1318 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: I install as much of this software as I can isolated…
Learn SQL 2019-03-26 | 477 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 …
Simple Blog Post Stats 2017-10-08 | 479 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…
Anaconda Python Bash Functions 2017-12-21 | 256 words
Conda Env Management I use conda for all of my Python projects. Because I'm so often making a project directory, then making a conda environment with the same name, I've created the following code to …
REST Server and Client in Python 2017-09-22 | 373 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. The Server The Server's job is to grab/calculate information from so…
Ansible Plus Flask 2017-08-25 | 354 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 …
Changing words quickly with Vim 2017-10-15 | 507 words
I try to use Vim shortcuts to automate repetitive text-editing tasks. Here are two examples. Differentiating Code and Files While walking a user through an internal README, she mentioned that she want…
Dropbox as a systemd service 2018-01-02 | 403 words
If you've ever worked with Dropbox on Linux, you know that you basically download a script, untar it, and execute it. I use the following Ansible task to install it: - name: Install dropbox shel…
Tiling Crosses (Linear Algebra in disguise) 2017-10-08 | 688 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 i…
RSync From Android 2021-01-17 | 485 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…
Reproducible Python Environments with Conda 2017-10-20 | 1070 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 som…
Windows Volume Control with AHK 2017-07-31 | 135 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 cowo…
Path Name Conventions 2017-05-03 | 145 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. # Naming Conventions …
Creating a shared folder in Linux 2018-01-09 | 245 words
Sometimes it's useful to change a folder's setting so multiple users can access it. Here's how I do that. After this, all members of the group apache will be able to create files and directories under…
Troubleshooting Connections 2017-05-19 | 877 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 Troubleshooting the first broken database conne…
Clearing Large Files 2017-12-26 | 259 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. If not using logrotate though, here's a few methods I've found. Fir…
Easiest way to turn a Jinja2 template into an HTML file 2017-07-31 | 63 words
The docs talk about using the environment or whatever, but for my use case, I usually prefer the FileSystemLoader: import jinja2 as j2 # need a templates folder to look into (or change it to '.&#…
Vim Color Schemes 2017-02-13 | 959 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! Before we begin, know that Vim,…
On Errors in Repeated Functions 2021-02-08 | 671 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 fin…
Saving YouTube Playlists to Android 2017-08-13 | 118 words
I use the following method to update the songs on my Android phone: Change to the correct directory cd ~/Music/YouTube Use youtube-dl to download my songs playlist. This answer on askubuntu was ve…
Removing Passwords from a Git Repo 2016-12-26 | 180 words
When googling how to remove passwords from a git repository, I found this very helpful link. It was so helpful, I turned it into the following Python script: import shutil import subprocess as sp impo…
BASH Logging Function 2016-12-25 | 105 words
This is a small BASH logging function to record the output of a command: function logit { today=$(date +%Y-%m-%d.%H.%M) "$@" > >(tee "$1".stdout."$today".lo…
Saving For Retirement 2016-12-25 | 539 words
I got an email a couple of months ago from a coworker about saving for retirement that included the following graph: Being very interested in retiring someday, I wrote a quick python script to calcul…
Setting Up PowerShell Updated 2016-12-25 | 213 words
I've streamlined and improved my method of installing PowerShell: First, run the cmd script as Administrator to install chocolatey and PowerShell version 4, and allow powershell scripts to be run. The…
Save Git Passwords 2017-08-04 | 39 words
I save my github usernames on my local machine with the following command: git config --global credential.https://github.com.username <my_username> If I mess up the command, I fix it by editing…
SQLite3 Snippets 2020-05-02 | 327 words
Also see my related posts, LinkedIn Recruiters Over Time and Learn SQL Clients The default sqlite3 shell works ok, especially if it's customized. litecli works well too - here's my config. Beekeeper S…
Vagrant and Chef 2020-03-20 | 319 words
Using Vagrant to play with Chef I'm using chef to provision some machines from Windows, and here's the process I did it with: On Windows Install choco and a modern Powershell. Install vagrant, virtual…
Quick Python Diff 2016-12-25 | 104 words
If you need a quick, cross-platform diff between files that makes a nice HTML document for your perusal, Python has your back: import difflib first_name = 'firstname.txt' second_name = 's…
MySQL To File 2016-12-25 | 167 words
How To Use a MySQL command on the BASH command line If you want to print the output from the SQL commands in one file to another, use: mysql -u <username> --password='<password>' &…
How I Blog 2016-12-25 | 673 words
Here are some notes about making blog posts (especially easily adding images). posts are in the \_posts/ folder. a post must be named according to the date and then the title of the post: \_posts/201…
Visual Studio with SourceTree 2016-12-25 | 425 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…
Wallpapers From Reddit 2023-12-19 | 394 words
Update: 2023-12-19: I've since written grabbit to download my reddit images. It's much easier to install than reddit_get_top_images A while back, I found a nice script to download wallpapers from Re…
My First Real Post!! 2020-06-17 | 15 words
I hope to do many exciting things here! Here's a LaTeX equation: $$x^2 = 1$$
Setting Up PowerShell 2016-12-25 | 894 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 …