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 |
#|---------|-----------------------|---------------|---------------|---------------------|-------------------|-------------------|----------------------|-------------------|
/**
* Created by Nicholas Wong <[email protected]>.
* 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 <[email protected]>.
* 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
*
import Foundation
extension CALayer {
public func animate() -> CALayerAnimate {
return CALayerAnimate(layer: self)
}
}
public class CALayerAnimate {
// 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

Define Node

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

Depth First Recursive Traversal (Pre-order)

Idea

# stack: a stack that store the current combination
# items: available items, each item has a value
# available_space: the spaces left of the current combination
# index: the index of items it is going to match
function find_combinations_recursively(stack, items, available_space, index):
    # check for invalid target or value
    value = items[index]
@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