Skip to content

Instantly share code, notes, and snippets.

#!/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
@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"`
@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 / 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;
#!/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 / 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:

@mricon
mricon / gitweb-rewrites.conf
Last active August 29, 2015 14:10
Gitweb to CGit rewrites used at git.kernel.org
# Legacy redirects for /linus/ and /tip/
rewrite ^/linus/(\w+)$ /cgit/linux/kernel/git/torvalds/linux.git/commit/?id=$1? permanent;
rewrite ^/linus/.*h=(\w+)$ /cgit/linux/kernel/git/torvalds/linux.git/commit/?id=$1? permanent;
rewrite ^/linus/$ /cgit/linux/kernel/git/torvalds/linux.git? permanent;
rewrite ^/tip/(\w+)$ /cgit/linux/kernel/git/tip/tip.git/commit/?id=$1? permanent;
rewrite ^/tip/.*h=(\w+)$ /cgit/linux/kernel/git/tip/tip.git/commit/?id=$1? permanent;
rewrite ^/tip/$ /cgit/linux/kernel/git/tip/tip.git? permanent;
if ($request_uri ~ "^/cgit") {
break;
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I am doing an AMA on /r/linux.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBCAAGBQJU9RFuAAoJEDZgaZyZ4FVXYjkIAI9lei1E9chFctPy4O9JszfA
C34rnPZYV+EUAG8CHr1nQlVb8Sr0iIpkvmB5RgJy5HPu57E7M6h9jKXXKaclMTJG
9iYObhk/z7PfsS6tRlqoCfYOq1IfoB+reNK0NScI8kDsmZ7uyxmvyfSqJzMuu2dM
@mricon
mricon / dovecot-zlib-cron-compressor.sh
Last active November 7, 2021 19:44
Implements the cron script described on http://wiki2.dovecot.org/Plugins/Zlib for compressing old maildir messages. Use only after enabling the Dovecot zlib plugin.
#!/bin/bash
# This is implementation of the script that compresses old maildir messages
# as described in http://wiki2.dovecot.org/Plugins/Zlib
#
# Copyright (C) 2016 by Konstantin Ryabitsev
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
#!/bin/bash
if [ -z "$GL_USER" ]; then
echo "Run me from gitolite"
exit 1
fi
function showsetusage {
echo
echo 'USAGE: track set your-repo orig-repo remote-name [--tags]'
echo