Collection of kotlin script and kscript examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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[*]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
04cbb896454312d3e20a05df1591658bcb57cde54131a09e7102d622023b7e47b14995d088d6e8d7a542908af7ce09584673b8cbbda4220b4bbfd7623b949bd5a7;xrigau |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
println("Called with args:") | |
args.forEach { | |
println("- $it") | |
} |
OlderNewer