I hereby claim:
- I am billykwok on github.
- I am billykwok (https://keybase.io/billykwok) on keybase.
- I have a public key ASBUqKMA-0HO7jfigtVIq4kvqTmuVwCMqqdzha_DOE2Wqgo
To claim this, I am signing this object:
function insertSortRec(array) { | |
if (array.length <= 1) { | |
return array; | |
} else { | |
const key = array.pop(); | |
let subArray = insertSortRec(array); | |
let i = subArray.length - 1; | |
while (i >= 0 && subArray[i] > key) { | |
subArray[i + 1] = subArray[i]; | |
--i; |
function selectSort(array) { | |
for (let j = 0; j < array.length; ++j) { | |
let indexOfMin = j; | |
for (let i = j + 1; i < array.length; ++i) { | |
if (array[i] < array[indexOfMin]) indexOfMin = i; | |
} | |
[ array[j], array[indexOfMin] ] = [ array[indexOfMin], array[j] ]; | |
} | |
return array; | |
} |
function minMax(array) { | |
if (array.length <= 1) { | |
return [ array[0], array[0] ]; | |
} else if (array.length == 2) { | |
return array[0] < array[1] ? [ array[0], array[1] ] : [ array[1], array[0] ]; | |
} else { | |
const breakpt = array.length / 2; | |
const [ minLeft, maxLeft ] = minMax(array.slice(0, Math.floor(breakpt))); | |
const [ minRight, maxRight ] = minMax(array.slice(Math.floor(breakpt))); | |
return [ minLeft < minRight ? minLeft : minRight, |
#include "smallsh.h" /* include file for example */ | |
#include <stdlib.h> | |
#include <signal.h> | |
/* program buffers and work pointers */ | |
static char inpbuf[MAXBUF], tokbuf[2*MAXBUF], *ptr = inpbuf, *tok = tokbuf; | |
int intr_p = 0; | |
char *prompt = "Command>"; /* prompt */ | |
int fg_pid = 0; |
char decodeKey(unsigned long key, unsigned char times) { | |
switch (*key) { | |
case REMOTE_BTN_0: return ' '; | |
case REMOTE_BTN_1: return '1'; | |
case REMOTE_BTN_2: | |
switch (times) { | |
case 2: return 'B'; | |
case 3: return 'C'; | |
case 2: return 'B'; | |
case 3: return 'C'; |
I hereby claim:
To claim this, I am signing this object:
#define _TASK_MICRO_RES | |
#include <TaskScheduler.h> | |
#include <TaskSchedulerDeclarations.h> | |
#include <TaskSchedulerSleepMethods.h> | |
#define PWM_PERIOD 10000 | |
#define SAMPLING_FREQUENCY 150 | |
#define LED_BLUE LED_BUILTIN | |
#define LED_RED PIN_SPI_MISO |
import SerialPort from 'serialport'; | |
import Vibrant from 'node-vibrant'; | |
import readline from 'readline'; | |
import util from 'util'; | |
(async () => { | |
const entries = await SerialPort.list(); | |
const entry = entries.find( | |
(it) => it.manufacturer && it.manufacturer.includes('Arduino') | |
); |
#define BAUD_RATE 9600 | |
#define DELIMITER '\n' | |
#define SAMPLING_RATE 100 | |
#define LED_RED 9 | |
#define LED_GREEN 10 | |
#define LED_BLUE 11 | |
int t = 0; | |
int dt = 1; |
import SerialPort from 'serialport'; | |
import readline from 'readline'; | |
(async () => { | |
const entries = await SerialPort.list(); | |
const entry = entries.find( | |
(it) => it.manufacturer && it.manufacturer.includes('Arduino') | |
); | |
if (!entry) { | |
console.warn('No Arduino found'); |