Author Archives: timwarnock


Typically, you would use mysql client cli as follows, You could also create a ~/.my.cnf file to set default properties, including connection info, You could even store a password but I wouldn't recommend storing it in the clear. Also, the above … Continue reading

Posted in bash, mysql, shell tips

FP Error Handling

I would like to handle errors in pure FP (functional programming), something more idiomatic and easier to read than nested try/catch blocks. Let's say we have the following procedure, This is pretty straightforward. Given a list of numbers (represented as … Continue reading

Posted in scala, software eng.

How to Find a Job as a Software Engineer

Software Engineering as changed a lot since the 1990s: we've seen the rise of the Internet, smartphones, machine learning, and a golden age of programming languages. Yet despite the technological advances, the actual process of finding a well-paying job as … Continue reading

Posted in software eng.

Extremely Large Numeric Bases with Unicode

Previously, we discussed using Punycode for non-ASCII domain names with internationalized URLs, e.g., https://去.cc/叼 I would like to use this approach to create a URL Shortening Service, where we can create shortened URLs that use UTF-8 characters in addition to … Continue reading

Posted in python

PseudoForm, a Bot-resistant Web Form

I would like to create an HTML form that is resistant to bots. This could be a classic comment form or really any web-accessible form. In most cases, requiring authentication and an authorization service (such as OAuth) would be sufficient … Continue reading

Posted in css, html, javascript, python

multiple git remotes

I would like to manage a project across multiple remote git repositories, specifically, a public github repository and my own private repositories. Fortunately, git supports as many remote repositories as you need. When you clone a repository, there will be … Continue reading

Posted in git, software eng.

OOP or Procedural?

I would like to know when it is best to use object-oriented programming, and when it is best to use procedural programming. tl;dr: neither, go with functional programming By procedural programming, I mean the kind of code you'd find programming … Continue reading

Posted in c, java, software eng.

Trie or Set

Given a grid or input stream of characters, I would like to discover all words according to a given dictionary. This could be a dictionary of all English words or phrases (say, for an autocomplete service), or for any language. … Continue reading

Posted in data arch., python


I would like to iterate over a stream of words, say, from STDIN or a file (or any random input stream). Typically, this is done like this, And then one can simply, For a more concrete example, let's say we … Continue reading

Posted in python


I would like a webapp that supports UTF-8 URLs. For example, https://去.cc/叼, where both the path and the server name contain non-ASCII characters. The path /叼 can be handled easily with %-encodings, e.g., Note: this is similar to the raw … Continue reading

Posted in python

Using getattr in Python

I would like to execute a named function on a python object by variable name. For example, let's say I'm reading in input that looks something like this: enqueue 1 enqueue 12 enqueue 5 enqueue 9 sort reverse dequeue print … Continue reading

Posted in shell tips

Graph Search

I would like to discover paths between two nodes on a graph. Let's say we have a graph that looks something like this: The graph object contains a collection of nodes and their corresponding connections. If it's a bi-directional graph, … Continue reading

Posted in python, software eng.

python unittest

I would like to setup unit tests for a python application. There are many ways to do this, including doctest and unittest, as well as 3rd-party frameworks that leverage python's unittest, such as pytest and nose. I found the plain-old … Continue reading

Posted in python

HTML + CSS + JavaScript Lessons

I would like a very simple introduction to web development, from the basics of HTML and CSS, to the proper use of JavaScript; and all without getting bogged down in complicated textbooks. I've been working with HTML, CSS, and JavaScript … Continue reading

Posted in css, html, javascript

bash histogram

I would like to generate a streamable histgram that runs in bash. Given an input stream of integers (from stdin or a file), I would like to transform each integer to that respective number of "#" up to the length … Continue reading

Posted in bash, shell tips