Skip to content

Instantly share code, notes, and snippets.

View BelkaDev's full-sized avatar
🌊
I may be slow to respond.

Belka BelkaDev

🌊
I may be slow to respond.
View GitHub Profile
@vrld
vrld / refresh-firefox
Created July 9, 2019 08:02
Refresh firefox window with xdotool
#!/bin/sh
ACTIVE_WINDOW=$(xdotool getactivewindow)
if [ -z "${1}" ]; then
xdotool search --classname Navigator windowactivate --sync key --clearmodifiers "ctrl+F5"
else
xdotool search --classname Navigator search --name $1 windowactivate --sync key --clearmodifiers "ctrl+F5"
fi
@tniessen
tniessen / service.md
Created October 1, 2016 11:46
Using the "service" tool with ADB and why to avoid it

As it turns out, it is not trivial to control the audio volume of an Android device using ADB. At the time of writing, the only way appears to be using the service tool. Actually, the service command allows to "connect" to a number of services (104 on Android 6.0.1) and invoke functions. Not knowing much about this tool, I managed to completely mute all sounds and speakers of my Nexus 5, and I was stuck without any sound for quite some time. I did not find a way to unmute the sound from within the system UI, so I got to dive a little deeper into this.

If you know which service you want to use, you then need to find its interface declaration. The command

service list

gives you a list of all services with the associated interfaces, if applicable:

...

26 backup: [android.app.backup.IBackupManager]

@un33k
un33k / sed cheatsheet
Created August 22, 2011 13:28
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'