infra Generate a random password from the command line LC_ALL=C tr -dc A-Za-z0-9 < /dev/urandom | head -c32; echo '' Or LC_ALL=C tr -dc A-HJ-NP-Za-fhjkmnpr-z2-8 < /dev/urandom | head -c32; echo '' Or openssl rand -base64 32 Where 32 is the length of the generated password. I recommend the 2 formers because the results of the last
Tip Quickly unhide file/folders in Windows Open window terminal via window + R, type cmd, then press Enter. In the command prompt, run attrib -s -h -r /s /d To show all items (file, folder) in a directory, including hidden items dir /a
bash Open current directory from terminal in Linux There are multiple ways to achieve this purpose nautilus . & xdg-open . My preferred way is the latter. I usually make xdg-open's alias named open to be able to use the same command in Mac OS. To make the alias, add following entry to .bashrc (or .zshrc if you uses zsh) alias
infra List processes with their listening ports with netstat netstat -nlpt To include information of tasks which are executed with sudo privilege sudo netstat -nlpt
infra SSH to ubuntu machine in safe mode This post introduces how to ssh to the Ubuntu machine in safe mode. * Boot into safe mode (recovery mode) * Enable networking * Log in to a root shell * Enable ssh server via sudo systemctl start sshd By initial, Ubuntu disables SSH login when booting up for security purposes. You need to
programming Promise based semaphore pattern in Javascript Let's start with a singleton pattern when you want to instantiate at most one instance of a class, or lazily initiate a value. let instance const getInstance = () => instance === undefined ? instance = initiateInstance()//this is a heavy task and should be done at most once in the whole life of the application