Skip to content

Instantly share code, notes, and snippets.

Hoàng Xuân Phú phunehehe

View GitHub Profile
@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 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 / stupid-spiders.md
Last active Dec 12, 2015
Block weird requests coming from stupid spiders
View stupid-spiders.md

Nginx

set $stupid_spider "";

# If the request comes from one of these stupid spiders
if ($http_user_agent ~* (stupid|spider)) {
    set $stupid_spider "1";
}
You can’t perform that action at this time.