Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Jarvis daj

View GitHub Profile
@daj
daj / BaseStatelessBlackBoxEspressoTest.java
Last active Dec 20, 2018 — forked from xrigau/AndroidManifest.xml
The set of changes required to disable animations any time Espresso tests run. These instructions will only work on emulators and on rooted devices. This is based on the instructions in: https://code.google.com/p/android-test-kit/wiki/DisablingAnimations
View BaseStatelessBlackBoxEspressoTest.java
public abstract class BaseStatelessBlackBoxEspressoTest<T extends Activity> extends ActivityInstrumentationTestCase2<T> {
private SystemAnimations mSystemAnimations;
public BaseStatelessBlackBoxEspressoTest(Class clazz) {
super(clazz);
}
@Override
protected void setUp() throws Exception {
@daj
daj / JobManagerIdlingResource.java
Last active Aug 29, 2015
Example IdlingResource for use with the JobManager in https://github.com/yigit/android-priority-jobqueue
View JobManagerIdlingResource.java
/**
* Used by Espresso tests to tell when it should wait because some background work needs to be done.
*
* Based on advice from the priority-job-manager maintainer:
* https://github.com/path/android-priority-jobqueue/issues/49#issuecomment-45583487
*/
public class JobManagerIdlingResource implements IdlingResource {
private static final String TAG = "JobManagerIdlingResource";
@daj
daj / tensorflow_hello_world.sh
Last active Aug 1, 2018
Check Python can import TensorFlow dependencies
View tensorflow_hello_world.sh
# This script assumes you are running from Terminal / command line
python
import tensorflow as tf
hello = tf.constant('Hello from TensorFlow. Everything seems to be working!')
sess = tf.Session()
print(sess.run(hello))
exit()
@daj
daj / WORKSPACE
Last active Feb 21, 2017
WORKSPACE configuration for building TensorFlow Android demo in a Docker container
View WORKSPACE
# My example WORKSPACE configuration, based on following the instructions in the TensorFlow README:
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/README.md#edit-workspace
# The lines below have already been uncommented
android_sdk_repository(
name = "androidsdk",
api_level = 23,
build_tools_version = "25.0.2",
path = "/android",
)
@daj
daj / ops_to_register.h
Created Oct 7, 2017
Example ops_to_register.h file for the TensorFlow model in the AndroidTensorFlowMNISTExample (https://github.com/daj/AndroidTensorFlowMNISTExample/commit/6e1b15ff6d3182be0e665c0456f356ffc2f62514)
View ops_to_register.h
// This file was autogenerated by print_selective_registration_header.py
#ifndef OPS_TO_REGISTER
#define OPS_TO_REGISTER
namespace {
constexpr const char* skip(const char* x) {
return (*x) ? (*x == ' ' ? skip(x + 1) : x) : x;
}
constexpr bool isequal(const char* x, const char* y) {
@daj
daj / build_all_architectures.sh
Last active Apr 25, 2018
Build all architectures of libtensorflow_inference.so required for use on Android, using selective registration https://medium.com/@daj/how-to-shrink-the-tensorflow-android-inference-library-cb698facf758
View build_all_architectures.sh
# This script assumes your /tensorflow/core/framework/ops_to_register.h file is already in place
mkdir /tf_files/armeabi-v7a
bazel build --local_resources 4096,4.0,1.0 -j 1 -c opt --copt="-DSELECTIVE_REGISTRATION" --copt="-DSUPPORT_SELECTIVE_REGISTRATION" //tensorflow/contrib/android:libtensorflow_inference.so --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --crosstool_top=//external:android/crosstool --verbose_failures --cpu=armeabi-v7a
cp bazel-bin/tensorflow/contrib/android/libtensorflow_inference.so /tf_files/armeabi-v7a
mkdir /tf_files/arm64-v8a
bazel build --local_resources 4096,4.0,1.0 -j 1 -c opt --copt="-DSELECTIVE_REGISTRATION" --copt="-DSUPPORT_SELECTIVE_REGISTRATION" //tensorflow/contrib/android:libtensorflow_inference.so --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --crosstool_top=//external:android/crosstool --verbose_failures --cpu=arm64-v8a
cp bazel-bin/tensorflow/contrib/android/libtensorflow_inference.so /tf_files/arm64-v8a
@daj
daj / rundeepraceronmac.md
Last active Sep 25, 2021 — forked from joezen777/rundeepraceronmac.md
How to run DeepRacer locally on Mac
View rundeepraceronmac.md

I took all my instructions from this page.  https://github.com/crr0004/deepracer

Here are the revised instructions for OSX (bold is console command)

  1. Change to a folder in terminal that is not case-sensitive. ~/ should be fine
  2. git clone --recurse-submodules https://github.com/crr0004/deepracer.git
  3. brew install minio/stable/minio -- you may need to install brew first -- /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  4. install vncviewer from here https://www.realvnc.com/download/file/viewer.files/VNC-Viewer-6.19.325-MacOSX-x86_64.dmg