Skip to content

Instantly share code, notes, and snippets.

Avatar

Hoàng Xuân Phú phunehehe

View GitHub Profile
@phunehehe
phunehehe / modules
Created Nov 5, 2013
Manage Chef modules
View modules
name;/path/to/name
View nrpe-selinux.sh
#!/bin/bash
grep nrpe /var/log/audit/audit.log | audit2allow -M local
semodule -i local.pp
@phunehehe
phunehehe / logrotate.conf
Last active Dec 20, 2015
A nice starting point for a logrotate config file
View logrotate.conf
/path/to/*.log {
size 10M
rotate 10
create
compress
delaycompress
dateext
dateformat -%Y%m%d-%s
}
@phunehehe
phunehehe / check_urls
Last active Dec 23, 2018
Script to check multiple URLs in Nagios, see http://phunehehe.net/check-multiple-urls-nagios/
View check_urls
#!/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 Dec 15, 2015
Super condensed Git cheatsheet
View git-cheatsheet.md

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 Mar 7, 2018
Settings for Mutt to test SES
View mutt-ses.md

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 Mar 15, 2013
Add self's SSH key to another account to gain access
View ssh.md

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
View commands.md

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 Jan 25, 2016
Philesight on Ubuntu
View philesight-ubuntu.md

Install dependencies

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

Install Philesight

git clone https://github.com/phunehehe/philesight.git
View sequence.py
WHATEVER_NUMBER_YOU_LIKE = 42
def sequence(input):
if input == 0:
return 340
if input == 1:
return 680
if input == 2:
return 1428
if input == 3:
You can’t perform that action at this time.