This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Based on https://discuss.elastic.co/t/finding-and-deleting-empty-indexes/172764 | |
# Usage: | |
# elastic_search_delete_empty_indexes.sh servername:9200 #for dry run | |
# elastic_search_delete_empty_indexes.sh servername:9200 delete #to really delete | |
srv="" | |
delete=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Last byte for IPv4 and last 80 bits for IPv6 are set to zero | |
* @see https://support.google.com/analytics/answer/2763052?hl=en | |
*/ | |
function anonymizeIp($ip) | |
{ | |
$binary = inet_pton($ip); | |
if ($binary === false) { | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var detectUrls = function(text) { | |
var pattern = /(?:^|[\s\n\r])((?:https?:\/\/|www\.)[^\s\n\r]+)/ig, | |
urls = [], | |
matches; | |
while ((matches = pattern.exec(text)) !== null) { | |
urls.push(matches[1]); | |
} | |
return urls; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getElementsByXPath = function(xpath, parentElement) { | |
var xpathResult = document.evaluate(xpath, parentElement, null, XPathResult.ANY_TYPE, null); | |
var results = []; | |
var element = xpathResult.iterateNext(); | |
while(element) { | |
results.push(element); | |
element = xpathResult.iterateNext(); | |
} | |
return results; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local _M = {} | |
function _M.getHostname() | |
local f = io.popen ("/bin/hostname") | |
local hostname = f:read("*a") or "" | |
f:close() | |
hostname =string.gsub(hostname, "\n$", "") | |
return hostname | |
end | |
return _M |