Skip to content

Instantly share code, notes, and snippets.

View kanelv's full-sized avatar
🎯
Focusing

Cuong Le kanelv

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am levcuong on github.
  • I am cuongkeybase (https://keybase.io/cuongkeybase) on keybase.
  • I have a public key ASDNPqT20481UC7bbiwnxUcXHy1BUTfMT9kPcpa-w9U4vgo

To claim this, I am signing this object:

@kanelv
kanelv / cloudSettings
Last active May 1, 2020 05:58
Undergraduate last game
{"lastUpload":"2020-05-01T05:58:14.297Z","extensionVersion":"v3.4.3"}
@kanelv
kanelv / how-to-copy-aws-rds-to-local.md
Created September 1, 2022 00:46 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@kanelv
kanelv / BinaryGap.js
Created March 8, 2023 13:12
BinaryGap
const solution = (N) => {
const binary = N.toString(2);
let count = 0;
let answer = 0;
for(let b of binary) {
if (b === "0") {
count++
} else {
@kanelv
kanelv / generate.js
Created May 7, 2023 10:22 — forked from dehamzah/generate.js
Generate secret key in NodeJS
require('crypto').randomBytes(48, function(err, buffer) { var token = buffer.toString('hex'); console.log(token); });
@kanelv
kanelv / openssl.md
Created May 7, 2023 11:43 — forked from roustem/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

@kanelv
kanelv / clean_code.md
Created May 7, 2023 15:43 — forked from wojteklu/clean_code.md
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

### STEP 1. Generate a new SSH key by the command below
```bash
ssh-keygen -t ed25519 -C "your_email@example.com"
```
### STEP 2. Copy the SSH public key to your clipboard by the command below
```bash
# macOS
pbcopy < ~/.ssh/id_ed25519.pub
```
@kanelv
kanelv / GitConfigCommand.md
Created June 29, 2023 13:37
Git Config Command

Git Config Command

  • ~/.gitconfig file stores git global config
  • .git/config file local configuration will be in your repository's

The command below will show the combination information of the 2 files above

git config --list
git config --list --global
git config --list --local
git config --list --system
@kanelv
kanelv / nvmCommands.js
Created October 7, 2023 08:11 — forked from chranderson/nvmCommands.js
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