This file contains 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
// Help in developing package locally | |
// https://medium.com/@sam-king/an-alternative-to-npm-link-cf9ab9408f56 | |
// https://betterprogramming.pub/how-to-create-and-publish-react-typescript-npm-package-with-demo-and-automated-build-80c40ec28aca | |
npm i yalc -g | |
yalc publish | |
yalc add example-package@0.0.1 | |
yalc remove example-package@0.0.1 |
This file contains 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
<html> | |
<head> | |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" | |
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> | |
<style> | |
thead { | |
position: sticky; | |
position: -webkit-sticky; | |
top: 0; |
This file contains 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
screen.debug(undefined, Number.POSITIVE_INFINITY); |
This file contains 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
const crypto = require("crypto") | |
// The `generateKeyPairSync` method accepts two arguments: | |
// 1. The type ok keys we want, which in this case is "rsa" | |
// 2. An object with the properties of the key | |
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", { | |
// The standard secure default length for RSA keys is 2048 bits | |
modulusLength: 2048, | |
}) |
This file contains 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
#!/bin/bash | |
# | |
# Public-Key Encryption and Decryption | |
# * http://www.openssl.org/ | |
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/ | |
# | |
# Mac OS X 10.6.4 | |
# OpenSSL 0.9.8l 5 Nov 2009 | |
# Generate keys |
This file contains 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
// Generate private.pem | |
openssl genrsa -out private.pem 512 | |
// Generate public.pem | |
openssl rsa -in private.pem -pubout > public.pem | |
// Encrypt | |
openssl rsautl -in text.txt -out secret.enc -pubin -inkey public.pem -encrypt | |
// Decrypt |
This file contains 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
// This gist is for my YouTube video which I tried to explain Window Sliding Technique. | |
// You can watch it from here: https://youtu.be/guDU5HnLqAs | |
// Given a sorted array A (sorted in ascending order), having N integers, | |
// find if there exists any pair of elements (A[i], A[j]) such that | |
// their sum is equal to X. | |
// | |
// Input: A = [2,3,4,5,6,7,8,9], k= 10 | |
// Output: true | |
// NOTE: We slightly changed the question and the output in the video. We're returning pair indexes as an array. |
This file contains 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
mongorestore --uri <link> -d <new-db-name> dump/ |
This file contains 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
//package.json | |
{ | |
... | |
"devDependencies": { | |
... | |
"purgecss": "^3.0.0" | |
}, | |
"scripts": { | |
"start": "react-scripts start", | |
"build": "react-scripts build && npm run purge-css", |
This file contains 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
cp /etc/mongod.conf /etc/mongod2.conf | |
cd /lib/systemd/system | |
cp mongod.service mongod2.service | |
edit ta service config and add /etc/mongod2.conf | |
sudo chown -R mongodb:mongodb /root/database/replica_database* | |
sudo systemctl start mongod2.service | |
sudo systemctl status mongod2.service |