Skip to content

Instantly share code, notes, and snippets.

@mikepenz
mikepenz / get-app-md5-signature-fingerprint.c
Created October 7, 2020 08:50
Retrieve the app signature fingerprint as md5 hash
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#include <jni.h>
const char *getSignature(JNIEnv *env, jobject context) {
// Build.VERSION.SDK_INT
jclass versionClass = (*env)->FindClass(env, "android/os/Build$VERSION");
jfieldID sdkIntFieldID = (*env)->GetStaticFieldID(env, versionClass, "SDK_INT", "I");
int sdkInt = (*env)->GetStaticIntField(env, versionClass, sdkIntFieldID);
@mikepenz
mikepenz / android-adb-usb-speed.sh
Created November 12, 2019 11:28
Quick helper script to detect the speed of the USB connection of connected Android devices
#!/bin/bash
# some helper vars
# https://unix.stackexchange.com/a/10065/138249
if test -t 1; then
ncolors=$(tput colors)
if test -n "$ncolors" && test $ncolors -ge 8; then
bold=$(tput bold)
normal=$(tput sgr0)
success=$(tput setaf 2)
@mikepenz
mikepenz / some-root.gradle
Last active July 27, 2017 12:20
android-gradle-logger
gradle.taskGraph.afterTask { task, state ->
if (task. state.failure) {
println "$task.name FAILED PRINTING LOGS"
getDevicesAndReadLogs(500)
}
}
ext.getDevicesAndReadLogs = { count = 2500 ->
try {
def outstream = new ByteArrayOutputStream()
@mikepenz
mikepenz / ContainerItem.java
Created December 14, 2016 22:04
quick and dirty ContainerItem for the FastAdapter
package com.fyusion.fyuse.item;
import android.content.Context;
import android.support.annotation.IdRes;
import android.support.annotation.LayoutRes;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@mikepenz
mikepenz / README.md
Last active October 13, 2016 19:25
Syncs a defined branch from a forked GIT project with the external root directory

gitSync.sh

Why?

  • syncing with the main repo if we already have changes is a pain

Configure

  • define remoteOrigin (the external remote name of the root repo)
  • define ownOrigin (the remote name of our fork)
  • define syncBranch (the branch which we will get in sync)
@mikepenz
mikepenz / debianessentials.md
Last active February 2, 2017 10:08
Install & Configure Debian Essentials

#ABOUT

#INSTALLATION Run following commands:

apt-get install curl -y
curl https://gist.githubusercontent.com/mikepenz/bea8ef149c4c04917f04/raw/7fded476f46b156e3bc3cb8b0696fa27267c6b78/debianessentials.sh | sh;
@mikepenz
mikepenz / CachingUtil.java
Created July 29, 2015 06:58
A small util class to store any data (single or list) and load it again
public class CachingUtil {
public <C> List<C> loadParsed(Class<C> type, String locale) {
String name = getName(type);
Path path = Paths.get(Config.getEntry("paths.cache") + "/" + name + "/", name + "." + locale + ".json");
if (Files.exists(path) && !Files.isDirectory(path)) {
try {
return new ObjectMapper()
.readValue(path.toFile(), new ObjectMapper().getTypeFactory().constructCollectionType(List.class, type));
@mikepenz
mikepenz / bootstrap-table-sample-api.php
Last active November 25, 2022 10:24
Sample API for the bootstrap-table
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
require "JSONDB.php";
if(isset($_GET["limit"])) {
$limit = $_GET["limit"];
} else {
Verifying that +mikepenz is my Bitcoin username. You can send me #bitcoin here: https://onename.io/mikepenz
@mikepenz
mikepenz / multitail.md
Last active February 28, 2021 15:42
Install & Configure multitail, Configure multitail, Setup alias

#ABOUT

#INSTALLATION Run following commands:

curl https://gist.githubusercontent.com/mikepenz/a8a4a52f67a391895a4c/raw/0e142a381ddce88e7489d0753388bd9778cb246d/multitail.sh | sh;
source ~/.bashrc

This will start the script multitail.sh and call source ~/.bashrc afterwards