Skip to content

Instantly share code, notes, and snippets.

@jamesonwilliams
jamesonwilliams / Dockerfile
Created December 8, 2023 06:48
Magenta 2.14.0 Dockerfile
FROM tensorflow/tensorflow:2.9.1
LABEL description="Magenta 2.14.0 on Tensorflow 2.9.1"
USER root
RUN apt-get update --fix-missing && \
apt-get -y install expect build-essential libasound2-dev libjack-dev git-core ffmpeg vim
ENV MC_REMOTE="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
ENV MC_LOCAL="/tmp/miniconda-install.sh"
ENV CONDA_PATH="/root/miniconda3"
fun ConnectivityManager.observeAdapterConnectivity(): Flow<Boolean> {
return callbackFlow {
val callback = object: ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
trySendBlocking(true)
}
override fun onLost(network: Network) {
trySendBlocking(false)
}
@jamesonwilliams
jamesonwilliams / zxing-cpp-cross-compile-notes.md
Last active October 25, 2022 05:18
Notes on Cross Compiling Zebra Crossing (zxing) CPP Port for ARM64

ARM64 Build Notes for zxing-cpp

Clone glassechidna's zxing-cpp fork.

In CMakeLists.txt, add include(toolchain.cmake) as the first line.

Create a new file, toolchain.cmake:

set(CMAKE_SYSTEM_NAME Linux)
@jamesonwilliams
jamesonwilliams / cleanup-amplify-resources.md
Last active April 23, 2021 00:41
Cleaning up Amplify resources when you're done with it

Cleaning up your AWS account after using Amplify

The Amplify tools create a lot of resources in your AWS account. When you stop using Amplify, you'll want some way to remove it all. This document discusses some various strategies to cleanup your AWS account when offboarding Amplify.

The commands below will call the AWS CLI (and not the Amplify CLI.)

Removing Apps

Fortunately, most of the Amplify stack if managed through CloudFormation under the hood. This means that you can cleanup most of the outputs just by deleting the Amplify "app."

@jamesonwilliams
jamesonwilliams / aws-java-sdk-v2-on-android.md
Last active January 29, 2021 07:06
Using AWS Java SDK V2 from Android

Using the V2 AWS Java SDK from Android

The V2 AWS Java SDK can be used from Android, with a few caveats.

Note: currently, this is limited to API 26 and higher (60% of production devices, as of 06JUL2020.)

Other Note: this document is not production guidance for application builders. These are some of my personal notes after some study and expirementation.

@jamesonwilliams
jamesonwilliams / aws-appsync-with-apollo-2.2.0.md
Last active March 4, 2021 21:58
Using AWS AppSync with Apollo Android 2.2.0

Hitting AWS AppSync from Apollo Android 2.2.0

This document describes howto setup an AppSync endpoint, and talk to it using the Apollo Android 2.2.0 client.

Deploy an AppSync endpoint

In the AWS AppSync console, I created a new endpoint here, by selecting the "Event app" under "Start from a sample project."

The goal of this exercise is to show how a simple functional interface could be used to return a Result value type. The Result value type can contain an error (getError()), or a value (getValue()), depending. A user is able to figure this out by inspecting the Result.Type, and exhausting the potential values of this enum via a switch.

Consuming a multi-values result type:

package com.amplifyframework.ioscbs;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
@jamesonwilliams
jamesonwilliams / simple-datastore-consumer.md
Last active February 28, 2020 22:53
Simple DataStore Consumer App

Sample App Consuming Maven Local

app/src/main/java/com/amplifyframework/dsconsumer/MainActivity.java:

package com.amplifyframework.dsconsumer;

import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
@jamesonwilliams
jamesonwilliams / okhttp-4.3.1-log-spam.md
Last active October 5, 2021 05:25
OkHttp 4.3.1 didn't find class "org.conscrypt.ConscryptHostnameVerifier" on path

OkHttp 4.3.1 emits log spam on Android, even when using it in trivial way.

Example code:

Disposable disposable = Single.fromCallable(() ->
    new OkHttpClient().newCall(new Request.Builder()
        .url("https://raw.githubusercontent.com/square/okhttp/master/README.md")
        .get()
        .build())