Skip to content

Instantly share code, notes, and snippets.

View bdtech's full-sized avatar

Bryan D. bdtech

  • USA
View GitHub Profile
@bdtech
bdtech / raspberrypi-sd-backup.sh
Created March 12, 2013 23:35
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
@bdtech
bdtech / raspberrypi-sd-backup.sh
Created March 12, 2013 23:35
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
@bdtech
bdtech / raspberrypi-sd-backup.sh
Created March 12, 2013 23:37
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
@bdtech
bdtech / raspberrypi-sd-backup.sh
Created March 12, 2013 23:37
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
@bdtech
bdtech / raspberrypi-sd-backup.sh
Created March 12, 2013 23:42
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
@bdtech
bdtech / raspberrypi-sd-backup.sh
Created March 12, 2013 23:42
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
@bdtech
bdtech / raspberrypi-sd-backup.sh
Created March 12, 2013 23:43
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
@bdtech
bdtech / raspberrypi-sd-backup.sh
Created March 12, 2013 23:43
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
@bdtech
bdtech / raspberrypi-sd-backup.sh
Created March 12, 2013 23:43
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
@bdtech
bdtech / cloudflare-ban.sh
Created June 17, 2013 14:19
OSSEC active response to block an IP at the Cloudflare reverse proxy level who triggers errors in short time frame in nginx logs. Required: Ossec config: sample to block IPs with multiple 500 errors or 400 errors within a minute or two timeframe. /var/ossec/etc/ossec.conf <command> <name>cloudflare-ban</name> <executable>cloudflare-ban.sh</execu…
#!/bin/sh
# Adds an IP to Cloudflare IP block list
# Path: /var/ossec/active-response/bin/cloudflare-ban.sh
#
ACTION=$1
USER=$2
IP=$3
PWD=`pwd`
TKN='CF API KEY'