IT notes

jamf

softwareupdate -l to see if there are macOS updates available. softwareupdate -ia to install all updates. sudo jamf policy to run all outstanding policies and updates for the apps, sudo jamf recon to update the inventory on the server.

stty

If reset can’t clean your terminal, give a try to: stty sane

tmux

Set window title: <c-b>, Get pannel number: <c-b>q Show clock: <c-b>t Move pane to a new window: <c-b>! Join panes: <c-b>: join-pane -s 0 -t 3 move pane 1 to window 3 <c-b>: join-pane -t :1 move current pane to window 1 Create a new session: <c-b>: new -s <name> List sessions: <c-b>s <c-b>w expanded Move pane to a another session: <c-b>m mark the pane <c-b>w go to the destination window/session <c-b>: join-pane or go to the pane you want to move, check the session name and windows you would like to move and try:

Block SSH on MacOS

To block incoming ssh connections, edit the /etc/pf.conf and add the following line at the bottom: block in log quick proto tcp from any to any port 22 You can use vim or use something like this: sudo sh -c "echo 'block in log quick proto tcp from any to any port 22' >> /etc/pf.conf" Then reload the pfrules: sudo pfctl -Fa -f /etc/pf.conf For this to work the firewall must be enabled.

Processlist

Run show processlist every second: mysqladmin -uroot -p -i 1 processlist -i 1 stands for interval one second

OSI TLS

Beside the OSI/model, there is also the TCP/IP Model: Link Layer Internet (IP) Layer Transport Layer Application OSI Model The OSI model has a bit more granularity. Physical Layer Data Link Layer Network Layer (IP) Transport Layer (TCP) Session Layer (TLS) Presentation Layer Application Layer (HTTP) TLS establishes an encrypted session. In the OSI model this is where TLS operates.

IRC

Change password password in irc: /msg nickserv set password <password>

combine two images

Combine in a single file 2 images: convert +append a.png b.png out.png -append will append vertically instead of horizontally (+)

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 Pronunciation A Alfa Al fah B Bravo Brah Voh C Charlie Char Lee D Delta Dell Tah E Echo Eck Oh F Fox Foks Trot G Golf Golf H Hotel Hoh Tell I India In Dee Ah J Juliett Jew Lee Ett K Kilo Key Loh L Lima Lee Mah M Mike Mike N November No Vem Ber O Oscar Oss Car P Papa Pah Pah Q Quebec Keh Beck R Romeo Row Me Oh S Sierra See Air Ah T Tango Tang Go U Uniform You Nee Form V Victor Vik Tah W Whiskey Wiss Key X X-ray Ecks Ray Y Yankee Yang Key Z Zulu Zoo Loo 0 Zero Zee Row 1 One Wun 2 Two Too 3 Three Tree 4 Four Fow Er 5 Five Fife 6 Six Six 7 Seven Sev En 8 Eight Ait 9 Nine Nine Er

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:

Enable Paste

To enable paste in chrome, open the console and enter: var allowPaste = function(e){ e.stopImmediatePropagation(); return true; }; document.addEventListener('paste', allowPaste, true);

kld_list

To load kernel modules after local disks are mounted add this to /etc/rc.conf: kld_list="fuse" in this case module fuse will be loaded