Skip to content

Instantly share code, notes, and snippets.

@jankowskib
jankowskib / Allwinner boot img command line sdk 4.5
Created April 1, 2014 08:37
A way to create boot img on new AW SDK (exdroid4.4_r1.2-a31-v4.5)
mkbootimg --kernel kernel.img --ramdisk ramdisk.cpio.gz --base 0x40000000 --cmdline='console=ttyS0,115200 rw init=/init loglevel=4 vmalloc=384M ion_reserve=128M' -o boot.img --pagesize 2048 --kernel_offset 0x8000 --ramdisk_offset 0x1000000 --tags_offset 0x100
LOCAL_PATH := $(my-dir)
include $(CLEAR_VARS)
$(foreach t,$(call find-subdir-files, *.apk), \
$(eval include $(CLEAR_VARS)) \
$(eval LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)) \
$(eval LOCAL_SRC_FILES := $(t)) \
$(eval LOCAL_MODULE := $(basename $(notdir $(t)))) \
$(eval LOCAL_MODULE_CLASS := APPS) \
$(eval LOCAL_CERTIFICATE := PRESIGNED) \
@jankowskib
jankowskib / gist:173fd118177e6e25b1fd
Created September 15, 2014 10:34
Convert A31/A31s gpio number -> ID
#define PA_NR 28
#define PB_NR 8
#define PC_NR 28
#define PD_NR 28
#define PE_NR 17
#define PF_NR 6
#define PG_NR 19
#define PH_NR 31
#define PL_NR 9
#define PM_NR 8
@jankowskib
jankowskib / gist:99f751364a33bc443341
Created February 21, 2015 13:24
regex match with filter
^(?=.*?\bCONFIG_ARCH_SUN8IW.P.\b)((?!SUN8IW1P1).)*$
will find lines that match CONFIG_ARCH_SUN8IWXPX except CONFIG_ARCH_SUN8IW1P1
@jankowskib
jankowskib / gist:f886f087d9cb1f578284
Created July 9, 2015 19:56
decode Diablo II's CubeMain.bin
#!/usr/bin/env ruby
# dump_cubemain.rb
#
# Copyright 2015 Bartosz Jankowski
#
# 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
@jankowskib
jankowskib / Fix-Stagefright-exploits-mtk-4.4.2.patch
Last active August 29, 2015 14:26
Stagefright explioit patch for Mediateks (4.4.2)
From feb0e93c1ec4e980a01293ec418db25a25aded1f Mon Sep 17 00:00:00 2001
From: Bartosz J <thug1337@gmail.com>
Date: Thu, 6 Aug 2015 16:01:57 +0200
Subject: [PATCH] Fix Stagefright exploits
Signed-off-by: Bartosz J <thug1337@gmail.com>
diff --git a/media/libstagefright/ESDS.cpp b/media/libstagefright/ESDS.cpp
index 103105d..b008df1 100644
mkbootimg --kernel boot.img-kernel.img --ramdisk boot_unsecure.cpio.gz --kernel_offset 0x40080000 --base 0x0 --cmdline 'bootopt=64S3,32N2,64N2' --board '20150828' --ramdisk_offset 0x44000000 --second_offset 0x40f00000 --tags_offset 0x4e000000 -o new_boot.img
@jankowskib
jankowskib / QuickXorHash.java
Created November 14, 2016 19:08
MS OneDrive QuickXorHash quick port...
package llt.test.main;
import java.math.BigInteger;
import java.security.MessageDigest;
public class QuickXorHash extends MessageDigest implements Cloneable
{
private final static int BitsInLastCell = 32;
private final static byte Shift = 11;
@jankowskib
jankowskib / RxRetryWhen.java
Created November 22, 2016 20:15
retry when receive specific error
package com.example;
import java.io.IOException;
import java.lang.invoke.WrongMethodTypeException;
import java.util.concurrent.TimeUnit;
import rx.Emitter;
import rx.Observable;
import rx.schedulers.Schedulers;
@jankowskib
jankowskib / rfw.sh
Last active July 21, 2017 12:13
Read Focaltech touchpanel eeprom
#!/system/bin/sh
# Check if needed tools are in path
which i2cget i2cset i2cdetect 1&>/dev/null || (echo "No i2ctools available!" && exit 0)
which seq 1&>/dev/null || (echo "Need seq tool to work!" && exit 0)
function into_fw_mode()
{
DELAY_AA=0.01
DELAY_55=0.03