brew install mongodb
mkdir -p /data/db
Ensure that user account running mongod has correct permissions for the directory:
If you are still on Trusty you'll need a modern gcc toolchain.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
sudo apt-get update
sudo apt-get install build-essential git scons libssl-dev gcc-6 g++-6
sudo apt-get install libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev
sudo apt-get install python-pymongo
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 1
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
bash -c zsh | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<h1>Hello</h1> | |
<img src="<%= data[0].path %>" alt=""> | |
</body> |
var express = require('express'); | |
var session = require('express-session'); | |
var cookieParser = require('cookie-parser'); | |
var flash = require('connect-flash'); | |
var app = express(); | |
app.use(cookieParser('secret')); | |
app.use(session({cookie: { maxAge: 60000 }})); | |
app.use(flash()); |
// Usage: $form.find('input[type="checkbox"]').shiftSelectable(); | |
// replace input[type="checkbox"] with the selector to match your list of checkboxes | |
$.fn.shiftSelectable = function() { | |
var lastChecked, | |
$boxes = this; | |
$boxes.click(function(evt) { | |
if(!lastChecked) { | |
lastChecked = this; |
def euclidean_distance(pt1, pt2): | |
distance = 0 | |
for i in range(len(pt1)): | |
distance += (pt1[i] - pt2[i]) ** 2 | |
return distance ** 0.5 | |
print(euclidean_distance([1, 2], [4, 0])) | |
print(euclidean_distance([5, 4, 3], [1, 7, 9])) |
def euclidean_distance(pt1, pt2): | |
distance = 0 | |
for i in range(len(pt1)): | |
distance += (pt1[i] - pt2[i]) ** 2 | |
return distance ** 0.5 | |
def manhattan_distance(pt1, pt2): | |
distance = 0 | |
for i in range(len(pt1)): | |
distance += abs(pt1[i] - pt2[i]) |
ls | grep "png" | xargs -d "\n" cp -t $target_dir |
# Get octal file permissions number | |
# https://www.cyberciti.biz/faq/get-octal-file-permissions-from-command-line-on-linuxunix/ | |
stat -c '%a' /etc/passwd |