Snippets

cURL snippets

Send a POST request curl -X POST https://yourdomain.com -d @data.txt @ is necessary. Enable redirecting curl -L yourdomain.com Ignore TLS certificate error in cURL Frequently used in test environment. curl --insecure https://yourdomain.com # or curl -k https://yourdomain.com Download a content which includes redirect curl -L yourdomain.com --output myfilename IPv6 Force curl to DNS as IPv6. curl -6 mydomain.com # From man # -6, --ipv6 Resolve names to IPv6 addresses Show header only curl -sS -I https://youdomain.

SSH snippets

Local Port forwarding ssh -L 50088:remote2.myserver.com:80 atlex@remote1.myserver.com SSH portforwarding in backgraound ssh -fNT -L 8888:localhost:8888 myuser@mydomain.com official mannual -f: Requests ssh to go to background just before command execution. -N: Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only). -T: Disable pseudo-tty allocation. Config file Host github.com User git Port 22 Hostname github.com IdentityFile ~/.ssh/id_ecdsa TCPKeepAlive yes IdentitiesOnly yes Host myserver*.

zsh snippets

for loop of all files in a directory The following snippet shows all files in Loop_dir. Loop_dir="path_to_dir" for entry in "$Loop_dir"/* do echo "$entry" done cf) https://stackoverflow.com/questions/13210880/replace-one-substring-for-another-string-in-shell-script/13210909 Check argument is set or not https://www.cyberciti.biz/faq/unix-linux-bash-script-check-if-variable-is-empty/ process tree ps -aef —forest Find from all files in the directory Find all lines from files in the current directory find ./ -type f -print | xargs grep 'foo' I created my custom alias. alias afind="find -type f -print | xargs grep" Delete prefix of files in a directory Here is a pioneer.

snippets

/etc/modules Here are the list of modules that Kernel load at boot. logrotate Good tool. OpenProject Using docker image docker run -d -p 8080:80 -e SECRET_KEY_BASE=secret openproject/community:latestDocker or LXD https://iopscience.iop.org/article/10.1088/1742-6596/1211/1/012042 -> not so good for me https://discuss.linuxcontainers.org/t/do-i-need-docker/605 -> comprehensive and this is what I want. Compare 2 directories diff -qr dir1/ dir2 Wildcard server auth TLS certificate The wildcard *.foo.com can’t indicate sub-subdirectory such as this.is.foo.com. Vim - centerning the cursor aloways http://vimdoc.

Snippets of Git

Completely delete submodule from the repository Here is the graceful memo. I copy&paste it to here. To remove a submodule you need to: Delete the relevant section from the .gitmodules file. Stage the .gitmodules changes git add .gitmodules Delete the relevant section from .git/config. Run git rm –cached path_to_submodule (no trailing slash). Run rm -rf .git/modules/path_to_submodule (no trailing slash). Commit git commit -m “Removed submodule ” Delete the now untracked submodule files rm -rf path_to_submodule Do you forgot to clone with --recursive ?