Skip to content

Instantly share code, notes, and snippets.

View ifeLight's full-sized avatar

Ifedayo Karim ifeLight

View GitHub Profile
@adrianmcli
adrianmcli / compile.js
Last active September 29, 2022 14:33
Programmatically compile and deploy Solidity smart contracts for your tests
const path = require("path");
const fs = require("fs");
const TruffleCompile = require("truffle-compile");
// Promisify truffle-compile
const truffleCompile = (...args) =>
new Promise(resolve => TruffleCompile(...args, (_, data) => resolve(data)));
const compile = async filename => {
const sourcePath = path.join(__dirname, "../contracts", filename);
@inecmc
inecmc / notes.md
Created August 4, 2017 08:06
How to run multiple Redis instances on Ubuntu 16.04

Create the directory for the new instance

$ sudo install -o redis -g redis -d /var/lib/redis2

Create a new configuration file

$ sudo cp -p /etc/redis/redis.conf /etc/redis/redis2.conf
@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