Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted in category Digital Despotism / Web Development
posted at 28. Jan '20
last updated at 05. Dec '20

Development Tools Random Notes

See Docker Cheatsheet

Git search string in file across history

git log -S'bar' -- foo.rb

Git sign previous commits

Don’t rebase already pushed/merged commits in shared branches, you have to force push.

git rebase --exec 'git commit --amend --no-edit -n -S' -i my_branch

Exec commands in previous commits

pick fdb95e39 my great feature
fixup 7f0511d7 aaa
fixup 26fa431e fix specs
fixup 0d9f4a62 done
x git commit --amend --date="$(date)" -S
pick 9fa36ba0 some additional stuff
x git commit --amend --date="$(date)" -S
pick fdb95e39 and something else

SSH copy SSH key to host automatically

Sets authorized_keys automatically.

ssh-copy-id -i ~/.ssh/myrtana.pub -f sandokan@myrtana.sk

Docker Allows Access To Containers By Default

By default Docker allows access to containers from the outside! If it has public IP and no authentication on Redis, Memcached or Postgres/MySQL, they will be attacked and maybe hacked.

Check with:

iptables -L
iptables -L -t nat
nmap -p 1-10000 YOUR_PUBLIC_IP

More: https://sites.google.com/site/amitsciscozone/home/docker/docker-networking-basics

Docker List Volumes

docker inspect --format="{{.Mounts}}" $containerID

Nginx Validate Configuration

It’s a good idea after making changes in nginx configuration to validate changes first. Less frustrating than when reload or restart fail. Especially restart.

sudo nginx -t

Grepping Error Codes in access_log.log

Useful for quick grepping through access log. This one finds all 4xx errors except 404 and 401.

cat access_log.log | grep -P "\" 4\d\d " | grep -v 404 | grep -v 401

Add Comment