Skip to content

Instantly share code, notes, and snippets.

View sohailalam2's full-sized avatar
🙇
Stay Hungry, Stay Foolish

Sohail Alam sohailalam2

🙇
Stay Hungry, Stay Foolish
View GitHub Profile
@sohailalam2
sohailalam2 / softmax.js
Created January 18, 2017 14:51 — forked from vladimir-ivanov/softmax.js
softmax function implementation in js
let softmax = (arr) => (index) => Math.exp(arr[index]) / arr.map(y => Math.exp(y)).reduce((a, b) => a + b);
// Using a wrapper function to prevent global namespace pollution
(function () {
var tempArray = [], // the final flattened array
idx = 0; // the position of elements in the flattent result array
/**
* A helper function to actually flatten the array
* @param array The given array as input
* @param inner A parameter to identify whether or not the function is recursively called
* @returns {*} Returns a flattened array
@sohailalam2
sohailalam2 / starter.sh
Last active August 29, 2015 14:10 — forked from danro/starter.sh
#!/bin/sh
if [ $(ps aux | grep $USER | grep node | grep -v grep | wc -l | tr -s "\n") -eq 0 ]
then
export PATH=/usr/local/bin:$PATH
export NODE_ENV=production
cd /path/to/app && forever --spinSleepTime 10000 start server.js >> forever.log 2>&1
fi