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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <errno.h> | |
#include <stdbool.h> | |
#include <arpa/inet.h> | |
#include <sys/stat.h> | |
#include <assert.h> |
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 -ex | |
clang -x objective-c -c osx.m -o osx.o | |
g++ -std=c++17 -c main.cpp -o main.o | |
g++ main.o osx.o -framework AppKit -o cliptest |
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
#define STDOUT 1 | |
#define SYS_WRITE 4 | |
int strlen(const char* str) { | |
int len = 0; | |
for(const char* cur = str; *cur; ++cur) ++len; | |
return len; | |
} | |
int write(int fd, const char* buf, int count) { |
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
#include <stddef.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
typedef struct { | |
uint8_t* buf; |
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
time_since_last_read = 0 | |
burst_length = const | |
max_buflen = 2000 | |
recvTag() | |
loop while serial not available - waiting for an answer | |
header = serial read | |
return 0xFFFF if header != 0xA0 | |
len = serial read | |
tag = 0 |
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
#include "Arduino.h" | |
class LedMatrix { | |
int _rows[8]; | |
int _cols[8]; | |
public: | |
LedMatrix(int rows[], int cols[]) { | |
for(int i=0; i<8; i++) { | |
_rows[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
#ifndef LEDMATRIX_H | |
#define LEDMATRIX_H | |
#include "Arduino.h" | |
class LedMatrix { | |
int _rows[8]; | |
int _cols[8]; | |
public: |
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
#include <stdint.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
FILE* fp; | |
size_t N; | |
uint8_t* buf; |
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 matplotlib.pyplot as plt | |
import sys | |
filename = sys.argv[1] | |
word = sys.argv[2] | |
f = open(filename) | |
text = f.read() | |
words = text.split() | |
indices = indices = [i for i, x in enumerate(words) if x.lower().startswith(word)] |
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
/* Copyright (C) 2020 I.C. Wiener - All Rights Reserved | |
* You may use, distribute and modify this code under the | |
* terms of the WTFPL license, which unfortunately won't be | |
* written for another century. | |
* | |
* You should have received a copy of the WTFPL license with | |
* this file. If not, please write to: , or visit : | |
*/ | |
interface BooleanMapper<T> { | |
Boolean map(T arg); |
NewerOlder