cURL snippets

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

HTML, JavaScript snippets

Simple input form <!DOCTYPE html> <html> <head> <title>The name at tab</title> </head> <body> <h1>First section - h1</h1> <p>First paragraph</p> <form action="/action_page.php"> <label for="fname">First input:</label> <input type="text" id="first_input" name="input_1"><br><br> <label for="lname">Second input:</label> <input type="text" id="second_input" name="input_2"><br><br> <input type="submit" value="Text on button"> </form> </body> </html> You should write action_page.php further. When tou click the button, it passes to /action_page.

SSH snippets

Local Port forwarding ssh -L SSH portforwarding in backgraound ssh -fNT -L 8888:localhost:8888 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 User git Port 22 Hostname IdentityFile ~/.ssh/id_ecdsa TCPKeepAlive yes IdentitiesOnly yes Host myserver*.

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 ?

Tips for Ansible

Before installing via pip (in WSL) sudo apt install libffi-dev Debugging step by step Run a playbook with option --step. Pipe (|) in variable It is called “filter”. when, and, or, not Group restriction If you have a large amount of servers in inventories, -l option can restrict the target of playbook. -l Server_group_name -l FQDN What ever the system use systemd or initd When your environment has different OSs, systemd module doesn’t work sometimes.