Reference URL: https://medium.com/@clasikas/docker-tips-tricks-or-just-useful-commands-6e1fd8220450
docker ps # show only running
docker ps -a # show all containers
# filter by request host header | |
varnishlog -q 'ReqHeader ~ "Host: example.com"' | |
# filter by request url | |
varnishlog -q 'ReqURL ~ "^/some/path/"' | |
# filter by client ip (behind reverse proxy) | |
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"' | |
# filter by request host header and show request url and referrer header |
Reference URL: https://medium.com/@clasikas/docker-tips-tricks-or-just-useful-commands-6e1fd8220450
docker ps # show only running
docker ps -a # show all containers
function isNum(x) { | |
return !isNaN(x); | |
} | |
function hasX(v) { | |
return v && isNum(v.x); | |
} | |
function hasY(v) { | |
return v && isNum(v.y); | |
} | |
function hasXY(v) { |
echo "Mock wget" |
;; This is typical setup stuff with bootstrap loading of use-package | |
(require 'package) | |
(setq package-enable-at-startup nil) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) | |
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) | |
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")) | |
(package-initialize) | |
(unless (package-installed-p 'use-package) | |
(package-refresh-contents) |
# :create-user :password :wheel :sudoer :sudo | |
sudo useradd -G wheel -p "$(openssl passwd)" "admin" | |
# grep stuff | |
find . | grep -vE "(.git|./wiki)" | grep -E "\.sh$" | xargs -0 grep -ni "batman" | |
# :here-doc :variable :here | |
# save multi-line value from 'here doc' into bash variable | |
VAR=$(cat <<'END_HEREDOC' | |
abc'asdf" |
#!/bin/bash | |
function react() { | |
npm init -y | |
npm install -S \ | |
react \ | |
react-dom \ | |
redux \ | |
babel-core \ | |
babel-loader \ |
Supported escape sequences: | |
~. - terminate session | |
~B - send a BREAK to the remote system | |
~R - Request rekey (SSH protocol 2 only) | |
~# - list forwarded connections | |
~? - this message | |
~~ - send the escape character by typing it twice | |
(Note that escapes are only recognized immediately after newline.) | |
Reference: |
package main | |
import ( | |
"fmt" | |
"net/http" | |
"os" | |
) | |
func main() { | |
dir := "." |
#!/bin/bash | |
git stash -q --keep-index | |
go test --race ./... | |
RESULT=$? | |
git stash pop -q | |
if [ $RESULT -ne 0 ] ; then | |
echo "pre-commit tests failed." | |
exit 1 |