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:
var Article = require('../../../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
# This shows the setup for two services, an accounts service which connects to a database and a pagerduty service which connects to the pagerduty api | |
# Directory structure | |
accounts/ | |
|_ Dockerfile | |
pagerduty/ | |
|_ Dockerfile | |
nginx/ | |
|_ conf/ | |
|_ sites.conf | |
|_ .htpasswd |
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
var Nightmare = require('nightmare'), | |
vo = require('vo'); | |
function *start() { | |
var nightmare = new Nightmare({ | |
show: true, | |
'download-preferences': { | |
destination: require('path').resolve(__dirname, 'downloads') | |
} | |
}); |
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/bash | |
# install CUDA Toolkit v9.0 | |
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb) | |
CUDA_REPO_PKG="cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb" | |
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/${CUDA_REPO_PKG} | |
sudo dpkg -i ${CUDA_REPO_PKG} | |
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
sudo apt-get update | |
sudo apt-get -y install cuda-9-0 |
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
# tested on AWS p2.xlarge August 29, 2018 | |
# install CUDA | |
sudo apt-get update && sudo apt-get install wget -y --no-install-recommends | |
CUDA_URL="https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.148-1_amd64" | |
wget -c ${CUDA_URL} -O cuda.deb | |
sudo dpkg --install cuda.deb | |
sudo apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub | |
sudo apt-get update | |
sudo apt-get install -y cuda |