Skip to content

Instantly share code, notes, and snippets.

@DarkPark
DarkPark / xiaomi mi5.md
Last active September 14, 2018 11:01
Firmware update instruction
  1. Get Developer Full ROM pack.
  2. Extract and remove all files from root (boot.img, system.patch.dat, and so on).
  3. Remove these files from META-INF/com/google/android/updater-script to get something like this:
getprop("ro.product.device") == "gemini" || abort("E3004: This package is for \"gemini\" devices; this is a \"" + getprop("ro.product.device") + "\".");
ui_print("Target: Xiaomi/gemini/gemini:8.0.0/OPR1.170623.032/8.5.10:user/release-keys");
ui_print("Patch made by DarkPark");
show_progress(0.200000, 10);
ui_print("Patching firmware images from MIUI 8.5.10 dev ...");
// users
// local main user
{
id: 'oyHYtAXj7yYElZhHs20XHuvrxKiUHccKR4STWk/KXVgT3oTfoEnwZUmqYbIISMFjPOgbZ1KG6o+1PbJA2DHFaA',
active: true,
//aesKeyId: '...',
keyId: '...',
time: 1520081249999,
key: {
time: 1520081249999,
@DarkPark
DarkPark / simple.js
Last active March 27, 2018 08:11
IndexedDB tests
//indexedDB.deleteDatabase('test');
var request = window.indexedDB.open('test', 1),
amount = 1000,
ids = [],
db;
function getRandomInt ( min, max ) {
return Math.floor(Math.random() * (max - min)) + min;
}
mkfifo dptmp
while true; do
read line < dptmp
if [[ $line ]]; then
echo "processing $line"
fi
done
@DarkPark
DarkPark / move.sh
Last active April 8, 2017 20:44
How to move the /root directory to home partition
# it'b better to avoid symlinks
# use mount --bind
# as root
cp -a /root /home/
echo "" >> /etc/fstab
echo "/home/root /root none defaults,bind 0 0" >> /etc/fstab
# do it now
cd / ; mv /root /root.old; mkdir /root; chmod go-rwx /root; mount -a
@DarkPark
DarkPark / benchmark.js
Created October 16, 2016 11:04
manual conversion vs TextEncoder
var tries = 100000,
encoder = new TextEncoder('utf-8'),
example = 'I♥☢𝄢. I\'m a ☢ ☃ that plays 𝄢 guitar and spea̧͈͖ks Ar̽̾̈́͒͑ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜!',
time, index;
function utf8ToBinaryString ( str ) {
var escstr = encodeURIComponent(str);
// replaces any uri escape sequence, such as %0A,
// with binary escape, such as 0x0A
var binstr = escstr.replace(/%([0-9A-F]{2})/g, function ( match, p1 ) {
@DarkPark
DarkPark / SassMeister-input.scss
Created February 17, 2016 14:11
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
%component {
// The width and height (also including min-width, max-width, min-height and max-height properties) of an element
// are calculated as the width/height of the content plus the padding and border.
box-sizing: border-box;
}
@DarkPark
DarkPark / table.map.js
Last active August 29, 2015 14:12
Table navigation map generator with tests.
'use strict';
var data = {
'table 1x1 with no merge': {
raw: [
[1]
],
check: [[1]]
},
@DarkPark
DarkPark / dart.sh
Created July 21, 2014 20:35
install dart on ubuntu
sudo add-apt-repository ppa:hachre/dart
sudo apt-get update
sudo apt-get install darteditor dartvm dartsdk dartium