grant horwood

grant horwood @gbhorwood

About: longform content that assumes linux.

Location:
Calgary, Alberta
Joined:
May 15, 2019

grant horwood
articles - 38 total

php: writing command-line applications with macrame. pt 2

in this series, we've been looking at how to write command line applications in php using macrame. in...

Learn More 6 0Feb 19

php: powerful sorting with usort

i recently worked on a rescue project where the original dev wanted to sort an array of item objects...

Learn More 1 0Feb 7

php: writing command-line applications with macrame. pt 1

php doesn't get a lot of attention as a command line scripting language. which is a shame, since php...

Learn More 1 4Jan 29

vim: five tips to become a more mediocre vim user

i am a mediocre vim user. sure, i've been using vim for over twenty years, have handcrafted a custom...

Learn More 1 0Sep 30 '24

mysql: “thai food near me”, or: doing geo distance calculations in your database.

we're all familiar with the whole "thai food near me" thing. you type that phrase into your phone and...

Learn More 2 0Sep 20 '24

nginx: putting your site in ‘downtime’ for everyone except you

we've all been in that less-than-ideal situation of something going horribly awry in production and...

Learn More 1 0Sep 6 '24

php: concurrency with processes. pt. 2: interprocess communication with shmop

php isn't the sort of language where developers usually think about things like memory. we just sort...

Learn More 5 2Aug 19 '24

php: concurrency with processes. pt. 1: using pcntl_fork for fun and performance

i often joke that php is a systems programming language that you can also use to create a home page....

Learn More 8 1Jul 24 '24

php: write php 8.4’s array_find from scratch

there’s an rfc vote currently underway for a number of new array functions in php8.4 (thanks to...

Learn More 4 0Jul 9 '24

amber: writing bash scripts in amber instead. pt. 4: functions

a while ago, i blogged about uploading files to s3 using curl and provided the solution as two...

Learn More 0 1Jul 3 '24

amber: writing bash scripts in amber instead. pt. 3: the standard library

a programming language is only ever going to be as good as its standard library. try writing a c...

Learn More 1 2Jun 28 '24

amber: writing bash scripts in amber instead. pt. 2: loops and ifs

in this series we're looking at using the amber language to write scripts that transpile into bash....

Learn More 2 1Jun 20 '24

amber: writing bash scripts in amber instead. pt. 1: commands and error handling

writing shell scripts is zero fun. the bash syntax is a mess, error handling is difficult, and any...

Learn More 5 0Jun 18 '24

nginx: doing ip geolocation right in nginx

knowing the geolocation of your site's users is handy thing. maybe you want to force your canadian...

Learn More 13 1Jun 11 '24

php: doing recursion with recursive iterator(iterator)s

recursion has a bad reputation amongst programmers; it's convoluted and complicated and difficult to...

Learn More 8 0Jun 5 '24

mysql: using json data and not hating it

it's a universal truth that one of the primary jobs of backend developers is drinking from the...

Learn More 3 0May 29 '24

bash: splitting tarballs the ‘easy’ way

there are times when we tar and gzip a directory and the final tarball is just too damn big. maybe it...

Learn More 3 0May 22 '24

nginx: serving private files with X-Accel-Redirect

the problem is this: we have a bunch of files, pdfs say, on our webserver that we want people to...

Learn More 13 0May 14 '24

mysql: using the slow query log

the cold, hard truth is that the reason your web app or api is running slow is because of your...

Learn More 3 1May 6 '24

managing disk space in bash

a week ago, i ran this db insert-heavy script on a server and forgot to turn off mysql‘s binlog...

Learn More 12 3Apr 29 '24

uploading to s3 with bash

s3 is handy and useful, but it would be a lot more handy and useful if we had a shell script for...

Learn More 12 0Apr 22 '24

mysql: three things you (probably) didn't know you could do with the mysql command

the mysql command is nice and simple: you run it and get a prompt, you enter a query and get your...

Learn More 3 1Jun 20 '23

writing command line scripts in php: part 5; styling output text

php is primarly considered a web language, but it can certainly be used to build interactive...

Learn More 4 1Mar 15 '23

php: tame arrays with map, filter and reduce

php's arrays are great. until they aren't. it's easy to let arrays get away on you and wind up...

Learn More 20 0Jan 10 '23

mysql: getting a grip on dates, times, and timezones

dealing with dates, times and, espescially, timezones, is messy and zero fun. every serious...

Learn More 17 3Jan 3 '23

managing your aws resources with python and boto3

managing your aws resources with command line utilities or via configuration files is pretty...

Learn More 2 0Dec 27 '22

laravel: strategies for db seeding

if you write laravel projects, then you've probably written some database seeders and maybe some...

Learn More 11 0Dec 20 '22

safer file access techniques in php

file handling is one of those things developers don't pay a lot of attention to anymore; we read in...

Learn More 5 1Sep 15 '22

writing command line scripts in php: part 4; key-down input

php doesn't get a lot of attention as a command-line scripting language, which is a shame. php has a...

Learn More 8 0May 18 '22

laravel: powerful json with jsonSerialize()

laravel does a pretty good job of transparently translating models to json so long as you keep things...

Learn More 18 0May 3 '22