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 / 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 / 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
}
View nrpe-selinux.sh
#!/bin/bash
grep nrpe /var/log/audit/audit.log | audit2allow -M local
semodule -i local.pp
View existing archiveopteryx tree
$ tree /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0
/nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0
├── bin
│   ├── aox -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/bin/aox
│   ├── aoxdeliver -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/bin/aoxdeliver
│   ├── aoxexport -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/bin/aoxexport
│   ├── aoximport -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/bin/aoximport
│   ├── archiveopteryx -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/sbin/archiveopteryx
│   ├── logd -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/sbin/logd
│   └── recorder -> /nix/store/q56a5gs1iq3f9q0afrb2prn5wdxs5392-archiveopteryx-3.2.0/usr/local/archiveopteryx/sbin/recorder
@phunehehe
phunehehe / modules
Created Nov 5, 2013
Manage Chef modules
View modules
name;/path/to/name
View amanda-retry.sh
#!/bin/bash
set -e
monthday="$(date +%-d)"
weekday="$(date +%w)"
if [[ "$monthday" -eq 1 ]]
then
@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 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 / 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
You can’t perform that action at this time.