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
// Adapted from chromium sourcecode | |
float cubic_ease(float p1x, float p1y, float t, float p2x, float p2y) { | |
static const double epsilon = 1e-7; | |
auto cx_ = 3.0 * p1x; | |
auto bx_ = 3.0 * (p2x - p1x) - cx_; | |
auto ax_ = 1.0 - cx_ - bx_; | |
auto cy_ = 3.0 * p1y; | |
auto by_ = 3.0 * (p2y - p1y) - cy_; |
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
char c; | |
#define _E(m_l) { printf("get_search_result_file_and_line failed at %d\n", __LINE__); goto m_l; } ; | |
c = read_char(); | |
if(c == '\n') _E(line_ended); | |
if(c != 'L') _E(ignore_rest); | |
c = read_char(); | |
if(c == '\n') _E(line_ended); | |
if(c != 'i') _E(ignore_rest); | |
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
/* build.sh: | |
mkdir -p build/ | |
time clang++ --std=gnu++11 \ | |
-fsanitize=address -fsanitize=undefined \ | |
main.cpp -o build/main.bin | |
build/main.bin | |
echo building build/output.c | |
wc build/output.c | |
echo gcc | |
env time gcc -c build/output.c -o build/output.c.o |
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
// clang++ -Wno-writable-strings pty_reader.cpp -lutil -o pty_reader | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <pty.h> | |
int main(){ | |
fprintf(stdout, "READER...\n"); | |
fflush(stdout); | |
int master = 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
// Example of how to watch files on BSD/OSX, with a timer thrown in for fun | |
#define MAIN_WATCH "file1" | |
#define ALTERNATING_WATCH "file2" | |
#include <stdio.h> | |
#include <assert.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/event.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
void paint_text(V2<float>&cursor, V4<float>&bounds, BakedFont&font, char*input_text) { | |
glEnable(GL_TEXTURE_2D); | |
glBindTexture(GL_TEXTURE_2D, font.texture); | |
glBegin(GL_QUADS); | |
char*text_end = strlen(input_text) + input_text; | |
for(char*t = input_text; t<text_end; t++) { | |
if (*t == '\n') { | |
cursor.x = bounds.l; | |
cursor.y += font.size; | |
} else if (*t >= 32) { |
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
/* | |
Example output: | |
proc: | |
Got opt1 | |
proc: | |
Got opt1 | |
Got opt3 | |
proc: |
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
LD.LLD(1) User Commands LD.LLD(1) | |
NAME | |
ld.lld - manual page for ld.lld 5.0 | |
DESCRIPTION | |
OVERVIEW: lld | |
USAGE: build-llvm/bin/ld.lld [options] <inputs> |
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
float cubic_ease(float p1x, float p1y, float t, float p2x, float p2y) { | |
if (t>=1) return 1; | |
if (t<=0) return 0; | |
static const double epsilon = 1e-7; | |
auto cx_ = 3.0 * p1x; | |
auto bx_ = 3.0 * (p2x - p1x) - cx_; |
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 <assert.h> | |
//#include <SDL.h> | |
#include <SDL2/SDL.h> | |
bool keys_hit[512] = {}; | |
SDL_Keycode __small_keysym_to_sdl_keysym(int smks) { | |
SDL_Keycode ret = 0; |