Skip to content

Instantly share code, notes, and snippets.

View kanelv's full-sized avatar
🎯
Focusing

Cuong Le kanelv

🎯
Focusing
View GitHub Profile
@kanelv
kanelv / Spring-Boot-Clean-Architecture-DDD
Created April 14, 2024 17:51
Project Folder Structure Diagram for Spring-boot Clean Architecture Demo
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── example
│ │ │ ├── adapters
│ │ │ │ ├── controllers
│ │ │ │ │── database
│ │ │ │ │ ├── postgresql # Implementation for PostgreSQL
│ │ │ │ │ │ ├── entities # PostgreSQL entity classes
@aneudysamparo
aneudysamparo / gist:30d0c4d7f82cd089753dcda56de040b0
Created August 24, 2020 16:43
NestJs authentication using JWT and private and public key
Since it's been days, I am guessing this was solved. I am just adding my two cents here for future readers.
The problem lies with the JwtModule and the JwtStrategy instantiation. They aren't configured properly.
You need to pass in the algorithms you'd use for signing and verifying the tokens, along with the keys.
To verify whether the tokens are actually getting generated with the RS256 algo, check the header in the token at https://jwt.io/.
It would probably show HS256, and since your code didn't use the correct algorithm to sign the token.
And it fails while token gets verified using the public key.
To generate signed tokens properly with the RSA key pair:
@roustem
roustem / openssl.md
Created July 29, 2018 17:56 — forked from NoMan2000/openssl.md
Common OpenSSL Commands with Keys and Certificates

Common OpenSSL Commands with Keys and Certificates

SSL Info

Generate RSA private key with certificate in a single command

openssl req -x509 -newkey rsa:4096 -sha256 -keyout example.key -out example.crt -subj "/CN=example.com" -days 3650 -passout pass:foobar

Generate Certificate Signing Request (CSR) from private key with passphrase

openssl x509 -x509toreq -in example.crt -out example.csr -signkey example.key -passin pass:foobar

@dehamzah
dehamzah / generate.js
Last active June 12, 2024 18:42
Generate secret key in NodeJS
require('crypto').randomBytes(48, function(err, buffer) { var token = buffer.toString('hex'); console.log(token); });
@chranderson
chranderson / nvmCommands.js
Last active July 25, 2024 11:07
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@wojteklu
wojteklu / clean_code.md
Last active July 25, 2024 11:12
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@rxaviers
rxaviers / gist:7360908
Last active July 25, 2024 12:22
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"