-
-
Save simonespa/cc4b514ee88106c11f6d21b3f762867f to your computer and use it in GitHub Desktop.
Dev Cheat Sheets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # INIT A NEW REPO | |
| git init | |
| git add . | |
| git commit -m "first commit" | |
| git remote add origin git@github.com:<REPO>.git | |
| git push -u origin master | |
| # SECURITY ON GIT | |
| Remove Sensitive Data: https://help.github.com/articles/remove-sensitive-data/ | |
| Sensitive information can include, but is not limited to: | |
| Passwords | |
| SSH keys | |
| AWS access keys | |
| API keys | |
| Credit card numbers | |
| PIN numbers | |
| # CREATE TAG | |
| git tag -a released/aug2016 4985bea -m "Tagging 4985bea365b32c4d3dbc024517f2bfa858a75a72" | |
| git push origin --tags | |
| # REMOVE TAG | |
| git tag -d v1.6.0 | |
| git push origin :refs/tags/v1.6.0 | |
| # DELETE BRANCH | |
| Local: git branch -d the_local_branch | |
| Remote: git push origin :the_remote_branch | |
| # UPDATE BRANCH INDEX | |
| git remote update origin --prune | |
| # MOVE BRANCH | |
| git branch -m old_branch new_branch # Rename branch locally | |
| git push origin :old_branch # Delete the old branch | |
| git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote | |
| or | |
| git branch -m new_branch | |
| # UNDO THE LAST COMMIT | |
| git reset --soft HEAD~1 | |
| # UNDO THE LAST Nth COMMITS | |
| git reset --soft HEAD~n | |
| # UNDO THE LAST COMMIT AND CHANGES | |
| git reset —hard HEAD~1 | |
| # BRANCHING: | |
| CREATE A BRANCH: git branch feature | |
| CHANGE TO A BRANCH: git checkout feature | |
| CREATE AND CHANGE TO A BRANCH: git checkout -b feature | |
| MERGE A BRANCH: git merge feature | |
| # EXECUTABLE | |
| git update-index --chmod=+x | |
| git ls-files -s | |
| git ls-tree {HEAD, FETCH_HEAD, ORIG_HEAD, master, origin/master, <branch>, origin/<branch>} | |
| # CONFIG | |
| git config --global http.proxy http://domainproxy:80 | |
| git config --global --unset http.proxy | |
| [user] | |
| name = <NAME> | |
| email = <EMAIL> | |
| [core] | |
| editor = vi | |
| excludesfile = /home/developer/.gitignore_global | |
| [help] | |
| autocorrect = 1 | |
| [color] | |
| branch = auto | |
| diff = auto | |
| interactive = auto | |
| status = auto | |
| [credential "https://github.com"] | |
| username = <USERNAME> | |
| helper = cache --timeout=3600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create Self-signed Certificates | |
| openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 | |
| openssl rsa -passin pass:x -in server.pass.key -out server.key | |
| rm server.pass.key | |
| openssl req -new -key server.key -out server.csr | |
| openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt | |
| # Update CA for OpenSSL | |
| curl http://curl.haxx.se/ca/cacert.pem >/usr/local/etc/openssl/cert.pem | |
| curl https://yourdomain.com/ca.pem >>/usr/local/etc/openssl/cert.pem | |
| # Generate PEM, CRT and KEY | |
| openssl pkcs12 -in cert.p12 -out cert.crt -clcerts -nokeys | |
| openssl pkcs12 -in cert.p12 -out cert_chain.crt -nokeys | |
| openssl pkcs12 -in cert.p12 -out cert.key -nocerts -nodes | |
| openssl pkcs12 -in cert.p12 -out cert.pem -nodes | |
| # Check a PKCS#12 keystore file (.pfx or .p12) | |
| openssl pkcs12 -info -in keyStore.p12 | |
| # Check a private key | |
| openssl rsa -check -in cert.key | |
| # Check a PEM certificate | |
| openssl x509 -text -noout -in cert.pem | |
| # Check a JSK keystore file | |
| keytool -list -v -keystore privateKey.store | |
| # Check an SSL connection. All the certificates (including Intermediates) should be displayed | |
| openssl s_client -connect <HOST>:<PORT> | |
| # CRL | |
| openssl crl -in /etc/crl/d897bec1.r0 -noout -text | |
| # Import/Export keystores | |
| keytool -importkeystore -srckeystore keystore.p12 -destkeystore keystore.jks -srcstoretype pkcs12 | |
| # Java Keystore (keytool) | |
| https://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html | |
| # How to create a trust store and import a certificate | |
| keytool -genkey -dname "cn=name@example.com" -alias truststorekey -keyalg RSA -keystore ./client-truststore.jks -keypass changeit -storepass changeit | |
| keytool -import -keystore ./client-truststore.jks -file ./cert.pem -alias devcert | |
| # Runtime flags | |
| -Djsse.enableSNIExtension=false -Djavax.net.ssl.trustStore=/path/to/trustore.jks -Djavax.net.ssl.trustStorePassword=<PASSWORD> -Djavax.net.ssl.keyStore=<KEYSTORE> -Djavax.net.ssl.keyStorePassword=<PASSWORD> -Djavax.net.ssl.keyStoreType=PKCS12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment