Record infrequently used but potential useful commands
Contents
- iperf3 - Network speed test
- qemu - convert images
- base64 - encode & decode
- smartctl - check macos ssd health
- git-crypt - transparent file encryption in git
iperf3
Test network speed between devices. First, open server-side iperf/iperf3 service, then, test it by client-side iperf/iperf3 application. Under windows system, the application is iperf3.exe.
Open server-side iperf3 service
iperf3 -s -p 5201
Open client-side iperf3 service
iperf3 -c [ip address] -p 5201
Qemu convert images
qemu-img convert -f [format] -O [output format] vm-114-disk-0.qcow2 vm-114-disk-0.raw
Example:
# convert qcow2 to raw image
qemu-img convert -f qcow2 -O raw vm-114-disk-0.qcow2 vm-114-disk-0.raw
base64 encode and decode
encode:
echo 'YourText' | base64
create pseudorandom number and encrypted by base64:
head -c32 /dev/urandom | base64
decode:
echo 'WW91clRleHQK' | base64 --decode
macos check ssd health
smartctl -a [device id]
zfs send entire pool
zfs snap pool_old@migrate
zfs send -Rv pool_old@migrate | zfs receive -F -d pool_new
zfs send dataset
zfs snap pool/dataset@migrate
zfs send -R pool/dataset@migrate | zfs receive -F pool/dataset_new
git-crypt
git-crypt initialisation
Initialise to automatically create .git-crypt folder
git-crypt init
Add public gpg key to project
git-crypt add-gpg-user --trusted [your_email_or_key_id_or_fringerprint]
example:
git-crypt add-gpg-user --trusted F278A3CCB6C173BD3660D173564D16856D20F3FC
Select files by adding .gitattributes file to automatic encrypt
# Encrypt
## Encrypt all files under vault
vault/** filter=git-crypt diff=git-crypt
## Make sure that .gitattributes is never encrypted.
.gitattributes !filter !diff
## Make sure that .gitignore is never encrypted.
.gitignore !filter !diff
common git-crypt usage
- Only show the files required to encrypt
git-crypt status -e
- Remedies if git commit before encrypting
git-crypt status -f