Skip to content

Instantly share code, notes, and snippets.


Sebastiano Poggi rock3r

View GitHub Profile
rock3r /
Last active Aug 29, 2015
How to update an homescreen widget (the right way)
package net.frakbot.gists.widgethelper;
* Copyright 2014 Sebastiano Poggi
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2014 BioWink GmbH. All rights reserved.
* Proper Java code style formatting
* Copyright (c) 2014 Sebastiano Poggi. Do whatever you want with this code.
rock3r /
Created Mar 20, 2016
Grabs all DNG files from the connected Android device's camera roll
import argparse, os, subprocess
# Grab the script directory to use as default
current_directory = os.path.dirname(os.path.abspath(__file__))
def parse_cli_arguments():
parser = argparse.ArgumentParser(description = 'Grabs all DNG files from the connected Android device\'s camera roll.')
rock3r /
Last active Oct 19, 2016
Rip fonts from Google Fonts for self-hosting, EZ
#coding: utf-8
import argparse, os, tinycss, requests
def parse_cli_arguments():
parser = argparse.ArgumentParser(description='Downlads all available variants of a font from Google Fonts')
parser.add_argument('fontname', type=str, help='The name of the font. E.g., "Roboto", "Product Sans"')
return parser.parse_args()
rock3r / avd_flush_anim.xml
Last active Jan 20, 2017
Standardised Japanese Toilet 🚽 Big Flush 🌀 pictogram - as Animated Vector Drawable
View avd_flush_anim.xml
<!-- All copyright to the original owners. The AVD version is free to use; please give attribution if you redistribute/modify -->
<aapt:attr name="android:drawable">
rock3r /
Last active Apr 28, 2017
Move/rename *-{m|h|xh|xxh|xxxh}dpi.png" assets into proper folder structure, ready for copypasta
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.
# ----------------------------------------------------------------------------
buckets=( mdpi hdpi xhdpi xxhdpi xxxhdpi )
rock3r / AndroidOSVersionCheckerTest.kt
Created Oct 5, 2017
Testable Kotlin Android OS version checker, with tests
View AndroidOSVersionCheckerTest.kt
package me.seebrock3r.utils
import android.os.Build.VERSION_CODES.JELLY_BEAN_MR1
import android.os.Build.VERSION_CODES.JELLY_BEAN_MR2
import android.os.Build.VERSION_CODES.KITKAT
import android.os.Build.VERSION_CODES.LOLLIPOP
import android.os.Build.VERSION_CODES.LOLLIPOP_MR1
import android.os.Build.VERSION_CODES.M
import android.os.Build.VERSION_CODES.N
import org.assertj.core.api.Assertions.assertThat
rock3r /
Created Jun 4, 2015
Root script for Asus Zenfone 2 for *NIX
#! /bin/bash
# How to use: save this in the folder where you extract the contents of this zip:
# Then chmod a+x it, and run it. Have your phone attached to the USB port with USB debugging enabled before starting.
# Setup
rock3r / RxFilterIsInstance.kt
Last active Jun 22, 2018
RxKotlin's ofType() name is not very easy to remember, given Kotlin has filterIsInstance() for the same. This helps alleviate the pain.
View RxFilterIsInstance.kt
package me.seebrock3r.extensions.reactivex
import io.reactivex.Flowable
import io.reactivex.Observable
import io.reactivex.rxkotlin.ofType
message = "This is just a shorthand for RxKotlin's ofType()",
replaceWith = ReplaceWith("ofType<R>()", "io.reactivex.rxkotlin.ofType")
rock3r / CacheableProperty.kt
Created Jan 8, 2019
A cacheable property in Kotlin — basically, a variant of Lazy that can be invalidated and will be reloaded on the next access
View CacheableProperty.kt
package me.seebrock3r.util
import me.seebrock3r.util.CacheableProperty.CachedValue.*
import kotlin.reflect.*
import kotlin.reflect.jvm.*
fun <T> cache(producer: () -> T): CacheableProperty<T> = CacheableProperty(producer)
class CacheableProperty<out T>(val producer: () -> T) : ReadOnlyProperty<Any, T> {
You can’t perform that action at this time.