Skip to content

Instantly share code, notes, and snippets.

theothermattm / pickle-rick.go
Created Jan 15, 2021
Last Day Pickle Countdown (in Golang!)
View pickle-rick.go
package main
import (
flag ""
var (
theothermattm /
Created Nov 23, 2020
Java isPrime coding question
public class IsPrime {
public static void main(String args[]) {
System.out.println("6 (should be false):" + isPrime(6));
System.out.println("11 (should be true):" + isPrime(11));
// given a collection of numbers 11, 15, 2, 5, 6, 11
// output the prime numbers, in sorted order, with no duplicates
theothermattm /
Created Nov 18, 2020
Bash script to create PR's for a bunch of repos with same branch names using the github cli
#set -o nounset
#set -x
help ()
echo "Usage:
Submit Github PR's for a list of repos (predefined in script) with the same base and head branches.
Can be useful in a microservices environment where code is deployed from branches which correspond with
theothermattm /
Created Feb 20, 2020
Using docker compose with overrides

Because I always forget the right order of passing in arguments!

Example up command with background process flag set:

docker-compose -f docker-compose.yml -f docker-compose-override-file.yml up -d myservice name
theothermattm /
Created Dec 6, 2019
docker-compose command cheatsheet

build everything in the docker-compose.yaml file

docker-compose build

build just one service in docker-compose.yaml file

docker-compose build myservice

run everything in the docker-compose.yaml file

theothermattm / mysql-dummy-data.sql
Created Aug 20, 2019
Create Dummy Data with MySQL Stored Proc
View mysql-dummy-data.sql
/* based on */
CREATE PROCEDURE insert_test_data()
DECLARE i INT default 1;
SET mydate = DATE_ADD('2017-05-01 00:01:00', INTERVAL FLOOR(RAND() * 700) DAY);
WHILE i < 1000000 DO
INSERT INTO `telemetry_test` (`humidity`, `temperature`, `sql_insert`, `sql_update`)
theothermattm /
Last active Oct 8, 2019
Installing Python so it doesn't suck on MacOS

Thanks to @kevlarr for this info... Saving it myself for reference.

The easiest way to get started is via pyenv and virtualenv.

  • Install pyenv via brew install pyenv
  • Add eval "$(pyenv init -)" to your bash, etc. profile if you want to enable autocomplete (hint: you do),
  • Install project Python version via pyenv install 3.6.81

1 If you are running Mojave and are having issues building (looking at you, zlib), you likely need to install C header files

theothermattm /
Created Jul 12, 2019
Sed - remove matched pattern simple script
# this chains them to make the regex easier to follow
sed -n -e 's/^${FIRSTPATTERN}//p' test.txt | sed -n -e 's/${SECONDPATTERN}//p'
theothermattm /
Created Jun 14, 2019
Debugging w/ Node.js and Chrome

Node debugging with chrome

See this article first.

Use node --inspect

Most of the time it should give you a chrome URL. If not, go to about:inspect in chrome and you should see a target to inspect

Using mocha

You can’t perform that action at this time.