Skip to content

Instantly share code, notes, and snippets.

Working from home

Esa Firman esafirm

Working from home
View GitHub Profile
esafirm /
Last active Sep 23, 2020
Download AAR and jetify it. Unix only!
#!/usr/bin/env bash
# Download Jetifier
curl "" -o $ZIP_NAME
esafirm / drafter.rb
Created May 18, 2020
Drafter Forumula
View drafter.rb
require 'formula'
class Drafter < Formula
homepage ''
head '', :tag => 'v4.1.0'
def install
system "./configure", "--shared"
system "make", "drafter"
bin.install Dir["bin/drafter"]
View MemoryProfilerRule.kt
class MemoryProfilerRule : TestRule {
override fun apply(base: Statement?, description: Description?): Statement {
return MemoryProfilerWatcher().apply(base, description)
private inner class MemoryProfilerWatcher : TestWatcher() {
private val runtime = Runtime.getRuntime()
private var before: Long = 0
esafirm / test_checker.rb
Created Feb 19, 2020
Script to test check
View test_checker.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
@failing_module = []
@no_test_module = []
def fail_number(file_path)
file =
esafirm /
Last active Mar 4, 2019
Android Nougat Above - Install Certificate to System

For more information

Ran into this issue as well while trying to check for privacy implications of an app. The blog post and docs linked above does explain what happened, but not how. Source code references follows based on nougat-mr2.3.

The change was made in commit aosp-mirror/platform_frameworks_base@32d2a10, see frameworks/base:core/java/android/security/net/config/ After that change, only the [system root store](

esafirm / puzzler.ipynb
Last active Jul 19, 2018
ADB Meetup #4 - Kotlin Puzzler
View puzzler.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
esafirm /
Last active May 7, 2018 — forked from chalup/
Get OkHttpClient which ignores all SSL errors.
private static OkHttpClient getUnsafeOkHttpClient() {
try {
// Create a trust manager that does not validate certificate chains
final TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public void checkClientTrusted([] chain, String authType) throws CertificateException {
public class LruStorage extends LinkedHashMap<String, byte[]>
implements KV.Storage {
private final ExecutorService mService = Executors.newSingleThreadExecutor();
private final KV.Storage mStorage;
private final int mMaxSize;
public LruStorage(KV.Storage storage, int size) {
super(size/2, 0.75f, true);
mStorage = storage;
View Gson Proguard
##---------------Begin: proguard configuration common for all Android apps ----------
-optimizationpasses 5
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
esafirm / DenomSuggestion.kt
Last active Jul 30, 2017
Given some amount, return possible values that constructed by particular denomination
View DenomSuggestion.kt
val denom = arrayOf(1, 2, 5, 10, 20, 50, 100)
val amount = arrayOf(5, 11, 53, 122, 155, 157, 210, 200)
fun main(args: Array<String>) = amount.forEach { currentAmount ->
val suggestions = mutableListOf<Int>()
denom.forEach {
if (it >= currentAmount) {
suggestions += it