Skip to content

Instantly share code, notes, and snippets.

View chadjvw's full-sized avatar
🕶️
Night mode is dark and full of errors

Chad Van Wyhe chadjvw

🕶️
Night mode is dark and full of errors
View GitHub Profile
#!/bin/bash
#######################################################################
# This is a helper script that keeps snapraid parity info in sync with
# your data and optionally verifies the parity info. Here's how it works:
# 1) Shuts down configured services
# 2) Calls diff to figure out if the parity info is out of sync.
# 3) If parity info is out of sync, AND the number of deleted or changed files exceed
# X (each configurable), it triggers an alert email and stops. (In case of
# accidental deletions, you have the opportunity to recover them from
@chadjvw
chadjvw / settings.json
Last active December 6, 2018 13:37
VS Code Presentation/Live Coding Settings
{
"workbench.colorCustomizations": {
"editorCursor.background": "#ffffff",
"editorCursor.foreground": "#0000bb",
"editor.lineHighlightBackground": "#f0f0f0",
"editor.selectionBackground": "#aaeeff"
},
"workbench.statusBar.visible": true,
"workbench.activityBar.visible": false,
"explorer.openEditors.visible": 0,
StopInstances:
Type: Task
Resource: ${self:custom.function-arn}-StopInstances
Next: WaitForInstancesStop
WaitForInstancesStop:
Type: Wait
Seconds: 15
Next: CheckInstancesStopped
CheckInstancesStopped:
Type: Task
CheckEC2TargetStatus:
Type: Task
Resource: ${self:custom.function-arn}-CheckEC2TargetStatus
Next: EvaluateEC2TargetStatus
ResultPath: '$.onEC2TargetStatus'
Retry:
- ErrorEquals:
- RequestLimitExceeded
- ThrottlingException
- SnapshotCreationPerVolumeRateExceeded
@chadjvw
chadjvw / step-function-iterator.yml
Last active March 16, 2020 18:55
Example AWS Step Function Iterator Pattern
CreateSnapshot:
Type: Task
Resource: ${self:custom.function-arn}-CreateSnapshot
Next: CreateSnapshotIterator
Retry: ${file(common.yml):reqLimitRetry}
CreateSnapshotIterator:
Type: Task
Resource: ${self:custom.function-arn}-Iterate
InputPath: '$.snapshotCreateIterator'
ResultPath: '$.snapshotCreateIterator'
#! /bin/bash
download="/mnt/vol/media/Downloads/"
mov="/mnt/vol/media/Movies/"
for x in {A..Z}; do
find $download -not -path "*tv*" -iname ""$x"*.m??" -not -iname "*sample*" -or -not -path "*tv*" -iname ""$x"*.avi" -not -iname "*sample*" | while read d;
do
p=$(basename "$d")
r=$(dirname "$d")