Skip to content

Instantly share code, notes, and snippets.

View AlvaroBrey's full-sized avatar

Álvaro Brey AlvaroBrey

View GitHub Profile
@AlvaroBrey
AlvaroBrey / memusg
Last active June 4, 2018 12:42 — forked from netj/memusg
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
@AlvaroBrey
AlvaroBrey / fzcat
Created November 21, 2017 09:49
Wrapper for pidcat(https://github.com/JakeWharton/pidcat) that uses fzf (https://github.com/junegunn/fzf) to search for the app to log
#!/usr/bin/env bash
PACKAGE=$(adb shell pm list packages -3 | cut -d ':' -f 2 | sort \
| fzf --reverse \
--preview-window right:40% \
--preview "echo {} | xargs -I % curl -s -o- \"https://play.google.com/store/apps/details?id=%\" | grep -oh '<div class=\"id-app-title\" tabindex=\"0\">[^<]*</div>' | sed -r -n 's/^<.*>(.*)<.*>$/\1/p'" \
)
if [[ ! -z "$PACKAGE" ]]; then
pidcat "$PACKAGE"
@AlvaroBrey
AlvaroBrey / authorize_adb.sh
Last active March 1, 2019 19:21
Authorize ADB for a non-booting device
#!/usr/bin/env bash
adb shell 'echo "persist.service.adb.enable=1" >> default.prop'
adb shell 'echo "persist.service.debuggable=1" >> default.prop'
adb shell 'echo "persist.sys.usb.config=mtp,adb" >> default.prop'
adb shell 'echo "persist.service.adb.enable=1" >> /system/build.prop'
adb shell 'echo "persist.service.debuggable=1" >> /system/build.prop'
adb shell 'echo "persist.sys.usb.config=mtp,adb" >> /system/build.prop'
adb push ~/.android/adbkey.pub /data/misc/adb/adb_keys
Deprecated: use https://github.com/ontherunvaro/adb-uninstall
@AlvaroBrey
AlvaroBrey / guake-tab-rename.bash
Last active April 13, 2018 16:09
Guake tab auto renaming for Bash. Source in your .bashrc.
#!/usr/bin/env bash
function simpleDirName(){
# Echoes only the last folder of the current path, or ~ if we are at $HOME
if [ "$(pwd)" == "$HOME" ]
then
DN="~"
else
DN="${PWD##*/}";
fi