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
// gcc nvpath.c -o nvpath -lGL -lglfw && primusrun ./nvpath | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <GLFW/glfw3.h> | |
#ifndef __APPLE__ | |
PFNGLPATHCOMMANDSNVPROC glPathCommandsNV = NULL; | |
PFNGLCOVERSTROKEPATHNVPROC glCoverStrokePathNV = NULL; |
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
const portAudio = require('naudiodon'); | |
var http = require('http'); | |
var clients = []; | |
http.createServer((req, res) => { | |
if (req.url === '/data') clients.push(res); | |
else res.end(`<script> | |
var context = new AudioContext(); | |
fetch('/data').then(response => { |
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
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<style> | |
@font-face { | |
font-family: iransans; | |
src: url("data:font/ttf;base64,AAEAAAAPAIAAAwBwRFNJRwAAAAEAANH0AAAACEdERUYVzhQ8AADR/AAAAJBHUE9T2pZ3rgAA0owAABV4R1NVQvHy3JkAAOgEAAAFJk9TLzKfIOoCAAABeAAAAGBjbWFw6J3s7AAACTgAAAdIZ2FzcAAIABYAANHoAAAADGdseWYg6RLXAAAUNAAApxxoZWFkE8RzMgAAAPwAAAA2aGhlYRFuB5UAAAE0AAAAJGhtdHgLgBkBAAAB2AAAB2Bsb2NhC+niBgAAEIAAAAOybWF4cAHpAekAAAFYAAAAIG5hbWVc7P65AAC7UAAABgNwb3N0jrcN1gAAwVQAABCTAAEAAAABAAC5josHXw889QAJCPwAAAAA1kPDygAAAADWWGNo+677WAxdCq4AAAAJAAIAAAAAAAAAAQAACWD7UAAADLD7rv28DF0AAQAAAAAAAAAAAAAAAAAAAdgAAQAAAdgA+AAGAO8ABQABAAAAAAAAAAAAAAAAAAUAAQADBO0BkAAFAAAFmgUzAAABHwWaBTMAAAPRAGYDXAAAAgsFBgMIBAICBIAAIAMAAAAAAAAACAAAAABHT09HAEAAAP7/CPz7tAAACWAEsAAAAEEACAAABL8GYwAAACAABQTNAGYAAAAAAloAAAK4AAAD+wBwAhgAkwJwAMAGbwA4BlP/owal/5wGpgB0BGcAbgOaAA8D4gANCoQASAZ6/58HYf+oC0kAbQtkAJQHgP+dB6r/mws0ACgHGAAeBij/nAYv/5UHSwASBfwAbwRy/6QEkf+bBU0AaAR7/50ErP+aB+gAEggcACUFywBhAjn/nAKi/5kF/AA5BNUASQSN/5gEvv+ZBPsANwPeAF4F8 |
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
// https://github.com/openstreetmap/openstreetmap-website/blob/e72acaca9b988d41298415d51a10533d3a27e958/lib/osm.rb#L452 | |
function bounds(lat, lon, radius) { | |
lat = lat * Math.PI / 180; | |
lon = lon * Math.PI / 180; | |
var latradius = 2 * Math.asin(Math.sqrt(Math.sin(radius / 6372.795 / 2)**2)); | |
try { | |
var lonradius = 2 * Math.asin(Math.sqrt(Math.sin(radius / 6372.795 / 2)**2 / Math.cos(lat)**2)) | |
} catch (e) { | |
var lonradius = PI; |
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 a.cc harfbuzz.o -std=c++11 -fno-exceptions -DHAVE_CORETEXT -framework CoreText -framework CoreFoundation -framework CoreGraphics && ./a.out | |
#include "src/hb-coretext.h" | |
static void _single_element_callback (void *info, const CGPathElement *element) | |
{ | |
switch (element->type) { | |
case kCGPathElementMoveToPoint: | |
printf ("M%lf,%lf", element->points[0].x * 100, element->points[0].x * 100); | |
break; | |
case kCGPathElementAddLineToPoint: |
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
// gcc -DHB_NO_MT c.cc -ldwrite && a.exe | |
// But it gives some apparently random number... | |
// M0,0 C0,0 0,-536870912 0,0 C0,0 -1610612736,0 0,0 L0,0 L0,0 C1073741824... | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <windows.h> | |
#include <DWrite_1.h> | |
#include <d2d1.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
// gcc a.cc -lgdi32 && a.exe | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <windows.h> | |
int |
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 a.c -DHB_NO_MT -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden ../harfbuzz/src/harfbuzz.cc unix/*.c common/*.c `pkg-config --cflags --libs gtk+-3.0` -lm -ldl -Oz -flto -fuse-ld=lld -Wl,--lto-O3 -Wl,--strip-all -Wl,--gc-sections && ./a.out | |
// a.out = 646K, containing libui and harfbuzz shaping and draw | |
// i686-w64-mingw32-g++ a.c -DHB_NO_MT ../harfbuzz/src/harfbuzz.cc windows/*.cpp common/*.c -luser32 -lkernel32 -lgdi32 -lcomctl32 -luxtheme -lmsimg32 -lcomdlg32 -ld2d1 -ldwrite -lole32 -loleaut32 -loleacc -luuid -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "ui.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
use std::process::Command; | |
use std::cmp::min; | |
use std::io::prelude::*; | |
use std::fs::File; | |
#[derive(Copy, Clone)] | |
pub struct Point { | |
pub x: f32, | |
pub y: f32, | |
} |
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 <stdlib.h> | |
#include "src/hb.h" | |
#include "src/hb-ot.h" | |
struct hb_rasterizer_t | |
{ | |
hb_ot_glyph_decompose_funcs_t *funcs; | |
unsigned width, height; |