This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let softmax = (arr) => (index) => Math.exp(arr[index]) / arr.map(y => Math.exp(y)).reduce((a, b) => a + b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
NewerOlder