Skip to content

Instantly share code, notes, and snippets.

View rock3r's full-sized avatar

Sebastiano Poggi rock3r

View GitHub Profile
/**
* ArcUtils.java
* 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
rock3r / WidgetHelper.java
Last active August 29, 2015 13:57
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
*
* http://www.apache.org/licenses/LICENSE-2.0
@rock3r
rock3r / ColorUtils.java
Last active February 25, 2020 09:06
ColorUtils: utilities for manipulating colours
package net.frakbot.util.color;
import android.graphics.Color;
/**
* The MIT License (MIT)
* <p/>
* Copyright (c) 2014 Sebastiano Poggi
* <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy
@rock3r
rock3r / prepareassets.sh
Last active April 28, 2017 23:43
Move/rename *-{m|h|xh|xxh|xxxh}dpi.png" assets into proper folder structure, ready for copypasta
#!/bin/bash
# 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.
# ----------------------------------------------------------------------------
prefix=${1-"drawable"}
buckets=( mdpi hdpi xhdpi xxhdpi xxxhdpi )
@rock3r
rock3r / boot-into-cwm.sh
Created June 4, 2015 13:42
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:
# http://click.xda-developers.com/api/click?format=go&jsonp=vglnk_14334252799608&key=f0a7f91912ae2b52e0700f73990eb321&libId=iai8ebh401000n4o000DAb9a6aa9o&loc=http%3A%2F%2Fforum.xda-developers.com%2Fzenfone2%2Fgeneral%2Fasus-zenfone-2-flashing-recovery-mode-t3096596&v=1&out=http%3A%2F%2Fwww.mediafire.com%2Fdownload%2Fv6m7n9j0gqins9b%2FCWM_Zenfone_2_Intel.zip&ref=http%3A%2F%2Fforum.xda-developers.com%2Fzenfone2%2Fgeneral&title=Asus%20Zenfone%202%20%7C%20Resources%20all%20in%20one%20thread%20%7C%20Asus%20ZenFone%202%20%7C%20XDA%20Forums&txt=%3Cb%3EDownload%20the%20Asus%20Zenfone%20temporary%20CWM%20package%3C%2Fb%3E
# Then chmod a+x it, and run it. Have your phone attached to the USB port with USB debugging enabled before starting.
# Setup
WORKINGDIR=$(pwd)
LAUNCHER="$WORKINGDIR/FB_RecoveryLauncher/recovery.launcher"
RECOVERY="$WORKINGDIR/FB_RecoveryLauncher/recovery.zip"
@rock3r
rock3r / giffify.py
Last active January 14, 2022 09:00
Giffify - easily create optimised GIFs from a video
#!/usr/bin/python
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi and Daniele Conti 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 us a beer in return.
import argparse, sys, subprocess, tempfile
@rock3r
rock3r / grabdng.py
Created March 20, 2016 13:05
Grabs all DNG files from the connected Android device's camera roll
#!/usr/bin/python
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
rock3r / README.md
Last active January 27, 2024 14:51
A simple bash script to enable demo mode on a Marshmallow+ device via ADB (based on http://bit.ly/295BHLx)

Usage

$ demo on|off [hhmm]

Enable or disable the demo mode on a connected Android device or emulator. You can also pass in a custom value for the system clock in the HHMM format (only used when you use the on command).

⚠️ This script only works on *nix systems and has only been tested on macOS with Bash (but should be portable).

@rock3r
rock3r / gfonts.py
Last active October 19, 2016 13:20
Rip fonts from Google Fonts for self-hosting, EZ
#!/usr/bin/python
#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
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"