Skip to content

Instantly share code, notes, and snippets.

View mca-gif's full-sized avatar

Matthew Andersen mca-gif

View GitHub Profile
@mca-gif
mca-gif / settings.json
Created June 5, 2024 15:43
VSCode CloudFormation Additional Yaml Custom Tags
"yaml.customTags": [
"!Base64 scalar",
"!Cidr scalar",
"!And sequence",
"!Equals sequence",
"!If sequence",
"!Not sequence",
"!Or sequence",
"!Condition scalar",
"!FindInMap sequence",
@mca-gif
mca-gif / iwlwifi.conf
Last active February 13, 2023 16:50
Disable WiFi 6 on Intel Cards (Kernel <= 5.15)
# This is necessary on kernels <= 5.15 to improve stability of Intel WiFi chipsets with 802.1ax. It disables WiFi 6 support in favor of a usable connection.
# Put the following line in /etc/modprobe.d/iwlwifi.conf
options iwlwifi disable_11ax=1
@mca-gif
mca-gif / gist:29afce50d57314cdc2e963e4901ccfa3
Created September 16, 2020 19:32
AWS - Discover Down VPN Connections
# List all of the VPN connections on an account where both tunnels are in a DOWN state.
# CSV format
aws ec2 describe-vpn-connections | jq -r '.VpnConnections[] | select ((.VgwTelemetry[0].Status == "DOWN") and (.VgwTelemetry[1].Status == "DOWN")) | [(.Tags[] | select(.Key == "Name") | .Value), .VpnConnectionId, .CustomerGatewayId, .VgwTelemetry[].LastStatusChange] | @csv'
# JSON format for additional processing
aws ec2 describe-vpn-connections | jq -r '.VpnConnections[] | select ((.VgwTelemetry[0].Status == "DOWN") and (.VgwTelemetry[1].Status == "DOWN")) | { Name: (.Tags[] | select(.Key == "Name") | .Value), VpnConnectionId: .VpnConnectionId, CustomerGatewayId: .CustomerGatewayId, LastStatusChange0: .VgwTelemetry[0].LastStatusChange, LastStatusChange1: .VgwTelemetry[1].LastStatusChange}'
@mca-gif
mca-gif / readme.md
Created June 12, 2020 20:28
Transfer Whole Disk Windows 10 VM to new drive with Linux

Transfer Whole Disk Windows 10 VM to new drive with Linux

Moving all of my Windows 10 VMs from a 2TB hybrid drive (sda) to a 512GB NVME (nvme1n1). This only worked so easily because the Windows system partition was only 160GB to begin with, so it was going to grow instead of shrink.

The original partition map on sda was as follows:

label: gpt
label-id: DF9036C3-BB74-4013-B1DE-B4E3B60B9BC3
@mca-gif
mca-gif / bash_script_template.sh
Last active June 7, 2024 20:30
Template for Multi Command Bash Scripts
#!/usr/bin/env bash
# This is a template which provides a number of utilities I find useful when building a Bash script.
# It handles the case where one script may perform multiple commands, and that must be determined by arguments.
# Read comments marked with TODO for how to populate the script.
# This template also provides functionality to define and check for verbosity and debuginess, as well as constants which can be used to display color output.
VERBOSE=0
DEBUG=0
ssconvert - Part of gnumeric, converts Excel spreadsheets to CSV (or vis-a-versa) from CLI
@mca-gif
mca-gif / png_to_mp4.sh
Created April 28, 2017 06:56
PNGs frames to MP4 Playable on iOS
ffmpeg -framerate 30 -i images%03d.png -vf format=yuv420p -profile:v high -level 4.2 output.mp4
@mca-gif
mca-gif / Enpass
Last active May 3, 2017 13:11
HiDPI Hacks for Linux
Add the following before the last line in the `runenpass.sh` of the Enpass installation directory
export QT_AUTO_SCREEN_SCALE_FACTOR=$(gsettings get org.gnome.desktop.interface scaling-factor | cut -d " " -f 2)
@mca-gif
mca-gif / JSON.js
Created July 26, 2016 17:43
JSON Data Extractor for the IntelliJ IDEA Platform
function eachWithIdx(iterable, f) { var i = iterable.iterator(); var idx = 0; while (i.hasNext()) f(i.next(), idx++); }
function mapEach(iterable, f) { var vs = []; eachWithIdx(iterable, function (i) { vs.push(f(i));}); return vs; }
OUT.append(JSON.stringify( mapEach(ROWS, function(row, row_idx) {
var r = {};
eachWithIdx(COLUMNS, function(col, col_idx) { r[ col.name() ] = row.value(col); });
return r;
})));
@mca-gif
mca-gif / PHP Array.php.js
Created March 15, 2016 22:53
PHP Array Data Extractor for the IntelliJ IDEA Platform
function eachWithIdx(iterable, f) { var i = iterable.iterator(); var idx = 0; while (i.hasNext()) f(i.next(), idx++); }
function mapEach(iterable, f) { var vs = []; eachWithIdx(iterable, function (i) { vs.push(f(i));}); return vs; }
function escape(str) {
str = com.intellij.openapi.util.text.StringUtil.escapeXml(str);
return str;
}
function quote(str) {
return '"' + str + '"';