Skip to content

Instantly share code, notes, and snippets.

@HelioCampos
Last active May 27, 2020 22:19
Show Gist options
  • Save HelioCampos/68e84d0d057c9df437af5565a872989e to your computer and use it in GitHub Desktop.
Save HelioCampos/68e84d0d057c9df437af5565a872989e to your computer and use it in GitHub Desktop.
One liner commands
# Oneliners
## SSL
### Retrieve ssl cert from command line. Seems to be getting only one of the certs.
DNS='mydomain.com'
SERVER_NAME=$DNS # Forcing to return only the certificate for the current DNS.
PORT=443
echo | openssl s_client -showcerts -servername $SERVER_NAME -connect $DNS:$PORT 2>/dev/null | openssl x509 -inform pem -noout -text
## VIM
### Execure modifications on a file without staying on it
vim -c "1,$ s/^/insert\t\r/g" -c ':wq' all-dev3.yml
### The same with a loop
for idd in $(seq 1, 9); do vim -c "1,$ s/^/insert ${idd}\t\r/g" -c ':wq' all-dev${idd}.yml; done
### Strings substitute
perl -p -e 's/\x0/\n/g' FILE_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment