Skip to content

Instantly share code, notes, and snippets.

View uhho's full-sized avatar

Lukasz uhho

  • Axelspace
  • Tokyo
View GitHub Profile
@uhho
uhho / linear_regression.js
Last active August 10, 2023 23:59
Simple linear regression in JS
/**
* Simple linear regression
*
* @param {Array.<number>} data
* @return {Function}
*/
function regression(data) {
var sum_x = 0, sum_y = 0
, sum_xy = 0, sum_xx = 0
, count = 0
@uhho
uhho / node nginx configuration
Created October 4, 2013 01:16
Sample nginx configuration for NodeJS + SocketIO app
# Load balancer configuration
upstream exampleApp {
# Directs to the process with least number of connections.
least_conn;
# One failed response will take a server out of circulation for 20 seconds.
server 127.0.0.1:10080 fail_timeout=20s;
#server 127.0.0.1:10081 fail_timeout=20s;
#server 127.0.0.1:10082 fail_timeout=20s;
#server 127.0.0.1:10083 fail_timeout=20s;