Skip to content

Instantly share code, notes, and snippets.

@jmz-b
jmz-b / bin2header.c
Created September 26, 2022 17:04
bin2header
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <sys/stat.h>
void help();
int main(int argc, char **argv) {
uint32_t size;
FILE *f = fopen(argv[1], "r");
@jmz-b
jmz-b / bin2hex.c
Created September 22, 2022 16:27
bin2hex
/** \file
\brief Binary to hex converter
\author Tomasz Ostrowski, ot at epf dot pl
\date October 2006
*/
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
/** Flag set by `--verbose'. */
@jmz-b
jmz-b / 00-setup-sdcard.md
Last active September 22, 2022 10:59
MiyooCFW create image file

clone sdcard repo

jmz@xthUnk:/tmp$ git clone https://github.com/MiyooCFW/sdcard
Cloning into 'sdcard'...
remote: Enumerating objects: 3518, done.
remote: Counting objects: 100% (106/106), done.
remote: Compressing objects: 100% (57/57), done.
@jmz-b
jmz-b / plasma-restart.service
Created December 12, 2019 14:34
restart KDE Plasma on resume from sleep (helps with nvidia video memory corruption problems)
#~/.config/systemd/user/plasma-restart.service
#systemctl --user enable plasma-restart.service
#systemctl --user start plasma-restart.service
#systemctl --user status plasma-restart.service
#systemctl --user stop plasma-restart.service
#sudo loginctl enable-linger <username>
#systemctl --user daemon-reload
#systemctl --user daemon-reexec
[Unit]
Description=Restart plasmashell after resuming
@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
@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 / 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 / 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 / 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 / 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