Skip to content

Instantly share code, notes, and snippets.

@daniftodi
daniftodi / generate-public-private-keys
Last active November 9, 2023 14:36
Sign and Verify using openssl
# generate keys
openssl req -new -x509 -newkey rsa:4096 -keyout private.pem -sigopt rsa_padding_mode:pss -sha256 -sigopt rsa_pss_saltlen:64 -out public.pem -nodes
# openssl can't read PEM format, convert the key
openssl rsa -in private.pem -pubout > public.rsa
# sign a file, save the signature
openssl dgst -sign private.pem file.txt > signature.txt
# verify the file using signature
Note for me to remember how to set Android Home on Mac
Open Terminal and type in..
nano ~/.bash_profile
Add the below paths
The path should be where your android installation is located
export ANDROID_HOME=/Users/username/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Save file and type in terminal...
source ~/.bash_profile
@daniftodi
daniftodi / encrypt_openssl.md
Created December 18, 2020 09:53 — forked from dreikanter/encrypt_openssl.md
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

@daniftodi
daniftodi / Free O'Reilly Books.md
Created October 10, 2016 13:47 — forked from augbog/Free O'Reilly Books.md
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.