This file contains hidden or 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
| function requireRole(role) { | |
| return function(req, res, next) { | |
| if (req.session.user && req.session.user.role === role) { | |
| next(); | |
| else { | |
| res.send(403); | |
| } | |
| } | |
| } |
This file contains hidden or 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
| set nocompatible | |
| set t_Co=256 | |
| filetype off | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| Bundle 'gmarik/Vundle.vim' |
This file contains hidden or 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
| { | |
| "env": { | |
| "browser": true, | |
| "node": true, | |
| "amd": true | |
| }, | |
| "rules": { | |
| "no-console": 2, | |
| "no-comma-dangle": 2, |
This file contains hidden or 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
| for line in `docker ps | awk '{print $1}' | grep -v CONTAINER`; do docker ps | grep $line | awk '{printf $NF" "}' && echo $(( `cat /sys/fs/cgroup/memory/docker/$line*/memory.usage_in_bytes` / 1024 / 1024))MB ; done |
This file contains hidden or 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
| sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000 |
This file contains hidden or 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
| node -e ' | |
| function clean(j) { | |
| if (!j) return | |
| for (var k in j) { | |
| delete j[k].from | |
| delete j[k].resolved | |
| if (j[k].dependencies) clean(j[k].dependencies) | |
| } | |
| } | |
| x = JSON.parse(require("fs").readFileSync("./npm-shrinkwrap.json")) |
This file contains hidden or 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
| FROM ubuntu:utopic | |
| RUN apt-get update \ | |
| && apt-get install -y --force-yes \ | |
| apt-transport-https \ | |
| build-essential \ | |
| curl \ | |
| lsb-release \ | |
| python-all \ | |
| rlwrap \ |
This file contains hidden or 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
| # Shutdown local node | |
| curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown' | |
| # Shutdown all nodes in the cluster | |
| curl -XPOST 'http://localhost:9200/_shutdown' |
This file contains hidden or 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
| # is the last run container still running? | |
| docker inspect --format '{{.State.Running}}' $(docker ps -lq) |
This file contains hidden or 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 | |
| # Delete all containers | |
| docker rm $(docker ps -a -q) | |
| # Delete all images | |
| docker rmi $(docker images -q) |