Skip to content

Instantly share code, notes, and snippets.

View ngugijames's full-sized avatar
🇰🇪
.

James Ngugi ngugijames

🇰🇪
.
View GitHub Profile
@ngugijames
ngugijames / longPolling.js
Created October 28, 2015 07:22 — forked from jasdeepkhalsa/longPolling.js
Simple Long Polling Example with JavaScript and jQuery by Tian Davis (@tiandavis) from Techoctave.com (http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast)
(function poll(){
$.ajax({ url: "server", success: function(data){
//Update your dashboard gauge
salesGauge.setValue(data.value);
}, dataType: "json", complete: poll, timeout: 30000 });
})();
@ngugijames
ngugijames / officetophp.php
Created January 11, 2016 10:42
DOC, DOCX, PPT, XLSX to TXT in PHP
/*determine th file extension
$file_name = $_FILES['image']['name'];
$file_extn = end(explode(".", strtolower($_FILES['image']['name'])));
if($file_extn == "doc" || $file_extn == "docx"){
}elseif($file_extn == "rtf"){
}
*/
#Filter:
cd /etc/fail2ban/filter.d
[Definition]
#failregex = <HOST> - - \[(\d{2})/\w{3}/\d{4}:\1:\1:\1 -\d{4}\] "POST /admin/ HTTP/1.1"
#failregex = ^<HOST> - .* "POST /admin/ HTTP/1.1" 499
#failregex = ^<HOST> - .* "(GET|POST|HEAD).*HTTP.*" 404 .*$
#failregex = ^<HOST> - .* "(GET|POST|HEAD) /admin/ HTTP.*" .*$