Skip to content

Instantly share code, notes, and snippets.

View bmatthewshea's full-sized avatar

Brady Shea bmatthewshea

View GitHub Profile
#! /bin/sh
#
# postgrey start/stop the postgrey greylisting deamon for postfix
# (priority should be smaller than that of postfix)
#
# Author: (c)2004-2006 Adrian von Bidder <avbidder@fortytwo.ch>
# Based on Debian sarge's 'skeleton' example
# Distribute and/or modify at will.
#
# Version: $Id: postgrey.init 1436 2006-12-07 07:15:03Z avbidder $
@bmatthewshea
bmatthewshea / startexe.cmd
Last active September 12, 2015 17:10
superuser.com/q/972076/47628
@echo off
start "Notepad" "C:\Windows\system32\notepad.exe"
start "Skype" "C:\Program Files (x86)\Skype\Phone\Skype"
start "Firefox CNN" "%programfiles(x86)%\Mozilla Firefox\Firefox.exe" "http://www.cnn.com/"
start "CMD Start Help" "cmd start /?"
#!/bin/bash
#Update file location to your needs/setup - assumes root access needed:
FILE=/etc/vsftpd/vsftpd-virt-htpasswds
#some checks
if [ "$EUID" -ne 0 ]
then echo "Please run this script as root or use sudo. Exiting."
exit
fi
@bmatthewshea
bmatthewshea / .cron_prune_backups.sh
Last active September 14, 2016 13:25
FIND command to reduce backups in folder - saving only 1st of month if older than 90 days
#!/bin/bash
DS=`date "+%Y-%m-%d %H:%M:%S"`
FINDPATH=/opt/mysql-backups
LOG="$FINDPATH"/mysql-backup-removal.log
### find >= 90 day - but leave/exclude a 1st day of month forever...
find "$FINDPATH"/backupname_* -name 'backupname_??-01-*' -prune -o -mtime +90 -exec ls {} \; -exec rm {} \; >> "$LOG"
@bmatthewshea
bmatthewshea / windows_ec2_snapshot.bat
Last active September 13, 2016 21:09 — forked from ehlertij/windows_ec2_snapshot.bat
Windows batch script for creating daily EC2 snapshots for a volume and deleting old ones.
set AWS_EC2_COMMAND=aws ec2 --dryrun
set AWS_HOME=.
set AWS_VOLUME=vol-12345678
set AWS_SNAPSHOT_KEEP=10
set VOL_DESC=Daily Snapshot
:: Create snapshot for this volume
CMD /C %AWS_EC2_COMMAND% create-snapshot %AWS_VOLUME% -d "%VOL_DESC%"
:: Find old snapshots for this volume, sort them by date desc
@bmatthewshea
bmatthewshea / ethminer start-stop-daemon
Last active May 9, 2021 21:38
start-stop-daemon service for ethminer binary
#!/bin/sh
### BEGIN INIT INFO
# Provides: ethminer
# Required-Start: $remote_fs $syslog $network $named
# Required-Stop: $remote_fs $syslog $network $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ethminer start-stop-daemon init script
# Description: This allows you to start/stop ethminer as if it
# were a daemon
@bmatthewshea
bmatthewshea / restart-svc-on-log-failure.sh
Created October 17, 2017 14:49
A BASH script to monitor a log and restart a service if idle.
#!/bin/bash
set -x
PATH=$PATH:/opt/scripts
SERVICE=ethminer
# start infinite loop
while :
do
SECS=$(date +%s)
@bmatthewshea
bmatthewshea / ethminer-monitor.sh
Last active January 20, 2018 17:52
BASH/CRONTAB - Restart ethminer service if stalled
#!/bin/bash
PATH=$PATH:/usr/bin:/usr/sbin:/var/log/miners:/home/ubuntu/scripts
SECS=$(date +%s)
ETHMINERLOGFILE=/var/log/miners/ethminer.log
ETHMINERRESTART=/var/log/miners/ethminer-restarts.log
idletime=$(expr $SECS - $(date +%s -r $ETHMINERLOGFILE))
echo -n "$(date) - Status check running.. " &>> $ETHMINERRESTART
if [ "$idletime" -gt 300 ]
@bmatthewshea
bmatthewshea / ethminer
Last active January 24, 2018 17:18
/etc/default/ethminer service default file
# User settings - Here you can enable/disable a given miner profile:
#
RUNAS="ubuntu" # For the amdgpu-pro driver this user must be a member of 'video' group
DAEMON="/opt/miners/ethminer" # Wherever you installed the binary - make sure its executable by above user.
GPU="-G" # -U (nVidia Cuda) or -G (OpenCL) or -X (mixed Cuda/OpenCL cards)
WORKER="Worker1"
LOGFILE="/var/log/miners/ethminer.log"
# values: pool, proxy, solo
@bmatthewshea
bmatthewshea / .bash_aliases
Last active February 7, 2019 18:52
My Ubuntu ~/.bash_aliases
# SUDO
alias sw='sudo -u www-data'
alias beroot='sudo su -'
# NANO
alias e='nano -\$wcS'
alias se='sudo nano -\$wcS'
# FILE-LISTS
alias l='ls -lah'
# PS TREE FORMAT
alias ps='/bin/ps auxfwww'