IT notes

LS_COLORS

To remove the blinking of symbolic links when doing ls in Linux: LS_COLORS="ln=35" export LS_COLORS That will set the ln=35 symbolic links to color purple. Params for LS_COLORS: di Directory fi File ln Symbolic Link pi Fifo file so Socket file bd Block (buffered) special file cd Character (unbuffered) special file or Symbolic Link pointing to a non-existent file (orphan) mi Non-existent file pointed to by a symbolic link (visible when you type ls -l) ex File which is executable (ie.

htpasswd

To create an htpasswd file (for htaccess “authentication”) using openssl: $ printf "foo:$(openssl passwd -apr1 PASSWORD)\n" >> .htpasswd If need to use crypt: $ printf "foo:$(openssl passwd -crypt PASSWORD)\n" >> .htpasswd

Git SSH

To create a git repository and access to it via ssh: $ ssh your.host $ mkdir my-new-repo $ cd my-new-repo $ git --bare init To access your repo (clone it): $ git clone ssh://[email protected]:2222/~user/my-new-repo

self CA

Create a self signed CA (Certificate Authority) Generate private key: $ openssl genrsa -des3 -out CA.key 4096 To create a private key without password: $ openssl genrsa -out CA.key 4096 Create a root certificate: $ openssl req -x509 -new -nodes -key CA.key -sha256 -out CA.pem -subj "/CN=example.com" -days 365 In one single command create the private key and the certificate: $ openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout CA.

Bosh cheatsheet

BOSH is a project that unifies release engineering, deployment, and lifecycle management of small and large-scale cloud software. Check your environment: $ bosh env Set your deployment environment: $ export BOSH_DEPLOYMENT=foo if have multiple deployments in same dir better to use -d <deployment-name> since many commands are bound to this variable. To recreate your environment (virtualbox), remove the line that start with current_manifest from the file state.

ZFS swap

To add more swap on a ZFS system: # zfs create -V 64G -o org.freebsd:swap=on -o checksum=off -o compression=off -o dedup=off -o sync=disabled -o primarycache=none tank/swap2 To add it: # swapon /dev/zvol/tank/swap2 To resize you could first remove it: # swapoff /dev/zvol/tank/swap Then destroy it: # zfs destroy tank/swap

No history

To avoid having command in history just prefix them with an empty space: $⎵ uname If using zsh: $ echo "" > ~/.zsh_history & exec $SHELL -l

macOs sparseimage

To create an install disk using an spare disk: $ hdiutil create -size 6GB -fs JHFS+ -volname "macOS_installmedia" -type SPARSE ~/Desktop/macOS_installmedia Mount it (or double-click in Finder to mount): $ hdiutil mount ~/Desktop/macOS_installmedia.sparseimage Use the createinstallmedia: $ sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/macOS_installmedia --applicationpath /Applications/Install\ macOS\ High\ Sierra.app

NATO phonetic alphabet

Symbol Code word A Alfa B Bravo C Charlie D Delta E Echo F Fox G Golf H Hotel I India J Juliett K Kilo L Lima M Mike N November O Oscar P Papa Q Quebec R Romeo S Sierra T Tango U Uniform V Victor W Whiskey X X-ray Y Yankee Z Zulu 0 Zero 1 One 2 Two 3 Three 4 Four 5 Five 6 Six 7 Seven 8 Eight 9 Nine

ZFS send receive

To send a zfs dataset being no root, on the origin server: # zfs allow -g wheel send,snapshot,hold tank/foo On the receiver, create the dataset and allow users in group wheel: # zfs create -o mountpoint=/foo tank/foo # zfs allow -g wheel compression,mountpoint,create,mount,receive tank/foo # umount /foo On the origin server create the snapshot to send: # zfs snapshot -r tank/foo On the origin server send the dataset by using: