Skip to content

Instantly share code, notes, and snippets.

@Zlate87
Last active September 19, 2023 10:52
Show Gist options
  • Select an option

  • Save Zlate87/e402a96dacb404f8ff4e to your computer and use it in GitHub Desktop.

Select an option

Save Zlate87/e402a96dacb404f8ff4e to your computer and use it in GitHub Desktop.
Things that I use, but don't want to remember

Cheat Sheet

Android

Obtain signing certificate fingerprint (SHA1):

keytool -list -v -keystore [KEY_STORE_NAME]

Parse versionCode from android apk file:

aapt dump badging [APK_NAME]

Create a keystore from command line:

keytool -genkey -v -keystore sign.keystore -alias [ALIAS_NAME] -keyalg RSA -keysize 2048 -validity 36500

Verify apk signature:

jarsigner -verify -verbose -certs [APK_NAME]

Update SDK on the command line:

android list sdk --all
android update sdk -u -a -t [INDEXES_SEPARATED_BY_COMMA]

Decompile APK:

apktool d [APK_NAME]

More info for the apktool here.

Find out a library method count: http://www.methodscount.com/

Git

Fix LFS issue:

git lfs migrate import --no-rewrite "filePath1" "filePath2" ...

git lfs uninstall
git reset --hard
git lfs install
git lfs pull 

Cache the git credentials on windows:

git config --global credential.helper wincred

Add execution permission to a file:

git update-index --chmod=+x [FILE_NAME]

Remove all local changes in the master branch:

git fetch --all
git reset --hard origin/master

Reset the last commit

git reset HEAD~1

Git force push

git push --force

Reset or revert a specific file to a specific revision using Git

git checkout [COMMIT-HASH] [PATH/TO/FILE]
JSON

Online POJO creator from a JSON: http://www.jsonschema2pojo.org/

Windows

Redirect the command line output:

echo Hello World >output.txt
echo Hello again! >>output.txt
Linux

Get directory size:

du -sh
Maven

Activate a profile:

mvn clean install -P
SVN

Revert to old changes:

svn merge -r HEAD:[REVISION_NUMBER] .

Merge branch in to local workspace:

svn merge [BRANCH_URL] .

Give permissions to a script file, so it can be executed:

svn propset svn:executable ON [FILE_NAME]

Revert file:

svn revert [FILE_NAME]
OpenSSL

Test the secure connections to a server:

openssl s_client -connect [URL]:443 (optionally: -servername [servername])

See the SSL and TLS connection handshaking, security negotiate, public keys and transfer of digital certificates and key information to the client:

openssl s_client -state -nbio -connect [URL]:443

See the SSL and TLS connection handshaking, security negotiate, public keys and transfer of digital certificates and key information to the client:

openssl s_client -connect [URL]:443 -CAfile [CA_FILE_NAME]

Inspect the .p12 file

openssl pkcs12 -in [P12_FILE_NAME] -info

To convert der to pem with openSSL:

openssl x509 -inform der -in certificate.cer -out certificate.pem

To inspect a PEM certificate:

openssl x509 -in certificate.pem -text -noout

To convert pkcs8 to pkcs1 use https://decoder.link/rsa_converter

Usefull links:
http://www.cyberciti.biz/tips/debugging-ssl-communications-from-unix-shell-prompt.html http://stackoverflow.com/questions/7587851/openssl-unable-to-verify-the-first-certificate-for-experian- https://www.youtube.com/watch?v=iQsKdtjwtYI

GitHub

Mastering Markdown
Markdown Cheatsheet

Redis

Connect remoatly to a redis instance on CF:

Get the redis host using an app it is boud to:

cf env [APP_NAME]

Open ssh tunel:

cf ssh [APP_NAME] -L 12345:[HOST]:6379 -N -T

In a new tab connect using the redis cil:

redis-cli -p 12345

Redis Cheatsheet

node

Update dependencies:

ncu -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment