This sheet goes along with this SSH YouTube tutorial
$ ssh brad@192.168.1.29
$ mkdir test
$ cd test
$ ssh brad@192.168.1.29
$ mkdir test
$ cd test
sudo apt-get install macchanger | |
ip addr //( -- to list all the newtork drivers that are available for mac change) | |
//From that select wlo1 | |
sudo macchanger -r wlo1 //Assigns a new mac id to the wifi | |
//To set up a custom mac id | |
# macchanger -m b2:aa:0e:56:ed:f7 wlo1 | |
Current MAC: 32:cf:cb:6c:63:cd (unknown) | |
Faked MAC: b2:aa:0e:56:ed:f7 (unknown) |
//Here the first Promise resolves and then returns Done to the function inside first then(), | |
//but this function doesn't take any parameters and hence the value "Done" is never used. | |
// But the value is still being returned from the Promise to the function where it is unpacked. | |
// The fetchData promise is returned again by the function inside the first then() that unpacked the promise initially. | |
// This promise then gets resolved with console.log as the input parameter function, which takes one parameter as input and prints it. | |
// So it should take total 3 seconds to print Done!. This promise makes use of the returned Done value by printing it to the console with console.log() | |
const fetchData = () => { | |
const promise = new Promise((resolve, reject) => { | |
setTimeout(() => resolve('Done'), 1500); |
This is an example of using module tls
in NodeJS to create a client securely connecting to a TLS server.
It is a modified version from documentation about TLS, in which:
/** | |
The following is a cheat sheet about user management in MongoDB. | |
**/ | |
Start mongod with the following command | |
//Before creating the users | |
> mongod | |
//After creating the users | |
> mongod --auth |
const { v4: uuidv4 } = require('uuid'); | |
const path = require('path'); | |
const rootPath = process.cwd(); | |
const fs = require('fs'); | |
const mkdirp = require('mkdirp') | |
const puppeteer = require('puppeteer'); | |
const EjsToHtml = require('./EjsToHtml'); | |
const convert = async (templateAttributes) => { |
//start a session | |
const session = await <Model>.startSession(); | |
//start a transaction | |
session.startTransaction(); | |
//pass session as option in every operations | |
let save = await new.save({ session:session }); | |
// commit the changes if everything was successful |
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
# Initialization code that may require console input (password prompts, [y/n] | |
# confirmations, etc.) must go above this block; everything else may go below. | |
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
fi | |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH |