Skip to content

Instantly share code, notes, and snippets.

View Assimilator's full-sized avatar
🎯
Focusing

Serghei Assimilator

🎯
Focusing
View GitHub Profile
@DavidBuchanan314
DavidBuchanan314 / cursed_mandelbrot.c
Last active June 28, 2023 15:12
Compile-time mandelbrot in pure C. Outputs a PGM image file to stdout. Output can be seen at https://twitter.com/David3141593/status/1062468528115200001
#include <stdio.h>
#define SQ(x) (x)*(x)
#define M0(x,y) SQ(x)+SQ(y)<4?0:0xe0
#define M1(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M0(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0)):0xc0
#define M2(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M1(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0xa0
#define M3(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M2(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x80
#define M4(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M3(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x60
#define M5(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M4(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x40
@9SQ
9SQ / openlayers_test1.html
Last active August 29, 2015 14:07
OpenStreetMap(EPSG:3857)の上にVector Layer(EPSG:4326)を乗せる (OpenLayers 3)
<!doctype html>
<html lang="ja">
<head>
<link rel="stylesheet" href="http://openlayers.org/en/v3.0.0/css/ol.css" type="text/css">
<style>
.map {
height: 500px;
width: 100%;
}
</style>