Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -e
monthday="$(date +%-d)"
weekday="$(date +%w)"
if [[ "$monthday" -eq 1 ]]
then
@phunehehe
phunehehe / modules
Created November 5, 2013 09:28
Manage Chef modules
name;/path/to/name
#!/bin/bash
grep nrpe /var/log/audit/audit.log | audit2allow -M local
semodule -i local.pp
@phunehehe
phunehehe / logrotate.conf
Last active December 20, 2015 03:09
A nice starting point for a logrotate config file
/path/to/*.log {
size 10M
rotate 10
create
compress
delaycompress
dateext
dateformat -%Y%m%d-%s
}
@phunehehe
phunehehe / check_urls
Last active December 23, 2018 00:54
Script to check multiple URLs in Nagios, see http://phunehehe.net/check-multiple-urls-nagios/
#!/bin/bash
# Split URLs by comma
urls=${1//,/ }
for url in $urls
do
hostname="${url%%/*}"
if [[ "$url" = */* ]]
then
@phunehehe
phunehehe / git-cheatsheet.md
Last active December 15, 2015 15:19
Super condensed Git cheatsheet

Install Git

# Ubuntu
sudo apt-get install git
# OSX http://mac.github.com/

Create a Git repository in the current directory

# Open a terminal, `cd` to the project directory and then

git init

@phunehehe
phunehehe / mutt-ses.md
Last active March 7, 2018 02:10
Settings for Mutt to test SES

Change the email address to the verified sender address. By default Mutt doesn't use the envelope address, resulting in the email getting rejected because of unverified address.

set from = 'Amazing Tester <tester@amazing.com>'
set smtp_pass = 'xxx'
set smtp_url = 'smtps://xxx@email-smtp.xxx.amazonaws.com'
set use_envelope_from = yes
@phunehehe
phunehehe / ssh.md
Created March 15, 2013 07:21
Add self's SSH key to another account to gain access

Add self's SSH key to another account to gain access

user=xyz
sudo mkdir -p /home/$user/.ssh
sudo cp -i ~/.ssh/authorized_keys /home/$user/.ssh/
sudo chown -R $user:$user /home/$user/.ssh
sudo chmod -R go-rwx /home/$user/.ssh

Print permissions in a way that is suitable for executing again

for i in *
do
    echo chown $(stat -c%U:%G $i) $i
    echo chmod $(stat -c%a $i) $i
done
@phunehehe
phunehehe / philesight-ubuntu.md
Last active August 18, 2020 06:23
Philesight on Ubuntu

Install dependencies

sudo apt-get install libdb4.2-ruby1.8 libcairo-ruby1.8

Install Philesight

git clone https://github.com/phunehehe/philesight.git