Skip to content

Instantly share code, notes, and snippets.

Avatar

Chad Van Wyhe chadjvw

View GitHub Profile
View snapraid_diff_n_sync.sh
#!/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 Dec 6, 2018
VS Code Presentation/Live Coding Settings
View settings.json
{
"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,
View step-function-wait-loop.yml
StopInstances:
Type: Task
Resource: ${self:custom.function-arn}-StopInstances
Next: WaitForInstancesStop
WaitForInstancesStop:
Type: Wait
Seconds: 15
Next: CheckInstancesStopped
CheckInstancesStopped:
Type: Task
View step-function-retry.yml
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 Mar 16, 2020
Example AWS Step Function Iterator Pattern
View step-function-iterator.yml
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'
View move_films_bsd.sh
#! /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")
You can’t perform that action at this time.