Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
139 lines (95 sloc) 3.37 KB

Snippets

old snippets page


VirtualBox attach external USB

VBoxManage list usbhost
VBoxManage controlvm machine-name usbattach xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

mount luks ext4 ubuntu

# mount
sudo cryptsetup luksOpen /dev/sd?? my_encrypted_volume
sudo mkdir /media/my_device
sudo mount /dev/mapper/my_encrypted_volume /media/my_device

# unmount (lock container)
sudo umount /media/my_device
sudo cryptsetup luksClose my_encrypted_volume

Useful NPM commands


Display mime file type information file -Ib foo.txt


git checkout --orphan Create a new orphan branch. The first commit made on this new branch will have no parents and it will be the root of a new history totally disconnected from all the other branches and commits.


set terminal name

echo -en "\e]2;string\a" #-- Set window title to string

write .img to SD card from Mac OS X, more info

sudo dd if=path_of_your_image.img of=/dev/rdiskn bs=1m

/dev/rdisk? is much faster


CTRL+z suspends the most recent foreground process (the last process to interact with the tty)

fg continues a stopped job by running it in the foreground

bg resume a suspended program without bringing it to the foreground

nohup <command> &; disown background process ignoring NOHUP and SIGHUP

Jobs - Move Running Process to Background & Nohup


XDG Base Directory Specification

$XDG_CACHE_HOME, ~/.cache

Mac OS X, ~/Library/Caches


View JSON file in chrome

  1. Open JSON file in a Chrome tab
  2. Open Developer Tools
  3. Execute in console
JSON.parse(document.body.getElementsByTagName('pre').item(0).textContent)

Bind mount

mount --bind /some/where /else/where

Scan for every TCP and UDP open port:

sudo nmap -n -PN -sT -sU -p- remote_host

How To Use Nmap to Scan for Open Ports on your VPS


Vainilla JS

// VanillaJS v1.0
// Released into the Public Domain
// Your code goes here:

ps with parent/child process tree ps auxf


upgrade/install node from .tar.gz

sudo tar -C /usr/local --strip-components 1 -xzf node-latest.tar.gz

download and upgrade/install node

Example to download last version

curl https://nodejs.org/download/release/vA.B.C/node-vA.B.C-linux-x64.tar.gz | sudo tar -C /usr/local --strip-components 1 -xz 

Old versions

curl https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz \
  | sudo tar -C /usr/local --strip-components 1 -xJ