This file contains hidden or 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
/*Basic Sketch to Setup the SC16IS750 and | |
test transmitting and revceiving characters | |
UART Setup | |
-9600bps baudrate | |
-8 data bits | |
-1 stop bit | |
-No Parity | |
-No RTS,CTS | |
-Enable FIFO w/o extra features |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using C5; | |
namespace GeneticHelloWorld | |
{ | |
class Program | |
{ |
This file contains hidden or 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
function ll(){ | |
this.last = this.first = null; | |
this.add = function(value){ | |
node = {value: value, next: null, prev: this.last}; | |
this.first = this.first ? this.first : node; | |
if(this.last) this.last.next = node; | |
this.last = node; | |
return node; | |
}; |
This file contains hidden or 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
// ___ _ _ _ _ _ | |
// / __| |___| |__ __ _| | | |_ ___| |_ __ ___ _ _ ___ | |
// | (_ | / _ \ '_ \/ _` | | | ' \/ -_) | '_ \/ -_) '_(_-< | |
// \___|_\___/_.__/\__,_|_| |_||_\___|_| .__/\___|_| /__/ | |
// |_| | |
var rot2d = function(theta, size){ | |
// construct a result matrix | |
var r = new Array(size); | |
for(var i = size; i--; ){ | |
r[i] = Array |
This file contains hidden or 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
"".__proto__.format = function(params){ | |
var temp = this; | |
for(var i = params.length; i--;) | |
temp=temp.replace("{"+i+"}",params[i]); | |
return temp; | |
}; | |
// ___ _ | |
// | __|_ ____ _ _ __ _ __| |___ |
This file contains hidden or 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
static inline int bet(float a, float m, float b){ | |
return fabs(a - m) + fabs(m - b) == fabs(a - b); | |
} | |
typedef float vec2[2]; | |
typedef struct{ | |
vec2 p; | |
vec2 n; | |
} ray2; | |
static inline void vec2_add(vec2 r, vec2 a, vec2 b){ |
This file contains hidden or 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 __dump(void* buf, int len){ | |
int i = 0; | |
for(i = 0; i < len; i++){ | |
char str[16]; | |
sprintf(str, "%02x ", ((char*)buf)[i] & 0xff); | |
write(1, str, strlen(str)); | |
}write(1, "\n", 1); | |
} |
This file contains hidden or 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
#include <stdio.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
void* myAlloc(void* optionalParam, size_t bytes) | |
{ | |
// as an example, we will use malloc() | |
return malloc(bytes); |
This file contains hidden or 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 sort(int* arr, int len) | |
{ | |
for(int i = 0; i < len; ++i){ | |
for(int j = len - 1; j > i; j--){ | |
if(arr[i] > arr[j]){ | |
int temp = arr[i]; | |
arr[i] = arr[j]; | |
arr[j] = temp; | |
} | |
} |
This file contains hidden or 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
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, | |
snap->data, | |
snap->current.width * snap->current.height * 4, | |
NULL); | |
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); | |
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault; | |
CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; | |
CGImageRef imageRef = CGImageCreate(snap->current.width, |
OlderNewer