Posted on Mon, 05 Feb 2018 by adamlamers
Most SQL files contain interpreter commands such as DELIMITER that make passing the commands through to pymysql somewhat difficult, this code snippet allows you to separate out the statements in the sql file into a list for sequential execution.
Posted on Fri, 09 Dec 2016 by adamlamers
A fast locate-like tool that you can carry with you in your dotfiles, that only uses basic binaries available on most systems. Searches through a compressed database of file locations on your hard drive that you can search with "flocate". I called it flocate to avoid conflicts on systems that have a proper installation of locate.
Posted on Thu, 17 Mar 2016 by adamlamers
Easily create a list of commands selectable with arrow keys.
Posted on Fri, 29 Jan 2016 by adamlamers
I've been looking at walls of JSON for the last few days, and realized that I really shouldn't be doing that. So I made a script that will continuously indent and output a stream of JSON data formatted and indented properly.
Posted on Wed, 20 Jan 2016 by adamlamers
I discovered this trick while trying to do some quick investigation in Vim, and
not wanting to have to leave the editor, found a way to quickly replace Python
code (or anything you can pipe to an external command) with it's output in Vim.
What you do is, write the code inside a buffer, then select it in visual mode.
Once it's selected, press : and you will get Vim's
:'<,'> range, which
means all the text between the beginning and end of the visual cursor.
Posted on Tue, 12 Jan 2016 by adamlamers
I couldn't find something to check my powerball numbers online without downloading some phone app. I just wanted to plug in my numbers, and see if I won anything without having to check each line one-by-one and figure it out manually. So I spun off a ticket checker from my simulator so I don't have to do that anymore.
Posted on Thu, 17 Dec 2015 by adamlamers
Part 1 of a tutorial series on writing C extensions for Python 3. This part begins with teaching how to write Hello World to stdout using printf() from a C method implementation.
Posted on Mon, 12 Oct 2015 by adamlamers
In this post, I show how I set up this blog step-by-step from square one using DigitalOcean, Flask, Python, Gunicorn, MongoDB and nginx.