Skip to content

Instantly share code, notes, and snippets.

View vrendina's full-sized avatar

Victor Rendina vrendina

View GitHub Profile
#!/bin/sh
# Detect supported devices
# ddccontrol -p
LEFT_MONITOR=dev:/dev/i2c-8
RIGHT_MONITOR=dev:/dev/i2c-6
# Read all possible controls for the monitor
#ddccontrol -d $LEFT_MONITOR
@vrendina
vrendina / WebRTC Docker
Created June 3, 2020 17:05
Dockerfile for building WebRTC
# 1. Copy the Dockerfile inside a new directory
# 2. Create the Docker image
# docker build -t [image-name] .
# 3. Launch the Docker image providing a directory to pull down the source code
# docker run -it --rm -v [path to source]:/src [image-name]
# 4. Follow instructions on http://webrtc.github.io/webrtc-org/native-code/android/
#----------------- Begin Dockerfile Below -----------------
FROM ubuntu:14.04
@vrendina
vrendina / adb-screenshot
Last active September 13, 2018 12:35
Automatically create and resize Android screenshots from multiple devices on OSX
#!/bin/sh
#
# Take a screenshot from a connected device, resize it, and automatically save it
# to the OUTPUT_DIR. You should edit the output directory and desired maximal
# dimension of the resulting image. Each image will be output with [devicename]-[timestamp].
# If you have multiple devices connected this will take a screenshot from each device.
#
# This script is designed to work with OSX.
#
@vrendina
vrendina / EndlessScrollListener.kt
Last active February 20, 2018 18:46
RecyclerView Endless Scroll Listener
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.StaggeredGridLayoutManager
class EndlessScrollListener(private val layoutManager: RecyclerView.LayoutManager,
private val callback: EndlessScrollCallback) :
RecyclerView.OnScrollListener() {
companion object {
@vrendina
vrendina / adb-screen
Created June 24, 2017 22:29
Turn the screen on or off on all connected Android devices
#!/bin/sh
# Returns the power state of the screen 1 = on, 0 = off
getDisplayState() {
state=$(adb -s $1 shell dumpsys power | grep mScreenOn= | grep -oE '(true|false)')
# If we didn't get anything it might be a pre-lollipop device
if [ "$state" = "" ]; then
state=$(adb -s $1 shell dumpsys power | grep 'Display Power' | grep -oE '(ON|OFF)')
fi
@vrendina
vrendina / verify.py
Created April 22, 2017 19:00
Validate CSV list of addresses
#!/usr/local/bin/python3
#
# verify.py <input.csv> [<output.csv>]
#
# Validate list of addresses and write output to CSV file
#
# Format of input CSV file should be:
# Name,Address 1,Address 2,City,State,Zip
#
# Format of output CSV file is (unmodified address is written first):
@vrendina
vrendina / adb+
Created March 18, 2017 19:13
Execute adb command on all connected devices
#!/bin/sh
# Replace with Android SDK home or path to adb command
ANDROID_SDK_HOME="/opt/android-sdk"
ANDROID_ADB_COMMAND=$ANDROID_SDK_HOME"/platform-tools/adb"
if [ $# -eq 0 ]; then
$ANDROID_ADB_COMMAND
exit 1;
fi