Skip to content

Instantly share code, notes, and snippets.

View Kardelio's full-sized avatar
🎬
Action!

Benjamin Kadel Kardelio

🎬
Action!
View GitHub Profile
@Kardelio
Kardelio / unzlib.py
Created April 3, 2024 11:39
Decompress contents of Git object file (zlib)
#!/usr/bin/env python3
import zlib
import sys
if len(sys.argv) > 1:
print(f"File in was: {sys.argv[1]}")
file=sys.argv[1]
else:
print("File in was BLANK, please pass a zlibbed file path...")
exit(1)
@Kardelio
Kardelio / edit-pref-file.sh
Last active July 11, 2023 14:58
Edit an apps shared preference entire file from a bash script (using run-as & sed)
#!/usr/bin/env bash
# IMPORTANT:
# make sure to edit the variables below to make the script work for you and your app
package="my.package.com"
filename="sharedprefs.xml"
line=$(adb exec-out run-as "$package" cat "/data/data/$package/shared_prefs/$filename")
echo "$line" > /tmp/editpreffile.txt
@Kardelio
Kardelio / android-tap-if-exists.sh
Created April 7, 2023 11:01
Bash script to trigger python uiautomator2 to get specific UI element on android screen and click it if it exists
#!/usr/bin/env bash
#NOTE: requires python3 and the pip package uiautomator2
#These functions can be copied over to your own bash script
#and can be used by simply triggering tapIfExists...
function tapIfExists(){
coords=$(getCoords "${1}")
if [[ "$coords" != "-" ]]; then
$fullAdb shell input tap "$coords"
fi
@Kardelio
Kardelio / gist:c6a01e1e927a75ef7f3af44ef79e7e35
Created September 12, 2019 08:46
Interactive Git Branch changer using fzf
git branch | fzf | sed 's/\* //g' | xargs -I '{}' git checkout {}
@Kardelio
Kardelio / vidpull
Created August 30, 2019 08:43
Script to copy (pull) the newest recorded video from a Android device to your computer (vidpull)
#!/usr/bin/env bash
echo "Pulling newest video"
file=$(adb shell ls sdcard/DCIM/Camera | grep mp4 | tail -n1 | sed 's/^M//g')
adb pull "sdcard/DCIM/Camera/$file"