Skip to content

Instantly share code, notes, and snippets.

@tir38
tir38 / resize
Last active April 21, 2023 18:58
Resize and sort images for two digital picture frames: landscape and portrait
#!/bin/bash
process() {
OUTPUT_DIR="/Users/jason/Desktop/output"
mkdir -p $OUTPUT_DIR
# Image magick doesn't give me the chance to check exif *before* conversion
# so auto-orient into temp and then move to appropriate directory
TEMP="$OUTPUT_DIR/temp.png"
# the \> will prevent upsample
@tir38
tir38 / IgnoreCaseTextMatcher.java
Last active March 25, 2021 06:37
Espresso (Hamcrest) matcher to match TextView text but ignoreCase
package com.example.app;
import android.support.test.espresso.matcher.BoundedMatcher;
import android.view.View;
import android.widget.TextView;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import static com.google.common.base.Preconditions.checkNotNull;
@tir38
tir38 / terminalTimer.sh
Last active August 26, 2020 14:10
in-terminal timer shell script
# script to create timer in terminal
# Jason Atwood
# 2013/6/22
#!/bin/sh
# start up
echo "starting timer script ..."
sleep 1 # seconds
# get input from user
```
2020-06-08T17:20:08.414-0400 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'com.google.protobuf:protobuf-bom:3.10.0' in resolver cache 'Google'
2020-06-08T17:20:08.414-0400 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'com.google.protobuf:protobuf-bom:3.10.0' in resolver cache 'Google'
2020-06-08T17:24:59.936-0400 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'com.google.code.gson:gson:2.8.5' in resolver cache 'Google'
2020-06-08T17:24:59.956-0400 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'com.google.protobuf:protobuf-java:3.10.0' in resolver cache 'Google'
2020-06-08T17:24:59.957-0400 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModule
mport android.media.AudioFormat
import android.media.AudioRecord
import android.media.MediaRecorder
class AudioRecorder {
private val minBufferSize: Int = AudioRecord.getMinBufferSize(SAMPLE_RATE_HZ, AUDIO_RECORDING_FORMAT, AUDIO_ENCODING)
private var audioRecord: AudioRecord? = null
fun startRecording() {
@tir38
tir38 / example.kt
Last active February 6, 2020 16:35
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
/*
What is blockingSubscribe() doing?
1. processing items on computation thread; not blocking main thread
2. processing items on computation thread; blocking main thread until terminal event
3. processing items on main thread; but not actually blocking main thread
4. processing items on main thread and blocking main thread until terminal event
@tir38
tir38 / runSubsetOfInstrumentationTests.sh
Last active February 5, 2020 23:35
Android: Run instrumentation tests on a single class or single method
#!/bin/bash
if [ -z "$1" ]; then
echo "Must specify module (e.g. app)"
exit 1
fi
if [ -z "$2" ]; then
echo "Must specify build type, starting w/ capital letter (e.g. Debug, DebugFree, ReleasePaid)"
exit 1
... user triggered event to start download
499 14371-14371/com.example D/MainActivity: About to nav to on-demand feature
507 14371-14371/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallListenerRegistry : registerListener
524 14371-14371/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallService : startInstall([ondemandfeature],[])
527 14371-14683/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallService : Initiate binding to the service.
540 14371-14371/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.splitinstallservice.SplitInstallService})
541 14371-14683/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallService : linkToDeath
544 22063-22075/? I/Finsky: [163] uxv.a(48): Start install for package: com.example
567 22063-14685/? I/Finsky: [481] dwq.<init>(25): com.example is installed but certifica
@tir38
tir38 / README.md
Last active January 21, 2020 17:54
Find number of days of RescueTime data *above* a threshold. Example: How many days in 2019 did I work more than 15 minutes.

Find number of days of RescueTime data above a threshold.

Example: How many days in 2019 did I work more than 15 minutes?

$ ruby script.rb

Processed data for 281 days;
Found 259 above threshold of 15 minutes of activity.
Task :app:execFlank
AndroidArgs
gcloud:
results-bucket: test-lab-xxx
results-dir: null
record-video: false
timeout: 30m
async: false
results-history-name: null
# Android gcloud