Skip to content

Instantly share code, notes, and snippets.

View JosefLitos's full-sized avatar

Josef Litoš JosefLitos

  • Czech Republic
  • 06:27 (UTC +02:00)
View GitHub Profile
@JosefLitos
JosefLitos / libtin.c
Last active July 20, 2023 13:02
simple parser for all terminal input with keycombo string parser + display, supports all modifiers + multiclick (no-movement based)
// compile: gcc -O2 terminput_parser.c -o input
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
// #define PRINT_POS // enables mouse position printing
// #define DEBUG // print the numeric representation of the key + raw received string
typedef u_int32_t u32;
// Tin = terminal input
@JosefLitos
JosefLitos / terminput.c
Last active July 21, 2023 16:02
terminal input tester, including mouse support - find out your key code
// compile: gcc -O2 terminput.c -o terminput
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
system("/bin/stty raw -echo");
int optCnt = argc > 4 ? argc - 1 : 4;
char** opts = malloc(optCnt * sizeof(char*));
opts[0] = ">1u"; // kitty keyboard protocol
@JosefLitos
JosefLitos / sam
Last active August 31, 2021 09:42
Simple bash script using adb and fzf for uninstalling apps from Android phones, disabling them, enabling and installing the system default apps back.
#!/usr/bin/env bash
# sam = System APK Manager
if [ -z "$(adb devices | sed 's/^List.*$//')" ]; then
printf "No devices are connected, please attach a usb cable or use 'adb connect'.\n"
exit 0
fi
# Display a menu for disabling applications as long as there is a selection
disable() {