Skip to content

Instantly share code, notes, and snippets.

View ideiudicibus's full-sized avatar

ignazio de iudicibus ideiudicibus

View GitHub Profile
@ideiudicibus
ideiudicibus / gist:d00f7158e3aa24bf0d363b6f079d1353
Created August 6, 2020 16:38 — forked from manchot0/gist:537934a1bbd124aec4d98bd37dfcd772
Tomcat cluster with Nginx load balancer and caching
https://nginx.org/en/docs/http/load_balancing.html
https://www.linode.com/docs/uptime/loadbalancing/use-nginx-as-a-front-end-proxy-and-software-load-balancer/
http://blog.martinfjordvald.com/2011/02/nginx-primer-2-from-apache-to-nginx/
http://www.ramkitech.com/2012/11/tomcat-clustering-series-part-3-session.html
http://www.ramkitech.com/2012/10/tomcat-clustering-series-simple-load.html
https://www.foulquier.info/tutoriaux/mise-en-place-dun-cluster-heartbeat-apache
https://www.nginx.com/resources/admin-guide/content-caching/
https://www.digitalocean.com/community/tutorials/understanding-nginx-http-proxying-load-balancing-buffering-and-caching
https://www.digitalocean.com/community/tutorials/how-to-use-floating-ips-on-digitalocean#how-to-implement-an-ha-setup
https://www.nginx.com/resources/deployment-guides/load-balance-apache-tomcat/
@ideiudicibus
ideiudicibus / gist:0642a1ca6dc40d90dc9568690b638114
Created July 31, 2018 16:02 — forked from esfand/gist:368392
Servlet Request String Handling
//Source:http://www.exampledepot.com/egs/javax.servlet/GetReqUrl.html
// http://hostname.com/mywebapp/servlet/MyServlet/a/b;c=123?d=789
// The most convenient method for reconstructing the original URL is to use
// ServletRequest.getRequestURL(), which returns all but the query string. Adding the
// query string reconstructs an equivalent of the original requesting URL:
// http://hostname.com/mywebapp/servlet/MyServlet/a/b;c=123?d=789
@ideiudicibus
ideiudicibus / decaffeinate_coffeescript_files.txt
Last active November 22, 2017 12:15
convert and remove coffeescript files
I don't like coffeescript syntax and I discovered that I'm not alone.
This project does the work:
http://decaffeinate-project.org/
usage:
# install locally
$ npm install -g decaffeinate
# convert a single file
@ideiudicibus
ideiudicibus / meteor-wrapasync.md
Created September 11, 2017 14:43 — forked from DanAncona/meteor-wrapasync.md
Meteor vs. the Twitter API via wrapAsync and Twit

Twit and other Node libraries don't always quite drop into Meteor's reactive architecture right out of the box. Luckily Meteor makes adapting them super-duper easy with wrapAsync. It was so easy that I naturally tried all the more difficult ways first! Since I didn't find a nice gist or StackOverflow example, please enjoy this one.

In the template -

{{#with pos}}
  {{#if ready}}
    {{> singlePosition data }}
Attaching to docker_load-balancer_1, docker_hystrix-dashboard_1, docker_web-client_1, docker_gateway_1, docker_business-intelligence-service_1, docker_web-content-service_1, docker_zipkin-web_1, docker_core_1, docker_zipkin_1, docker_logstash_1, docker_kibana_1, docker_configuration_1, docker_business-intelligence-service-postgres-database_1, docker_base_1, docker_web-content-service-postgres-database_1, docker_discovery_1, docker_elasticsearch_1, docker_redis_1, docker_rabbitmq_1, docker_core-postgres-database_1
load-balancer_1 | WARNING: no logs are available with the 'gelf' log driver
hystrix-dashboard_1 | WARNING: no logs are available with the 'gelf' log driver
web-client_1 | WARNING: no logs are available with the 'gelf' log driver
gateway_1 | WARNING: no logs are available with the 'gelf' log driver
business-intelligenc
function doGet(e) {
if(typeof e !== 'undefined')
return ContentService.createTextOutput(JSON.stringify(e.parameter));
}
function doPost(e) {
if(typeof e !== 'undefined')
@ideiudicibus
ideiudicibus / clone-google-spreadsheet.gs
Last active April 5, 2016 12:20
google apps script GAS clone a spreadsheet
//in client try to use hello js https://adodson.com/hello.js/
function doGet(e) {
//parameters
var fileId = e.parameters.fileId;
var fileName=e.parameters.name;
var editor=e.parameters.editor;
//clone the file
var f= DriveApp.getFileById(fileId).makeCopy(fileName);
f.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.VIEW);
f.addEditor(editor);
@ideiudicibus
ideiudicibus / testPaginegialleCinema.js
Created September 3, 2012 16:11
paginegialle.it cinema web scraping
var request = require('request'),
cheerio = require('cheerio'),
url= 'http://www.paginegialle.it/cinema-programmazione/Roma%20(RM)',
ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2';
var parsePage = function(error, response, body) {
if (error || response.statusCode != 200) {
console.log(error);
}
@ideiudicibus
ideiudicibus / svn_recursive_add.sh
Created May 30, 2011 17:08
svn recursive add from local directory
#svn recursive add script to be used on current directory
#!/bin/sh
svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add
svn commit -m "$1"
@ideiudicibus
ideiudicibus / registrar.js
Created May 13, 2011 12:45 — forked from chrismatthieu/registrar.js
Node.JS SIP Registrar
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
}
sip.start({},function(request) {