This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from execute import execute, Retcode | |
def dd(ifile, ofile, bs, count=None, seek=None): | |
""" | |
Wrapper for the GNU dd command. | |
Inputs: | |
ifile (str): Input file | |
ofile (str): Output file | |
bs (str): Block size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# ipcheck.sh | |
# | |
# Check public IP and notify by email if it has changed. | |
# | |
EMAIL="test@test.com" | |
LOG="/root/.myip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_table(f, idx=0, delim=None, head=None): | |
""" | |
Parse a table. | |
Inputs: | |
f (str): Path to file | |
idx (int): Index column | |
delim (str): Table delimiter | |
head (list): Optionally defined table header | |
Outputs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pprint_table(table): | |
""" | |
Pretty print table. | |
Inputs: | |
table (list): table | |
Outputs: | |
None | |
""" | |
padding = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# hddcheck.sh | |
# | |
# Modified version of http://www.cyberciti.biz/files/scripts/monitor-my-hard-disk.sh.txt. | |
# | |
# Generate a warning email based on hard drive temps. | |
# | |
TO=test@test.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
def tree(): | |
return defaultdict(tree) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Install/update MakeMKV. | |
# | |
TMP=$(mktemp -d) | |
# Get current version | |
VERS=$(curl --silent "http://www.makemkv.com/download/" 2>&1 | \ | |
egrep -o 'MakeMKV ([^ ]*) for' | \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TIMESTAMP=$(date +"%F") | |
BACKUP_DIR="/backup/$TIMESTAMP" | |
MYSQL=/usr/bin/mysql | |
MYSQLDUMP=/usr/bin/mysqldump | |
NTFY=/usr/local/bin/ntfy | |
mkdir -p "$BACKUP_DIR/mysql" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$PAM_TYPE" == "close_session" ]; then | |
exit | |
fi | |
curl -s -X POST -H 'Content-type: application/json' SLACK_WEBHOOK \ | |
-d @- > /dev/null << EOF | |
{ | |
"attachments": [ |