Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#TYPE='generic'
TYPE='alternative'
#|---------|-----------------------|---------------|---------------|---------------------|-------------------|-------------------|----------------------|-------------------|
#| ARCH | aarch64-k3.10 | armv5sf-k3.2 | armv7sf-k2.6 | armv7sf-k3.2 | mipselsf-k3.4 | mipssf-k3.4 | x64-k3.2 | x86-k2.6 |
#| LOADER | ld-linux-aarch64.so.1 | ld-linux.so.3 | ld-linux.so.3 | ld-linux.so.3 | ld.so.1 | ld.so.1 | ld-linux-x86-64.so.2 | ld-linux.so.2 |
#| GLIBC | 2.27 | 2.27 | 2.23 | 2.27 | 2.27 | 2.27 | 2.27 | 2.23 |
#|---------|-----------------------|---------------|---------------|---------------------|-------------------|-------------------|----------------------|-------------------|
@nickwph
nickwph / aosp-centos-7-building-guide.md
Last active October 13, 2021 02:42
CentOS 7 AOSP Building Guide

CentOS 7 AOSP Building Guide

install libraries

# fetch source
sudo yum install git
sudo yum install wget
# to compile
sudo yum install java-1.7.0-openjdk
import Foundation
extension CALayer {
public func animate() -> CALayerAnimate {
return CALayerAnimate(layer: self)
}
}
public class CALayerAnimate {
@nickwph
nickwph / repo-commands.sh
Created May 7, 2015 16:35
Nice Repo Commands
# update repo version
repo selfupdate --no-repo-verify
# reset all repos
repo forall -vc "git reset --hard"
# clean and delete unstaged changes
repo forall -vc "git clean -df"
# pull all repos
@nickwph
nickwph / aosp-jack-error-fix.md
Created October 13, 2015 20:00
Error when Building AOSP

if you encounter this error

out/host/linux-x86/bin/jack: line 131: 31049 Killed                  $SERVER_PRG $SERVER_PORT_SERVICE $SERVER_PORT_ADMIN $SERVER_COUNT $SERVER_NB_COMPILE $SERVER_TIMEOUT >> $SERVER_LOG 2>&1
ERROR: Cannot launch Jack server
make: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex] Error 41
make: *** Waiting for unfinished jobs....

its because ~/.jack has an incorrect permission you can fix it with

/**
* Created by Nicholas Wong <nickwph@gmail.com>.
* Github Gist: https://gist.github.com/nickwph/de0dd805e29fe3bcba476b6126459259
* Gradle build file to set up variables for checkstyle.
*/
apply plugin: 'checkstyle'
checkstyle {
configFile file('checkstyle-config.xml')
showViolations true
/**
* Created by Nicholas Wong <nickwph@gmail.com>.
* Github Gist: https://gist.github.com/nickwph/8e757fa1fff9c52a39a6a5a485fdc900
* Gradle build file to set up variables for findbugs.
* The following tasks will be created in normal circumstance.
*
* - Create FindBugs XML Report
* findbugsDebug
* findbugsRelease
*
// temporarily solution: place generated code into source directory
project.afterEvaluate {
def variants
if (project.plugins.hasPlugin("com.android.application") || project.plugins.hasPlugin("com.android.test")) {
variants = project.android.applicationVariants
} else if (project.plugins.hasPlugin("com.android.library")) {
variants = project.android.libraryVariants
} else {
throw new Exception("The android application or library plugin must be applied to the project")
}
# filtering function from sdk list
function get_id_with_regex {
android list sdk --all --extended | grep $1 | sed 's/.*"\(.*\)".*/\1/g' | tr '\n' ','
}
# grep ids
INSTALL_FILTER=$(get_id_with_regex 'build-tools') # build-tools-*
INSTALL_FILTER+=$(get_id_with_regex '"android-\(1[5-9]\|[2-9][0-9]\)') # android-15 to android-99
INSTALL_FILTER+='tools,'
INSTALL_FILTER+='platform-tool,'

Define Node

static class Node {
    int value;
    Node left, right;
}

Breathe First Iterative Traversal