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 <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <errno.h> | |
#include <ctype.h> | |
#include <stdbool.h> | |
#define SWAP(a,b) ((a)^=(b),(b)^=(a),(a)^=(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
#ifndef CXX_BUFFER_HPP_ | |
#define CXX_BUFFER_HPP_ | |
#include <functional> | |
#include <cstdlib> | |
#include <cstring> | |
#include <system_error> | |
#include <stdexcept> | |
#include <initializer_list> |
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> | |
#define $x ,x | |
#define $i ,i | |
#define eval int | |
#define read scanf | |
#define $scanfpat "%d", & | |
#define $(x) ,(x) | |
#define $open ( | |
#define $close ) | |
#define do { |
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 <stdlib.h> | |
#include <string.h> | |
#include <getopt.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
static enum MODE { | |
INFO, | |
EXPORT, |
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
/* | |
* File: sockets.h | |
* Author: Will Eccles | |
* Date: 2020-03-12 | |
* | |
* 1. Description | |
* | |
* This header attempts to make it easy to use sockets across platforms, | |
* for both Windows and POSIX systems. While Winsock is often somewhat | |
* compatible with Berkeley sockets, it is not strictly compatible, |
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
// note there is no check for excessive recursion so if something has already been copied it will be tried again | |
int cpfile(const char* src, const char* dst) { | |
char* b = basename(src); | |
if (b != NULL && (0 == strcmp(b, ".") || 0 == strcmp(b, ".."))) { | |
return 0; | |
} | |
struct stat srcstat, dststat; | |
bool dstexist = false; | |
int s = 0; |
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
#! /bin/bash -e | |
if [[ $# < 2 ]]; then | |
echo "Example usage: $0 1 27" | |
echo "This would get the details of GPIO1_27 if it's exported." | |
exit 1 | |
fi | |
DEVNUM=$(( 32 * $1 + $2 )) |
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
#! /bin/bash -e | |
if ! command -v fbgrab &>/dev/null; then | |
echo "Please install fbgrab before running this." | |
exit 1 | |
fi | |
fontpath="${FONTPATH:-/usr/share/consolefonts}" | |
cd "$fontpath" |
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
#! /bin/bash | |
# source for most of this information: https://stackoverflow.com/a/58852167/2712525 | |
set -e | |
error() { | |
echo "failed!" | |
exit 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
/* | |
* Input is from stdin. The first line should be the width of the grid. | |
* The second line should be the height. | |
* The third line should be the length of a generation in microseconds. | |
* The rest of the file is assumed to be the grid itself | |
* Anything out of bounds will be cut off. | |
* A space is a "dead" cell; anything else is assumed to be a "living" cell. | |
* | |
* This implementation doesn't allow cells to wrap around. Edges are solid | |
* and block cells. |