View create-memtest-usb.sh
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 | |
# Install dependencies for creating filesystem and installing bootloader | |
## This script is mostly system-independent, except for this part. Replace yaourt and the args with your own package manager | |
yaourt -S --noconfirm mtools syslinux dosfstools | |
# Plug in the flash drive, and find its device. Don't mount it. | |
lsblk | |
while [[ $(echo $FLASHDEV | grep -c \/dev\/sd[a-z]) -lt 1 && -b "$FLASHDEV" ]] ; do | |
read -p 'Which device (e.g. /dev/sdf)? ' FLASHDEV |
View restic-b2-cronjob.sh
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 | |
# Requires: | |
# - restic (system package) | |
# - AWS account with SNS topic configured and API keys created | |
# - awscli (pip) with API keys configured (aws configure) | |
# - Backblaze B2 account with API keys | |
# - cron implementation (system package) | |
ResticBinaryPath=`which restic` |
View s3-b2-cronjob.sh
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 | |
# Requires: | |
# - restic (system package) | |
# - AWS account with SNS topic configured, S3 bucket created, and API keys created | |
# - awscli (pip) with API keys configured (aws configure) | |
# - cron implementation (system package) | |
ResticBinaryPath=`which restic` | |
AwsCliBinaryPath=`which aws` |
View rds2redshift.sh
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
PYTHON_PATH=$(which python) | |
PSQL_PATH=$(which psql) | |
MYSQL_SCRIPT='mysql2file.py' | |
MYSQL_SERVER= | |
MYSQL_PORT=3306 | |
MYSQL_DATABASE= | |
MYSQL_USER= | |
MYSQL_PASSWORD= |
View personal-backup.sh
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 | |
## Description: | |
# Sync files to and create lists of directory contents in a LUKS container volume and upload it to S3 | |
# Good for periodic backup jobs | |
# Supports rate limiting, encryption in transit and at rest and file path exclusions | |
## Usage: | |
# bash $0 |
View check-systemd-service.sh
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 | |
## Checks a systemd controlled service for status and start failures | |
SVC_NAME='servicename' | |
COUNT_FILE='/tmp/checkservice.counter' | |
# load counter from previous checks | |
[ -f $COUNT_FILE ] && { COUNT=`cat $COUNT_FILE` ; } || { COUNT=0 ; } |
View xmr-mining-scheduler.sh
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 | |
# | |
# usage: $0 <cpu-threads> | |
# | |
# i use this script to schedule times of day when my computer is not in use can max out cpu on the miner | |
# | |
# example cron entries: | |
# 00 06 * * * /path/to/xmr-mining-scheduler.sh 3 | |
# 00 23 * * * /path/to/xmr-mining-scheduler.sh 4 |
View .bash_aliases
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
# maintenance | |
alias sysupgrade='yaourt -S -y -u --aur' | |
# operations | |
function gpkill () { | |
if [ $1 ] ; then | |
TargetPid=`pgrep $1` | |
echo 'Sending sigterm' | |
kill -15 $TargetPid | |
sleep 2 |
View pwrstatd-lowbatt.sh
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/sh | |
echo "Warning: The UPS's battery power is not enough, system will be shutdown soon!" | wall | |
export RECEIPT_NAME | |
export RECEIPT_ADDRESS | |
export SENDER_ADDRESS | |
# | |
# If you want to receive event notification by e-mail, you must change 'ENABLE_EMAIL' item to 'yes'. | |
# Note: After change 'ENABLE_EMAIL' item, you must asign 'RECEIPT_NAME', 'RECEIPT_ADDRESS', and |
View migration-irssi-logs.sh
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 | |
# migrate.sh | |
# DESCRIPTION: Parse two directories of logfiles. | |
# FUNCTION: Append new files with old ones, delete files that are small, and move new files that aren't present to the old directory. | |
# USAGE: bash migrate.sh /path/to/old_logdir /path/to/new_logdir | |
# ELABORATION: | |
# Settings | |
minlines=15 # Threshhold number of lines to delete a logfile |
NewerOlder