Skip to content

Instantly share code, notes, and snippets.

View theothermattm's full-sized avatar

Matt M. theothermattm

View GitHub Profile
@theothermattm
theothermattm / vim-movement.ahk
Created December 2, 2021 16:54
Windows AutoHotKey Remap CAPSLOCK+HJKL to Vim Movement Keys
; Main Navigation
CAPSLOCK & j::MoveCursor("{DOWN}")
CAPSLOCK & l::MoveCursor("{RIGHT}")
CAPSLOCK & k::MoveCursor("{UP}")
CAPSLOCK & h::MoveCursor("{LEFT}")
; Navigation Combos
MoveCursor(key) {
shift := GetKeyState("SHIFT","P")
control := GetKeyState("CONTROL","P")
<html>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/charts.css/dist/charts.min.css">
<body >
<h1>
Are charts awesome? </h1>
<table class="charts-css [ column ] [ show-primary-axis show-4-secondary-axes ] [ data-spacing-4 reverse-data ]">
<caption>Are charts awesome?</caption>
@theothermattm
theothermattm / pickle-rick.go
Created January 15, 2021 18:34
Last Day Pickle Countdown (in Golang!)
package main
import (
"fmt"
"time"
flag "github.com/ogier/pflag"
"os"
)
var (
@theothermattm
theothermattm / IsPrime.java
Created November 23, 2020 13:53
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
theothermattm / github-cli-create-prs.sh
Created November 18, 2020 02:29
Bash script to create PR's for a bunch of repos with same branch names using the github cli
#!/bin/bash
#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
theothermattm / docker-compose-override-commands.md
Created February 20, 2020 17:45
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
theothermattm / docker-compose-cheatsheet.md
Created December 6, 2019 16:02
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
theothermattm / install-python-macos.md
Last active October 8, 2019 12:39
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
theothermattm / mysql-dummy-data.sql
Created August 20, 2019 15:11
Create Dummy Data with MySQL Stored Proc
/* based on https://stackoverflow.com/a/17268740/288935 */
CREATE PROCEDURE insert_test_data()
BEGIN
DECLARE i INT default 1;
DECLARE mydate DATE DEFAULT NOW();
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
theothermattm / remove-matched-pattern.sh
Created July 12, 2019 12:19
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'