Skip to content

Instantly share code, notes, and snippets.

View UplinkCoder's full-sized avatar

Stefan Koch UplinkCoder

View GitHub Profile
module fastFields;
static public enum Type
{
Bool = "bool",
Ubyte = "ubyte",
Byte = "byte",
Ushort = "ushort",
Short = "short",
@UplinkCoder
UplinkCoder / bf_helloworld.d
Last active August 1, 2017 23:12
brainfuck_helloworld as d-code
enum hello_world = (() {
uint iPos, oPos;
ubyte[] output;
output.length = 16;
ubyte[32] cells;
uint cellPtr = 0;
cells[cellPtr] += 10 ;
@UplinkCoder
UplinkCoder / manb.d
Created August 4, 2017 22:37
ctfe-able ascii-art mandelbrot via transcompile brainfuck
static immutable func = ({
uint iPos, oPos;
ubyte[] output;
ubyte[4096] cells;
uint cellPtr = 0;
output.length = 8192;
cells[cellPtr] += 13 ;
while(cells[cellPtr]) {
cells[cellPtr] -= 1 ;
module z3;
struct _Z3_symbol;
alias _Z3_symbol* Z3_symbol;
struct _Z3_literals;
alias _Z3_literals* Z3_literals;
struct _Z3_config;
alias _Z3_config* Z3_config;
struct _Z3_context;
alias _Z3_context* Z3_context;
@UplinkCoder
UplinkCoder / p.c
Created July 20, 2018 12:44
Load sdl and gl into cling
#include "cling/Interpreter/Interpreter.h"
#include "SDL2/SDL.h"
#include "GL/gl.h"
SDL_GLContext ctx;
SDL_Window* win;
bool loadSDL();
bool loadGL();
double avg(long[] values)
{
double result;
long sum;
foreach(value;values)
{
sum += value
}
result = sum;
@UplinkCoder
UplinkCoder / base64decode.c
Last active June 25, 2019 05:27
base64decode_bugged
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#ifdef _WIN32
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
#endif;
import std.stdio;
extern(C) void srand48(long x);
extern(C) double drand48();
extern(C) long lrand48();
void main()
{
int seed = 1;
/******************************************************************************
Atomic Compare and Swap
Used to set a variable to a value in a thread-safe way
Returns: the value found at the point of read
so if it equals expected the cas was sucsessful
******************************************************************************/
version (DotDotDotTemplate)
{
template staticMap(alias F, T...)
{
mixin("enum staticMap = (F!T)...;");
}
}
else version (Walter)
{
template staticMap(alias F, T...)