Skip to content

Instantly share code, notes, and snippets.

View rolandinsh's full-sized avatar
🧔
Remote developer (LEMP, Node.js, Neo4j [graph])

Rolands rolandinsh

🧔
Remote developer (LEMP, Node.js, Neo4j [graph])
View GitHub Profile
Afganistāna
Albānija
Alžīrija
Amerikas Savienotās Valstis
Andora
Angola
Antigva un Barbuda
Apvienotie Arābu Emirāti
Argentīna
Armēnija
Verifying that +rolandinsh is my blockchain ID. https://onename.com/rolandinsh
@rolandinsh
rolandinsh / gist:93cb9a5f08f52d7065b4
Created June 20, 2015 01:07
spammers in .sh file (by @lolwhoami)
#!/bin/sh
# Author: https://github.com/lolwhoami/referrer-spam-blacklist/commit/b25bb159d95c0fc82ea731750f0461bd85b72a91
# use this inside 'server { ... }'
#
# include spammers.nginx.conf;
# if($bad_referer) {
# return 444;
# }
conf='./spammers.nginx.conf'
@rolandinsh
rolandinsh / gist:52197d4d4feb37dffe9b
Last active August 29, 2015 14:19
block spam referers in NGINX. Can be used as global block for all sites; (used on my production server(s))
# Block semalt.com buttons-for-website.com buttons-for-your-website.com best-seo-offer.com 100dollars-seo.com semaltmedia.com as referral spam
# (c) 2015 Rolands Umbrovskis, http://umbrovskis.com
# if code above do not work:
if ($http_referer ~ "(semaltmedia\.com|100dollars-seo\.com|semalt\.com|buttons-for-website.com|buttons-for-your-website\.com|best-seo-offer\.com)") {
set $prohibited "1";
}
if ($prohibited) {
return 403;
@rolandinsh
rolandinsh / gist:2cd41b671f1ac845f309
Last active August 29, 2015 14:16
Matching an HTML (or XML) tag with a certain attribute value (e.g. class or tag) by Mike Malone (https://twitter.com/mjmalone)
function get_tag( $attr, $value, $xml, $tag=null ) {
if( is_null($tag) )
$tag = '\\w+';
else
$tag = preg_quote($tag);
$attr = preg_quote($attr);
$value = preg_quote($value);
$tag_regex = "/<(".$tag.")[^>]*$attr\\s*=\\s*".
@rolandinsh
rolandinsh / gist:f60d36895cb947022f43
Last active August 29, 2015 14:16
recursively give directories/files read&execute privileges
To recursively give directories read&execute privileges:
find /path/to/base/dir -type d -exec chmod 755 {} +
To recursively give files read privileges:
find /path/to/base/dir -type f -exec chmod 644 {} +
Or, if there are many objects to process:
@rolandinsh
rolandinsh / gist:4b6cbfcb817de1dcc78c
Last active August 29, 2015 14:13
block visitors referred from semalt.com and buttons-for-website.com
# block visitors referred from semalt.com and buttons-for-website.com
RewriteEngine on
RewriteCond %{HTTP_REFERER} semalt\.com [NC]
RewriteRule .* - [F]
RewriteCond %{HTTP_REFERER} buttons\-for\-website\.com
RewriteRule ^.* - [F,L]
RewriteCond %{HTTP_REFERER} buttons\-for\-your\-website\.com
RewriteRule ^.* - [F,L]
@rolandinsh
rolandinsh / gist:6aaba9ebe5d070d5da4a
Last active August 29, 2015 14:03
Elance Auth fail OpenID
object(Auth_OpenID_FailureResponse)#95 (6) {
["status"]=> string(7) "failure"
["endpoint"]=> NULL
["identity_url"]=> NULL
["message"]=> string(34) "Server denied check_authentication"
["contact"]=> NULL
["reference"]=> NULL
}
NOT authenticated
@rolandinsh
rolandinsh / WP-CLI-bash-update
Last active December 31, 2015 04:29
WP-CLI bash update
#!/bin/bash
declare -a wp_sites=('/var/www/pub/site1/' '/var/www/pub/site2/')
for site in "${wp_sites[@]}"; do
echo Upgrade in prograss for $site...
wp --path=$site db export $site/db-backup.sql
wp --path=$site core update
done
Installing '/usr/lib/php5/20121212/geoip.so'