Skip to content

Instantly share code, notes, and snippets.

@jmz-b
jmz-b / lsgit.sh
Created May 19, 2017 01:48
Recursivly list all git(1) repositories incl. their sizes under the
#!/bin/sh
# Recursivly list all git(1) repositories incl. their sizes under the
# given directory in parallel
find "${1}" -type d -name .git -print \
| sed -e s,/.git$,, \
| xargs -r \
du -sh \
| sort -k2
@jmz-b
jmz-b / Makefile
Created December 4, 2018 09:37
make help
.PHONY: help
help: ## Show help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@jmz-b
jmz-b / debian-virt-install.sh
Last active June 21, 2019 16:13
virt-install wrapper to perform a preseeded and unattended debian installation
#!/bin/sh
LOCATION=http://ftp.uk.debian.org/debian/dists/stretch/main/installer-amd64/
OS_VARIANT=debian9
while [ $# -ne 0 ]; do
case "$1" in
--name | -n)
NAME="$2"
shift
@jmz-b
jmz-b / qemu-android.sh
Created June 21, 2019 16:10
spin up android in qemu + kvm
#!/bin/sh
qemu-system-x86_64 -enable-kvm \
-vga std \
-m 2048 \
-smp 2 \
-cpu host \
-soundhw ac97 \
-net nic,model=e1000 -net user \
-cdrom Disks/android-x86_64-7.1-r1.iso
@jmz-b
jmz-b / plasma-with-i3wm.desktop
Last active December 12, 2019 12:53
custom xsession to run KDE plasma with i3wm instead of kwin (goes in /usr/share/xsessions/)
[Desktop Entry]
Type=XSession
Exec=env KDEWM=/usr/bin/i3 /usr/bin/startkde
TryExec=/usr/bin/startkde
DesktopNames=KDE
Name=Plasma (with i3wm)
Comment=Plasma with i3wm
@jmz-b
jmz-b / tissot-notes.md
Last active October 4, 2019 08:44
Lineage on the Mi A1 notes

Handle non-slotted partition in A/B OTA package

Issue

https://github.com/omnirom/android_bootable_recovery/issues/253

Notes

  • Tissot maintainer here. If you weren't already aware, we ship bootloader/modem firmware with the ROM in official lineage for some devices (including tissot) to prevent any issues caused by outdated firmware. The problem with tissot is the fact that unlike most of the usual A/B devices, it has more weird partitioning where most partitions are not slotted (except of boot, system, modem). By default, update_engine doesn't expect you to have any non-slotted partition in A/B OTA package. That's why installation fails on all TWRP packages except mine. It doesn't happen in the system because lineage's update_engine already handles these cases - https://github.com/LineageOS/android_system_update_engine/commit/27ddc7269807ebbe31688482dd5eade56d4cccdf I apply this patch in my TWRP builds as well and that's the only difference from the official TWRP source.

@jmz-b
jmz-b / toggle-plasma-panel.sh
Created June 29, 2019 19:50
qdbus commands to toggle hide/show KDE plasma panel
!#/bin/sh
qdbus org.kde.plasmashell /PlasmaShell evaluateScript "p = panelById(panelIds[0]); p.height = 32 - p.height;"
@jmz-b
jmz-b / i3lock-blur.sh
Created July 1, 2019 01:01
run i3lock with blurred screenshot as background
#!/bin/sh
scrot /tmp/screenshot.png
convert /tmp/screenshot.png -blur 0x5 /tmp/screenshotblur.png
i3lock -i /tmp/screenshotblur.png
@jmz-b
jmz-b / trim_whitespace.vim
Created July 1, 2019 01:09
vim function to trim trailing whitespace
function! TrimWhitespace()
let l:save_cursor = getpos('.')
%s/\s\+$//e
call setpos('.', l:save_cursor)
endfunction
@jmz-b
jmz-b / plasma-with-O2ES.desktop
Last active December 12, 2019 13:50
custom xsession to run KDE plasma with OpenGL ES 2 compositing backend (goes in /usr/share/xsessions/)
[Desktop Entry]
Type=XSession
Exec=env KWIN_COMPOSE=O2ES /usr/bin/startkde
TryExec=/usr/bin/startkde
DesktopNames=KDE
Name=Plasma (KWIN_COMPOSE=O2ES)
Comment=Plasma with OpenGL ES 2 compositing backend