Skip to content

Instantly share code, notes, and snippets.

@phunehehe
phunehehe / stupid-spiders.md
Last active December 12, 2015 07:29
Block weird requests coming from stupid spiders

Nginx

set $stupid_spider "";

# If the request comes from one of these stupid spiders
if ($http_user_agent ~* (stupid|spider)) {
    set $stupid_spider "1";
}

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 / logrotate.conf
Last active December 20, 2015 03:09
A nice starting point for a logrotate config file
/path/to/*.log {
size 10M
rotate 10
create
compress
delaycompress
dateext
dateformat -%Y%m%d-%s
}