Skip to content

Instantly share code, notes, and snippets.

@mricon
mricon / keybase.md
Created September 25, 2014 14:57
keybase.md

Keybase proof

I hereby claim:

  • I am mricon on github.
  • I am mricon (https://keybase.io/mricon) on keybase.
  • I have a public key whose fingerprint is DE0E 66E3 2F1F DD09 0266 6B96 E63E DCA9 329D D07E

To claim this, I am signing this object:

#!/bin/bash
# Downtimes are third Sunday of the month. In order to plan
# for upgrades and reboots, we email ourselves the list of all
# outstanding security updates for each system on the 2nd
# Wednesday of the month.
# Critical security update alerts are sent daily.
# Requires yum-plugin-security and mailx.
WEEKOFMONTH=$((($(date +%d)-1)/7+1))
DAYOFWEEK=$(date +%u)
@mricon
mricon / mysnaplock.te
Created December 10, 2012 15:49
Allow cron to do the necessary operation on mounted var_log_t from cron
module mysnaplock 1.0.0;
require {
type cron_log_t;
type var_log_t;
class filesystem associate;
}
#============= cron_log_t ==============
allow cron_log_t var_log_t:filesystem associate;
@mricon
mricon / snaplock-prep.sh
Created December 10, 2012 15:18
Using syslog with snaplock
#!/bin/bash
SNAPLOCK="/mnt/snaplock"
for ZONE in internal dmz frontend; do
YESTERDAY=`date +'%Y/%m/%d' -d 'yesterday'`
TOMORROW=`date +'%Y/%m/%d' -d 'tomorrow'`
LOCKTILL=`date +'%Y%m%d0000' -d '+5 years'`
if [ -d "${SNAPLOCK}/${ZONE}/${YESTERDAY}" ]; then
@mricon
mricon / wtftz.sh
Last active October 11, 2015 12:47
Quick timezone chart
#!/bin/bash
WANT=$1
dotime () {
WANT=$1
PAC=`TZ='America/Vancouver' date +%H:%M -d "TZ=\"America/Montreal\" $WANT"`
MTN=`TZ='America/Denver' date +%H:%M -d "TZ=\"America/Montreal\" $WANT"`
CEN=`TZ='America/Chicago' date +%H:%M -d "TZ=\"America/Montreal\" $WANT"`
UTC=`TZ='Etc/UTC' date +%H:%M -d "TZ=\"America/Montreal\" $WANT"`
CST=`TZ='Asia/Shanghai' date +%H:%M -d "TZ=\"America/Montreal\" $WANT"`
#!/bin/bash
TIMESTORE="/var/lib/avc-audit-report.last-run"
TMPFILE=`mktemp /tmp/avc-audit-report.XXXXXXXXXX`
if [ -e "$TIMESTORE" ]; then
LASTRUN=`cat ${TIMESTORE}`
else
LASTRUN="yesterday"
fi