- Make testing new releases easy for me. No tedious reinstalling of my common apps
- Some graphical customizations for nerdcred
- Ability to patch things
- Deeper understanding
- Be as vanilla as possible for easy version upgrade
/* | |
* Copyright (c) 2009-2017, Farooq Mela | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* | |
* 1. Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. | |
* 2. Redistributions in binary form must reproduce the above copyright |
def hexdump(src, length=16): | |
FILTER = ''.join([(len(repr(chr(x))) == 3) and chr(x) or '.' for x in range(256)]) | |
lines = [] | |
for c in xrange(0, len(src), length): | |
chars = src[c:c+length] | |
hex = ' '.join(["%02x" % ord(x) for x in chars]) | |
printable = ''.join(["%s" % ((ord(x) <= 127 and FILTER[ord(x)]) or '.') for x in chars]) | |
lines.append("%04x %-*s %s\n" % (c, length*3, hex, printable)) | |
return ''.join(lines) |
// Minimal audio streaming using OpenSL. | |
// | |
// Loosely based on the Android NDK sample code. | |
// Hardcoded to 44.1kHz stereo 16-bit audio, because as far as I'm concerned, | |
// that's the only format that makes any sense. | |
#include <assert.h> | |
#include <string.h> | |
// for native audio |
object Main extends App { | |
println(isBalanced("(.)(.)".toList)) | |
def isBalanced(list: List[Char]) = { | |
@annotation.tailrec | |
def countBracets(string: List[Char], count: Int = 0): Int = { | |
string match { | |
case '('::tail => countBracets(tail, count+1) | |
case ')'::tail => countBracets(tail, count-1) |
function dex-method-count() { | |
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"' | |
} | |
function dex-method-count-by-package() { | |
dir=$(mktemp -d -t dex) | |
baksmali $1 -o $dir | |
for pkg in `find $dir/* -type d`; do | |
smali $pkg -o $pkg/classes.dex | |
count=$(dex-method-count $pkg/classes.dex) | |
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.') |
#include <stdio.h> | |
void DumpHex(const void* data, size_t size) { | |
char ascii[17]; | |
size_t i, j; | |
ascii[16] = '\0'; | |
for (i = 0; i < size; ++i) { | |
printf("%02X ", ((unsigned char*)data)[i]); | |
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') { | |
ascii[i % 16] = ((unsigned char*)data)[i]; |
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
package org.lucasr.layoutsamples.canvas; | |
import android.os.Build; | |
import android.text.Layout.Alignment; | |
import android.text.StaticLayout; | |
import android.text.TextDirectionHeuristic; | |
import android.text.TextDirectionHeuristics; | |
import android.text.TextPaint; | |
import android.text.TextUtils.TruncateAt; | |
import android.util.Log; |