Skip to content

Instantly share code, notes, and snippets.

View go-to-coding-resources.md
@theothermattm
theothermattm / sync-using-gitignore.sh
Created Oct 7, 2015
Rsync files using .gitignore
View sync-using-gitignore.sh
# sync everything excluding things in .gitignore
# delete anything on target not in source
# include dotfiles and symlinks, also use compression
rsync -azP --delete --filter=":- .gitignore" . my-target-host:/my/target/directory
@theothermattm
theothermattm / load-envs.sh
Created Jun 3, 2022
Bash: Load environment vars from .env file
View load-envs.sh
# Load Environment Variables from .env
if [ -f .env ]; then
export $(cat .env | grep -v '#' | sed 's/\r$//' | awk '/=/ {print $1}' )
fi
@theothermattm
theothermattm / engineering-management.md
Created Dec 9, 2021
Go To Engineering Management Resources
View engineering-management.md
@theothermattm
theothermattm / vim-movement.ahk
Created Dec 2, 2021
Windows AutoHotKey Remap CAPSLOCK+HJKL to Vim Movement Keys
View vim-movement.ahk
; 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")
View test.html
<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 Jan 15, 2021
Last Day Pickle Countdown (in Golang!)
View pickle-rick.go
package main
import (
"fmt"
"time"
flag "github.com/ogier/pflag"
"os"
)
var (
@theothermattm
theothermattm / IsPrime.java
Created Nov 23, 2020
Java isPrime coding question
View IsPrime.java
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 Nov 18, 2020
Bash script to create PR's for a bunch of repos with same branch names using the github cli
View github-cli-create-prs.sh
#!/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 Feb 20, 2020
Using docker compose with overrides
View docker-compose-override-commands.md

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