Skip to content

Instantly share code, notes, and snippets.

View damien5314's full-sized avatar
๐Ÿ™ˆ

Damien Diehl damien5314

๐Ÿ™ˆ
View GitHub Profile
@damien5314
damien5314 / screenshot.bat
Last active August 29, 2015 14:23
Pulls screenshot from connected adb device on Windows
@echo off
setlocal
call :GetUnixTime UNIX_TIME
adb shell screencap -p /sdcard/%UNIX_TIME%.png
adb pull /sdcard/%UNIX_TIME%.png
adb shell rm -r /sdcard/%UNIX_TIME%.png
goto :EOF
:GetUnixTime
setlocal enableextensions
@damien5314
damien5314 / screenshot.sh
Created June 29, 2015 17:44
Pulls screenshot from connected adb device on Unix
UNIX_TIME=$(date -u +"%s")
adb shell screencap -p /sdcard/$UNIX_TIME.png
adb pull /sdcard/$UNIX_TIME.png
adb shell rm -r /sdcard/$UNIX_TIME.png
#!/bin/bash
wget -r -np -R index.html {url} --no-check-certificate {user} --password {password}
@damien5314
damien5314 / ResolveErrorActivity.java
Created July 7, 2016 22:19
Handles errors from GoogleApiClient
package com.sample;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
package com
import io.reactivex.Observable
import org.junit.Assert.assertEquals
import org.junit.Test
class RxJavaTests {
@Test
fun foo1() { // fails, doOnDispose isn't called (Observable isn't disposed?)
import com.quizlet.android.logging.ConsoleLogger
import com.quizlet.android.logging.ConsoleLoggingTree
import io.reactivex.Completable
import io.reactivex.Scheduler
import io.reactivex.schedulers.Schedulers
import io.reactivex.schedulers.TestScheduler
import org.junit.After
import org.junit.Before
import org.junit.Test
import timber.log.Timber
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JSON Pretty Print</title>
</head>
<body>
<textarea id="input" rows="40" cols="64" placeholder="Paste JSON here"></textarea>
<textarea id="output" rows="40" cols="64" readonly="readonly" placeholder="Result"></textarea>
@damien5314
damien5314 / pull-data.sh
Created July 12, 2017 06:41
Creates an app backup using the standard Android mechanism, then pulls backed up data to a connected machine.
#! /bin/bash
path=build/data
mkdir -p $path
adb backup -f $path/appdata.ab -noapk com.example.app
( cd $path && dd if=appdata.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf - )
@damien5314
damien5314 / Apple.kt
Created July 16, 2017 00:00
Testing Kotlin's @JvmSynthetic annotation
package foo
class Apple
fun Apple.slice() { }
@JvmSynthetic
fun Apple.peel() { }
@damien5314
damien5314 / JacksonTests.kt
Created September 18, 2017 19:23
Jackson performance testing
package com.quizlet.perf
import com.fasterxml.jackson.databind.ObjectMapper
import com.quizlet.android.logging.ConsoleLogger
import com.quizlet.android.logging.ConsoleLoggingTree
import org.junit.After
import org.junit.Before
import org.junit.Test
import timber.log.Timber