Skip to content

Instantly share code, notes, and snippets.

View danybony's full-sized avatar

Daniele Bonaldo danybony

View GitHub Profile
#!/bin/bash
# Based on https://gist.github.com/johnjohndoe/5398030
checkForAndroidDevice() {
NOT_PRESENT="List of devices attached"
ADB_FOUND=`adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then
echo "Android device seems to be missing."
@danybony
danybony / multigource.sh
Last active August 29, 2015 14:07
Multi-project Gource
#!/bin/bash
# Every repository is contained in a subdirectory of the current one
repos=$(ls -d */)
FINAL_LOG_FILE=result_log.txt
rm $FINAL_LOG_FILE
touch $FINAL_LOG_FILE
for repo in ${repos[*]}
@danybony
danybony / startbuild.sh
Created November 29, 2014 18:25
Setup and start AOSP build with ccache and build target passed as parameter
#!/bin/bash
function show_help {
echo "Usage:"
echo "./startbuild.sh -t <build_target> [-c -h]"
echo
echo "Parameters:"
echo "-t: specify the build target as per lunch (required)"
echo "-c: perform a clean build, calling make clean"
echo "-h: show this"
package com.ryanharter.mediaroute.widgets;
import android.content.Context;
import android.support.v7.app.MediaRouteActionProvider;
import android.support.v7.app.MediaRouteButton;
/**
* A MediaRouteActionProvider that allows the use of a ThemeableMediaRouteButton.
*/
public class ThemeableMediaRouteActionProvider extends MediaRouteActionProvider {
@danybony
danybony / RainbowLightsActivity.java
Created December 28, 2016 23:47
Android Things sample activity showing how to read and toggle some LEDs in response
public class RainbowLightsActivity extends Activity {
private static final String TAG = RainbowLightsActivity.class.getSimpleName();
private List<Gpio> buttons = new ArrayList<>();
private Map<Color, Gpio> leds = new HashMap<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@danybony
danybony / install_all.sh
Created August 21, 2017 10:24
Install all APKs from a dir
total=$(ls -1 apps/*.apk | wc -l)
counter=0
for app in apps/*.apk; do
counter=$((counter+1))
echo $counter/$total - Installing $app
adb install -r $app
echo
done
04cbb896454312d3e20a05df1591658bcb57cde54131a09e7102d622023b7e47b14995d088d6e8d7a542908af7ce09584673b8cbbda4220b4bbfd7623b949bd5a7;xrigau
@danybony
danybony / screenshot_android.sh
Last active June 30, 2021 12:05
Android screenshot to current dir
#!/bin/bash
while getopts y: flag
do
case "${flag}" in
y) size=${OPTARG};;
esac
done
DEVICES=`adb devices | grep -v devices | grep device | cut -f 1`
@danybony
danybony / arguments.kts
Last active December 20, 2019 11:37
Kotlin script and kscript
println("Called with args:")
args.forEach {
println("- $it")
}
@danybony
danybony / _KotlinScript.md
Last active December 23, 2019 09:21
Kotlin script and kscript

Collection of kotlin script and kscript examples