function show() {
DOMAIN=".example.com"
REMOTE="$2$DOMAIN"
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}
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
/** | |
* A console.assert which actually stop the exectution. | |
* default console.assert() is a plain display, such as console.log() or console.error(); | |
* It doesnt stop the execution like assert() is meant to do. This is a little code to | |
* "workaround this limitation" :) thanks @jensarp | |
* | |
* Usage: | |
* console.assert(foo === bar); // Will throw if not equal | |
* console.assert(foo === bar, 'Dude, foo does not equal bar'); // Will throw with custom error message | |
* |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
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
apt install curl gnupg software-properties-common ca-certificates curl gnupg apt-transport-https wget | |
# Node | |
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/nodesource.gpg | |
NODE_MAJOR=18 | |
echo "deb [signed-by=/etc/apt/trusted.gpg.d/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list | |
# Google Chrome | |
sudo sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list' | |
curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-chrome.gpg |
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
= Fitness and Nutrition Recommendations | |
:neo4j-version: 2.3.2 | |
:author: Benjamin Nussbaum | |
:twitter: @bennussbaum | |
== Introduction | |
I was recently motivated to re-imagine the BeachBody fitness programs and nutritional supplements as a graph with the goal being to recommend fitness programs, nutritional supplements and other users that would be personalized to my user persona. | |
For those that don’t know, BeachBody is responsible for P90X, INSANITY, T25 and a plethora of others that they’ve been distributing via DVD for years. | |
== The Project |
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
/** Async version of Array.prototype.reduce() | |
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => { | |
* acc[v] = await (await fetch(v)).json(); | |
* return acc; | |
* }, {}); | |
*/ | |
export async function reduce(arr, fn, val, pure) { | |
for (let i=0; i<arr.length; i++) { | |
let v = await fn(val, arr[i], i, arr); | |
if (pure!==false) val = v; |