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 /
Last active Dec 12, 2015
Block weird requests coming from stupid spiders


set $stupid_spider "";

# If the request comes from one of these stupid spiders
if ($http_user_agent ~* (stupid|spider)) {
    set $stupid_spider "1";
phunehehe / solo.rb
Created Aug 28, 2012
solo.rb that knows where it is
View solo.rb
chef_dir = File.expand_path(File.dirname(__FILE__))
cookbook_path [
role_path "#{chef_dir}/chef-repo/roles"
phunehehe /
Created Aug 21, 2011
Organize files by file extension
# Organize files by file extension
# Written in answer to
# Configuration (feel free to add your types and change the path)
phunehehe / newconfig
Created Feb 25, 2011
In Gentoo, after updating you may see the message "IMPORTANT: <number> config files in '/etc' need updating.". This script looks for all the files that need to be updated, then overwrite old config files with new ones. Useful when there are a lot of new c
View newconfig
#! /bin/sh
# Update: There is no point using this, we have `etc-update'
for new_config in $(find /etc/ -name '._cfg????_*')
old_config=$(echo $new_config | sed 's:\([a-zA-Z0-9]*\)\._cfg[0-9]\{4\}_\([a-zA-Z0-9]*\):\1\2:')
if [[ -f "$new_config" || -f "$old_config" ]]
mv $new_config $old_config
You can’t perform that action at this time.