Skip to content

Instantly share code, notes, and snippets.

View mibli's full-sized avatar
🎲
Nothing – What are You – SURPRISED?

Miłosz B. mibli

🎲
Nothing – What are You – SURPRISED?
  • Poland
View GitHub Profile
@mibli
mibli / main.cpp
Created March 8, 2024 00:29
Optimized and readable byte sequence compare
// So the aim of this exercise is to make a bit easier on the eyes (and cpu)
// comparisons of array elements, than comparing byte, by byte.
// Imagine that we have protocol buffer represented by array of bytes:
//
// uint8_t buffer[] = { 42, 84, 54, 32, 06, 12, 14, 05 };
//
// Now we have some logic that has to check header of the buffer for key values
// Normally we would use structores, that we would assign values to... (let's skip that for now)
// Otherwise we would compare each byte, eg.
//
@mibli
mibli / flashing-magisk-a320fl.md
Last active March 6, 2024 12:06
Flashing Magisk on Samsung A3 2017 on Linux

Rooting Samsung A3 2017 (A320FL, a3y17lt) on Linux, the cautious way

First off, I'm not responsible for any damage to Your devices, I'm sharing my experience and it should not be taken as a replacement for manual and common sense. You're following the guide at Your own risk!!

The purpose of this document is to help understand me the process of flashing. The issue with a lot of guides is that they describe only the necessary steps, and provide pre-patched archives and images, pre-downloaded binaries, which is not a very assuring or secure way of approaching things. I will try to describe where to get original binaries, how to patch the original image.

Don't treat the document as an oracle, go check and verify things. Cautious is the way!

Backup your data.

@mibli
mibli / generate_save_copies.FCMacro
Created February 23, 2022 03:08
Generate Copies of Parametrized FreeCAD projects with Spreadsheet
# vim: ft=python
"""
Macro that changes values to presets in columns, and saves modified copies.
This macro is mainly useful for Assembly Workbench (A2Plus)
The sheet should have the following format:
| A | B | C | D | ... | m |
-------------------------------------------------
1 |Width | 200| 300| 200| | |
-------------------------------------------------
@mibli
mibli / git-cleanup.sh
Created June 25, 2021 13:14
git cleanup
#!/bin/bash
die() {
echo "$@"
exit 1
}
confirm() {
ans=
while true; do
@mibli
mibli / proton-run.sh
Created June 8, 2021 23:28
proton-run
#!/bin/bash
die() {
echo "$@"
exit 1
}
library_paths=( /mdata/games/ /data/games /sdata/games )
case "$1" in
-l|list)
@mibli
mibli / xow-notify.service
Created May 6, 2021 10:36
XBox Controller notifications on connect/disconnect
[Unit]
Description=Mopidy
[Service]
ExecStart=sh -c 'journalctl -ft xow | sed -nue "s/.*\s-\s//" -e "/Controller .* \(dis\)\?connected/p;/Battery level:/p" | xargs -I{} notify-send "{}"'
Restart=on-failure
RestartPreventExitStatus=1
SuccessExitStatus=2
RestartForceExitStatus=3 4
@mibli
mibli / log.txt
Created December 19, 2020 16:06
Cyberpunk 2077 linux crash log
Starting app 1091500
Loaded Config for Local Override Path for App ID 1091500, Controller 0: /home/mblizniak/.local/share/Steam//controller_base/empty.vdf
>>> Adding process 256902 for game ID 1091500
GameAction [AppID 1091500, ActionID 3] : LaunchApp changed task to WaitingGameWindow with ""
Fossilize INFO: ExternalReplayer::Impl::kill(): Failed to kill: errno 3.
GameAction [AppID 1091500, ActionID 3] : LaunchApp changed task to Completed with ""
ERROR: ld.so: object '/home/mblizniak/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/mblizniak/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/mblizniak/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/mblizniak/.local/share/Steam/ubuntu12
@mibli
mibli / lfrc.part
Last active May 23, 2017 08:06
Temporary lf bookmarks implementation
cmd mark-new ${{
# querying mark
read -e -p "Mark as: " -n 1 markchar
markfile="${XDG_CONFIG_HOME:-$HOME/.config}/lf/marks"
# removing old mark if present
sed -i "/^$markchar .*/d" "$markfile"
# adding new mark
{ cat "$markfile" 2>/dev/null;
echo "$markchar" "$(pwd)"; } |
sort > "$markfile.tmp"
@mibli
mibli / nvidiabl-pkgbuild.patch
Created January 14, 2017 12:23
Patch for PKGBUILD for AUR package nvidiabl from 2016-12-09 10:32
--- nvidiabl.unp/nvidiabl/PKGBUILD 2016-12-09 11:32:46.000000000 +0100
+++ nvidiabl/PKGBUILD 2017-01-14 13:18:04.928817417 +0100
@@ -27,16 +27,16 @@
}
build() {
- cd $pkgnmame-master
+ cd $pkgname-master
make
}
@mibli
mibli / mpvctl
Created January 7, 2017 14:14
MPV persistant ipc volume control. (WIP)
#!/bin/bash
# -------------------
# MPV CONTROL RELATED
function mpv_get_config()
{
cat ${mpv_config_path} | grep $1 | cut -f2 -d'=' ||
echo "No $1 property in config"
}
function mpv_set_config()