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
| Sinatra::Application.routes["GET"].each do |route| | |
| before do | |
| // All the things | |
| end | |
| end |
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
| // register the service worker | |
| navigator.serviceWorker.register('/worker.js').then( | |
| function(reg) { console.log('Installed successfully', reg) }, | |
| function(err) { console.log('Worker installation failed', err) } | |
| ); | |
| // ... worker.js | |
| self.addEventListener('fetch', function(event) { | |
| var requestURL = new URL(event.request); |
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 Words(str) { | |
| this._str = str; | |
| } | |
| Words.prototype[Symbol.iterator] = function() { | |
| var re = /\S+/g; | |
| var str = this._str; | |
| return { | |
| next: function() { |
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) |
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
| # 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
| 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
| 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
| 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
| 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 |