Skip to content

Instantly share code, notes, and snippets.

View tubaterry's full-sized avatar

Chris Terry tubaterry

View GitHub Profile
@tubaterry
tubaterry / DisplayProductID-27a0.plist
Created May 7, 2020 17:59
ROG PG27UQ with YUV modes edited out of the EDID
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DisplayProductID</key>
<integer>10144</integer>
<key>DisplayProductName</key>
<string>ROG PG27U</string>
<key>DisplayVendorID</key>
<integer>1715</integer>
@tubaterry
tubaterry / kubernetes-busybox.yaml
Created March 13, 2019 16:42
Quick busybox pod definition
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: default
spec:
containers:
- name: busybox
image: busybox:1.28
command:
@tubaterry
tubaterry / pointless.sh
Last active April 13, 2018 20:05
this string contains every letter in the english alphabet dfjkmquwxz
#!/bin/bash
PHRASE=${1}
echo -n "${PHRASE} "
for letter in {a..z}; do
echo "${PHRASE}" | grep -i $letter > /dev/null
if [ $? -ne 0 ]; then
echo -n $letter
fi
done
echo
@tubaterry
tubaterry / password_pwned.sh
Created March 25, 2018 19:58
Quick command-line check against the haveibeenpwned password database
#!/bin/bash
#Example:
#p@55w0rd
#ce0b2b771f7d468c0141918daea704e0e5ad45db
#Speed up grep by making cases match
echo "Password to check: "
HASH=`read -s; echo -n $REPLY | shasum | cut -d" " -f1 | tr '[:lower:]' '[:upper:]'`
SHORTHASH=`echo $HASH | cut -b1-5`
@tubaterry
tubaterry / parallelize.bash
Last active August 12, 2023 09:20
bash job queue with GNU Parallel
#!/bin/bash
#Tail a temp file, pipe it into GNU Parallel.
#Generally FIFOish but don't count on it, no guarantees about execution order between setup and tear-down
#Tips:
#I threw this together for a network based load -
# for disk-bound (esp magnetic hard drives) loads, lower -j to 1 or switch to --semaphore
# most load you can probably just omit -j and run with defaults. (One concurrent job per CPU core)
#todo:
@tubaterry
tubaterry / fingerguns.zsh-theme
Last active November 30, 2021 03:49
ZSH prompt with finger guns 👉 😎 👉 (requires emoji support)
# Don't forget to set COMPLETION_WAITING_DOTS=false in your .zshrc - it doesn't always play nice with multiline prompts
# Troubleshooting breadcrumbs:
# Prompt design: http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Prompt-Expansion
# Zsh Line Editor (zle): http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html
#Broken down into its component pieces because I was tired of looking at a nearly incomprehensible string
FG_USER_BADGE=$'%{$fg_bold[green]%}%n@%m%{$reset_color%}'
FG_TIMESTAMP=$'%{$fg[blue]%}%D{[%X]}%{$reset_color%}'
FG_CWD_DISPLAY=$'%{$fg[white]%}[%~]%{$reset_color%}'
@tubaterry
tubaterry / DropboxCameraOrganize.ps1
Created January 20, 2017 22:15
Quick organizer script for keeping my camera uploads off of my low storage volume devices
$DaysBack = 14
$ArchiveYears = 2
[switch]$Timestamp = $true
[switch]$WhatIf = $false
$Types=(".png",".jpg",".gif",".mp4")
If($env:COMPUTERNAME -eq "ZEUS"){
$FolderToOrganize = 'D:\Chris\Dropbox\Camera Uploads'
$ArchiveLocation = 'D:\Chris\Dropbox\Archive\Photos'
}ElseIf($env:COMPUTERNAME -eq "NCC1701"){
@tubaterry
tubaterry / ec2-startup-and-dns
Created October 17, 2016 19:05
AWS EC2 - Start up a single instance and update its DNS record
#!/bin/bash
#In early development, sometimes you've got a hand-built instance, but you also don't want to leave it up all the time
# We've got an m4xl instance running Spinnaker (http://spinnaker.io) but we only really need it during the day
# As a cost-saving measure, we shut it down overnight. However, we want it to be consistently accessible
# So this script is in a Jenkins job that runs every morning,
# starting up the instance then updating its DNS record to the new IP.
###
# SETTINGS
@tubaterry
tubaterry / bash_on_mac.sh
Last active October 3, 2019 15:46
One-liners
# This isn't REALLY a one-liner per-se, just a wildly effecient timesaver.
# But it did save my ass on a tight deadline when I didn't have supporting automation ready yet
# `pbcopy` (and its friend, `pbpaste`) are works of art.
for aws_account in `cat data_file.json | jq -r '.aws_account[] | .number'`; do
for role in `cat data_file.json | jq -r '.roles[]'`; do
echo "arn:someshitIforgot:${aws_account}:roles/${role}" | pbcopy
echo "Role copied, paste it into the policy document. Hit enter to continue."
# I'm not using PLACEHOLDER anywhere else in the real script, this is purely about lazy.
read PLACEHOLDER