Skip to content

Instantly share code, notes, and snippets.

View lucax88x's full-sized avatar

Luca Trazzi lucax88x

View GitHub Profile
@jamlfy
jamlfy / balance.js
Last active December 26, 2015 13:29
To balance clustered nodejs actually generates greater stability
const cluster = require('cluster');
const http = require('http');
const httpProxy = require('http-proxy');
const _ = require('underscore');
var numCPUs = 10;
var isPort = 8080;
function estimatePi() {
var n = 10000000, inside = 0, i, x, y;
@carlok
carlok / istat.sql
Last active January 21, 2022 10:18
Script SQL per la memorizzazione dei Comuni, delle Province e delle Regioni d’Italia: usare la nuova versione su https://github.com/carlok/comuni_sql
---
--- Usare la nuova versione su https://github.com/carlok/comuni_sql
---
CREATE TABLE IF NOT EXISTS regioni (
id int(11) NOT NULL auto_increment,
nome varchar(100) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active December 31, 2025 09:18
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,