This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = 'bar' | |
/** | |
Don't worry about the code block, it will be saved as a gist with right language format, and auto embed to your post. | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hello1 | |
{ | |
public static void Main() | |
{ | |
- System.Console.WriteLine("Hello, World!"); | |
+ System.Console.WriteLine("Rock all night long!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void printSpiral(A, int r, int c, int rows, int cols) { | |
if(A == null || rows < 1 || cols < 1) { | |
System.out.println(); | |
return; | |
} | |
if(rows == 1) { | |
for(int i = 0; i < cols; i++) | |
print(A[r][c+cols-1-i] + " "); | |
} else if(cols == 1) { | |
for(int i = 0; i < rows; i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET(CMAKE_SYSTEM_NAME Linux) | |
#this one not so much | |
SET(CMAKE_SYSTEM_VERSION 1) | |
# specify the cross compiler | |
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc -mfloat-abi=hard) | |
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++ -mfloat-abi=hard) | |
set(CMAKE_AR arm-linux-gnueabihf-ar CACHE FILEPATH "Archiver") | |
# where is the target environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.model.application' | |
def MSB = ['AutoCor', 'BitonicSort', 'BitonicSortRecursive', 'FFT2', 'FFT3', 'FIR', 'FIRcoarse', 'FMRadio'] | |
MSB << 'MatrixMult' << 'MatrixMultBlock' << 'MergeSort' << 'Repeater' | |
MSB << 'BeepBeep' << 'MFCC' << 'Crowd' | |
model { | |
compileOptions.with { | |
sourceCompatibility = JavaVersion.VERSION_1_7 | |
targetCompatibility = JavaVersion.VERSION_1_7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
import java.math.BigInteger; | |
public class NumbersGame { | |
public static final boolean DEBUG = false; | |
public static final BigInteger ONE = BigInteger.ONE; | |
public static final BigInteger TWO = BigInteger.valueOf(2); | |
public static void debug(String line) { | |
if(DEBUG) System.err.println(line); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AbsTest { | |
public static int absSpec(int x) { | |
return x < 0 ? -x : x; | |
} | |
public static int absImpl(int x) { | |
int signbits = x >> 31; | |
int xor = x ^ signbits; | |
return xor + (signbits & 0x01); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testMovingAvg() throws IOException { | |
Log.i("========= %s ===========\n", INFO.getMethodName()); | |
SFG sfg = new SFG(); | |
Channel AB = sfg.link("A", "B", 1, 10, 1); | |
Channel BC = sfg.link("B", "C", 1, 1, 1); | |
sfg.save(INFO.getMethodName(), true); | |
sfg.annotate("A", AB, CREATE, 1); | |
sfg.annotate("B", BC, CREATE, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JavaTest { | |
long nanos; | |
@Before | |
public void setUp() { | |
System.gc(); | |
nanos = System.nanoTime(); | |
} | |
@After |