Skip to content

Instantly share code, notes, and snippets.

@whitequark
whitequark / update-package.sh
Created May 12, 2012 17:14
Pure shell update package installer for Android
#!/bin/bash
set -e
UPDATE_PKG=$1
if [ "$UPDATE_PKG" == "" ]; then
echo "Usage: $0 <update package>"
echo
exit 1
@quentin
quentin / deploy_soot.sh
Last active July 25, 2017 17:05
Deploy Soot from Github, along with Jasmin and Heros. By default the 'develop' branch of Jasmin, Heros and Soot are cloned into the current directory. The respectives ant.settings are created and the jars are built. When the script detects that a repository has already been cloned, it will pull the last version of the 'develop' branch instead.
#!/usr/bin/env sh
#
# author: Quentin Sabah
#
deploy_dir=$PWD
jasmin_repo=http://github.com/Sable/jasmin.git
jasmin_branch=develop
jasmin_dir=$deploy_dir/jasmin-github
@woodworker
woodworker / jekyll.ics
Created September 27, 2013 08:39
a jekyll template for icalendar file
---
layout: none
---
BEGIN:VCALENDAR
VERSION:2.0
PRODID:http://www.example.com/
METHOD:PUBLISH
{% for post in site.posts limit:10 %}BEGIN:VEVENT
UID:{{ post.date | date: "%Y%m%d" }}@example.com
ORGANIZER;CN="Organizer Name":MAILTO:organizer@example.org
@devisnik
devisnik / build.gradle
Last active September 5, 2017 16:05
Shrink Guava using Gradle
apply plugin: 'base'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.sf.proguard:proguard-gradle:4.11'
}
}
@dlew
dlew / themes-debug.xml
Last active March 1, 2024 15:46
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
@daj
daj / BaseStatelessBlackBoxEspressoTest.java
Last active December 20, 2018 09:44 — 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
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 {
@rock3r
rock3r / avd_flush_anim.xml
Last active January 20, 2017 13:20
Standardised Japanese Toilet 🚽 Big Flush 🌀 pictogram - as Animated Vector Drawable
<!-- All copyright to the original owners. The AVD version is free to use; please give attribution if you redistribute/modify -->
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="693dp"
android:height="693dp"
android:viewportWidth="693"
@edenman
edenman / LazyMainThread.kt
Created February 24, 2017 01:56
Kotlin lazy delegate that enforces single-initialization by ensuring callers are on the main thread
package my.package.foo
/**
* This method is just a modification of the kotlin stdlib lazy initializer, which by default uses a
* synchronized block to ensure no double-running of the initializer. Synchronized blocks are not
* particularly fast on Android so we try to avoid them when possible: in all of our cases, the
* lazy property is being accessed on the main thread, so it's easier to just check that we're on
* the main thread as a way to ensure no double-running of the initializer.
*/
fun <T> lazyMainThread(initializer: () -> T): Lazy<T> = LazyMainThreadImpl(initializer)
fun main(args: Array<String>) {
if (args[0] == "start") {
launch(CommonPool) {
println("Launching")
SerialisationHelper.test()
println("Finished")
}
}