From e85d6410af991ec81b847541a48026ae973cde7e Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Thu, 29 Jul 2021 23:52:39 +0200 Subject: add navi cheats --- .../cheats/robertgzr__cheats/balena/misc.cheat | 33 ++++++++++++++++++++++ .../navi/cheats/robertgzr__cheats/docker.cheat | 13 +++++++++ .../cheats/robertgzr__cheats/gentoo/openrc.cheat | 17 +++++++++++ .../navi/cheats/robertgzr__cheats/gentoo/pkg.cheat | 10 +++++++ .../share/navi/cheats/robertgzr__cheats/git.cheat | 9 ++++++ .../share/navi/cheats/robertgzr__cheats/misc.cheat | 33 ++++++++++++++++++++++ .../share/navi/cheats/robertgzr__cheats/qemu.cheat | 28 ++++++++++++++++++ 7 files changed, 143 insertions(+) create mode 100644 .local/share/navi/cheats/robertgzr__cheats/balena/misc.cheat create mode 100644 .local/share/navi/cheats/robertgzr__cheats/docker.cheat create mode 100644 .local/share/navi/cheats/robertgzr__cheats/gentoo/openrc.cheat create mode 100644 .local/share/navi/cheats/robertgzr__cheats/gentoo/pkg.cheat create mode 100644 .local/share/navi/cheats/robertgzr__cheats/git.cheat create mode 100644 .local/share/navi/cheats/robertgzr__cheats/misc.cheat create mode 100644 .local/share/navi/cheats/robertgzr__cheats/qemu.cheat diff --git a/.local/share/navi/cheats/robertgzr__cheats/balena/misc.cheat b/.local/share/navi/cheats/robertgzr__cheats/balena/misc.cheat new file mode 100644 index 0000000..ac0e63d --- /dev/null +++ b/.local/share/navi/cheats/robertgzr__cheats/balena/misc.cheat @@ -0,0 +1,33 @@ + +% balena, mount + +# remount rootfs writable +mount -o remount,rw / + +# remount rootfs readonly +mount -o remount,ro / + +% balena, journal + +# engine + container logs +journalctl -fu balena -a + +# engine logs only +journalctl -fu balena -t balenad + +# supervisor logs +journalctl -fu resin-supervisor + +# kernel logs +journalctl -fk + +# last boot logs (needs persistent-logging) +journalctl -b -1 -r + +% balena, edit systemd + +# edit engine (dev) +vi /etc/systemd/system/balena.service.d/balena.conf + +# edit engine +vi /etc/systemd/system/balena-engine.service diff --git a/.local/share/navi/cheats/robertgzr__cheats/docker.cheat b/.local/share/navi/cheats/robertgzr__cheats/docker.cheat new file mode 100644 index 0000000..c89d141 --- /dev/null +++ b/.local/share/navi/cheats/robertgzr__cheats/docker.cheat @@ -0,0 +1,13 @@ + +% docker + +# List images, sorted by size +docker image ls --format '{{.Size}}\t{{.ID}}\t{{.Repository}}:{{.Tag}}' | sort -h + +# List images, sorted by creation time +docker image ls --format '{{.CreatedAt}}\t{{.ID}}\t{{.Repository}}:{{.Tag}}' | sort + +# List images, include architecture +docker image ls --format '{{.Size}}\t{{.ID}}\t{{.Repository}}:{{.Tag}}' \ + | awk '{"docker inspect "$2"| jq -r .[].Architecture"|getline arch; printf "%s\t%s\t%s\t%s\n", $1, $2, arch, $3}' \ + | sort -h diff --git a/.local/share/navi/cheats/robertgzr__cheats/gentoo/openrc.cheat b/.local/share/navi/cheats/robertgzr__cheats/gentoo/openrc.cheat new file mode 100644 index 0000000..627ff70 --- /dev/null +++ b/.local/share/navi/cheats/robertgzr__cheats/gentoo/openrc.cheat @@ -0,0 +1,17 @@ + +% openrc + +# OpenRC service start +doas rc-service start + +# OpenRC service restart +doas rc-service restart + +# OpenRC service stop +doas rc-service stop + +# OpenRC service status +doas rc-service status + +# OpenRC runlevel change +doas rc diff --git a/.local/share/navi/cheats/robertgzr__cheats/gentoo/pkg.cheat b/.local/share/navi/cheats/robertgzr__cheats/gentoo/pkg.cheat new file mode 100644 index 0000000..6bfe040 --- /dev/null +++ b/.local/share/navi/cheats/robertgzr__cheats/gentoo/pkg.cheat @@ -0,0 +1,10 @@ + +% gentoo, eix + +# list installed pkgs + +eix-installed -a + +# list installed unstable pkgs + +eix-installed -a | grep 9999 diff --git a/.local/share/navi/cheats/robertgzr__cheats/git.cheat b/.local/share/navi/cheats/robertgzr__cheats/git.cheat new file mode 100644 index 0000000..01bccce --- /dev/null +++ b/.local/share/navi/cheats/robertgzr__cheats/git.cheat @@ -0,0 +1,9 @@ +% git + +# checkout branch +git checkout && git status + +$ branch: git branch -a --format='%(refname)' \ + | cut -d' ' -f1 \ + | sed -e 's#^refs/##' -e 's#^remotes/##' -e 's#^heads/##' \ + | sort diff --git a/.local/share/navi/cheats/robertgzr__cheats/misc.cheat b/.local/share/navi/cheats/robertgzr__cheats/misc.cheat new file mode 100644 index 0000000..792bd38 --- /dev/null +++ b/.local/share/navi/cheats/robertgzr__cheats/misc.cheat @@ -0,0 +1,33 @@ + +% rsyncez + +rsyncez '' '' + +$ to: fd --one-file-system -p -t d -d 5 $HOME + + +% cat, EOF + +# cat <<-EOF + +cat <<-EOF > /dev/stdout +hello world +EOF + + +% ubnt, wifi + +# get wifi leases from ubnt router + +ssh ubnt -- ./leases 2>/dev/null + + +% ssh, tunnel + +# tunnel local port to remote machine + +ssh -nNTR : + +# tunnel remote port to local machine + +ssh -nNTL : diff --git a/.local/share/navi/cheats/robertgzr__cheats/qemu.cheat b/.local/share/navi/cheats/robertgzr__cheats/qemu.cheat new file mode 100644 index 0000000..d92b88b --- /dev/null +++ b/.local/share/navi/cheats/robertgzr__cheats/qemu.cheat @@ -0,0 +1,28 @@ + +% qemu, balena + +# boots a balenaOS vm + +qemu-system-x86_64 -name balena0 \ + -netdev "user,id=net0,hostfwd=tcp::22222-:22222" -device e1000,netdev=net0 \ + -bios /usr/share/edk2-ovmf/OVMF_CODE.fd \ + -m 4G -smp 4 \ + -cpu max \ + -machine type=pc,accel=kvm \ + -display none \ + -drive format=vvfat,file=fat:rw:/tmp/qemu,index=1 \ + -drive format=raw,cache=none,if=virtio,index=0,file=balena.img + + +% qemu, ubuntu + +# boots an ubuntu vm + +qemu-system-x86_64 -name ubuntu0 \ + -netdev "user,id=net0,hostfwd=tcp::2222-:22" -device e1000,netdev=net0 \ + -m 4G -smp 4 \ + -cpu max \ + -machine type=pc,accel=kvm \ + -display none \ + -drive format=vvfat,file=fat:rw:/tmp/qemu,index=1 \ + -drive format=qcow2,cache=none,index=0,file=/home/robert/ubuntu.qcow2 -- cgit 1.4.1