Skip to content

Instantly share code, notes, and snippets.

David Butler croepha

Block or report user

Report or block croepha

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cro_sha2.cpp
// License and copyright at the bottom
/* These variations of SHA-2 are implmented:
* checksum bytes nocopy alignment in bytes nocopy chunk size in bytes
SHA256 32 4 64
SHA512 64 8 128
SHA512_256 32 8 128
// There are also three APIs for each, simple, buffered, and nocopy:
View stream1.cpp
char* vertex_shader =
"#version 100\n"
"attribute highp vec3 mesh_xyz;\n"
"attribute highp vec4 mesh_color;\n"
"uniform highp mat4 model_view;\n"
"uniform highp mat4 projection;\n"
"varying highp vec4 vertex_color;\n"
"varying highp vec4 vertex_position;\n"
"void main () {\n"
" vertex_color = mesh_color;\n"
croepha /
Created Apr 3, 2019
notes on Linux network emulation for local processes
sudo ip netns add client_ns
sudo ip link add veth0 type veth peer name veth1
sudo ip link set veth1 netns client_ns
sudo ip link set dev veth0 up
sudo ip addr add dev veth0
sudo tc qdisc add dev veth0 root netem delay 1000ms
sudo ip -n client_ns link set dev veth1 up
sudo ip -n client_ns addr add dev veth1
View LLVM_Musl_install_notes.bash
exit # Dont run this as a script
# LLVM seems to work great on Musl, there only seems some build errors
# when trying to build the sanitizers. So sanitizers have been disabled.
# This is rougly based on this:
# But updated for LLVM 8
# We are also focusing on making a GNU-less toolchain, as there is
# no libgcc and no libstdc++, instead we favor LLVM's own compiler-rt
View linux_wait_and_threads.cpp
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
View bajerovsky_twitch.cpp
#include <stdio.h>
#include <vector>
struct Thing {
int v1;
int v2;
int main () {
View aeskeygenassist128_constint.cpp
#include <wmmintrin.h>
int main() {
__m128i v = {};
static const int r0 = 0x00;
static const int r[] = {0x00};
static const int r1 = r[0];
_mm_aeskeygenassist_si128(v, r0); // compiles
_mm_aeskeygenassist_si128(v, r1); // fails with error: argument to '__builtin_ia32_aeskeygenassist128' must be a constant integer
View traingle_x_problem.cpp
#include <stdio.h>
#include <math.h>
#define PI 3.14159265
* a1 \ a1 \
* |\ |\ s3 ______ a22
* | \ s3 s21 | \ | /
* | \ | \ s22 | / s1
View twenty_four.cpp
#include <algorithm>
#include <stdio.h>
typedef float (*op_t)(float, float);
float op_add (float l, float r) { return l + r; }
float op_sub (float l, float r) { return l - r; }
float op_subr(float l, float r) { return r - l; }
float op_mul (float l, float r) { return l * r; }
float op_div (float l, float r) { return l / r; }
View gl_version.cpp
#include <assert.h>
#include <OpenGL/gl3.h>
#include <SDL2/SDL.h>
int main () {
You can’t perform that action at this time.