Skip to content

Instantly share code, notes, and snippets.


Thomas Terance Terance98

View GitHub Profile
View zsh_config.txt
# 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"
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
View MongoDB Trasactions
//start a session
const session = await <Model>.startSession();
//start a transaction
//pass session as option in every operations
let save = await{ session:session });
// commit the changes if everything was successful
View Puppeteer_Screenshot
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) => {
View mongoUserManagement.txt
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
Terance98 /
Created May 20, 2020 — forked from anhldbk/
TLS client & server in NodeJS

1. Overview

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 server is a simple echo one. Clients connect to it, get the same thing back if they send anything to the server.
  • The server is a TLS-based server.
  • Clients somehow get the server's public key and use it to work securely with the server

2. Preparation

Terance98 / Javascript_Promises.js
Created Mar 5, 2020
This gist contains a sample snippet of javascript code that explains pretty well the use of Javascript promises, how to unpack them with then() etc.. This also uses prototype chaining with multiple then() clauses.
View Javascript_Promises.js
//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);
View mac changer
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)
Terance98 /
Created Sep 5, 2019 — forked from bradtraversy/
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

You can’t perform that action at this time.