Skip to content

Instantly share code, notes, and snippets.

Hoàng Xuân Phú phunehehe

Block or report user

Report or block phunehehe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@phunehehe
phunehehe / remove-gpg-user.sh
Last active Sep 25, 2019 — forked from glogiotatidis/remove-gpg-user.sh
Git-crypt remove user.
View remove-gpg-user.sh
#!/usr/bin/env bash
#
# Script to remove GPG key from git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.
@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
View main.tf
resource aws_elasticache_replication_group single {
node_type = "cache.m3.medium"
number_cache_clusters = 1
port = 6379
replication_group_description = "single-test"
replication_group_id = "single-test"
subnet_group_name = "staging"
}
resource aws_elasticache_replication_group cluster {
@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 / 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 autostart-sync.sh
for i in $(virsh list | grep running | awk '{print $2}')
do
virsh autostart $i
done
for i in $(virsh list --all | grep 'shut off' | awk '{print $2}')
do
virsh autostart --disable $i
done
@phunehehe
phunehehe / MyFormModel.php
Last active Dec 30, 2015
Antispam for Yii form
View MyFormModel.php
<?php
/*
* Prevent automated POST (actually non-GET) requests by checking a form
* attribute set by JavaScript, in the hope that spammers will not execute
* JavaScript.
*
* Usage:
* 1. Extend MyFormModel instead of CFormModel
* class ContactForm extends MyFormModel {}
View amanda-retry.sh
#!/bin/bash
set -e
monthday="$(date +%-d)"
weekday="$(date +%w)"
if [[ "$monthday" -eq 1 ]]
then
@phunehehe
phunehehe / modules
Created Nov 5, 2013
Manage Chef modules
View modules
name;/path/to/name
You can’t perform that action at this time.