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
var unmark = (t)=>(t | |
//escape tags | |
.replace(/\\</g,"<") | |
//tables | |
.replace(/[\n\r^]((((.*\|)+.+)[\n\r$])((\||)((:|)\-+(:|)\|(:|))+\-+(:|)(\||)[\n\r])(((.*\|)+.+)[\n\r$])+)/g,'<p><table>\n$1</table></p>\n') | |
.replace(/(\||)((:|)\-+(:|)\|(:|))+\-+(:|)(\||)[\n\r](?=((.*[\n\r])*<\/table>))/g,'') | |
.replace(/(((.*\|)+.+))[\n\r$](?=((.*[\n\r])*<\/table>))/g,' <tr>|$1|</tr>\n') | |
.replace(/<tr>\|+(.*)\|+<\/tr>/g,'<tr> <td>$1</td> </tr>') | |
.replace(/\|(?=((.+)<\/tr>))/g,'</td> <td>') | |
//paragraph |
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
/* | |
* LaTeX-skin.css | |
* (c) Lingdong Huang 2018 | |
* Make your HTML look like it's typeset with LaTeX | |
* | |
* Features: | |
* - LaTeX look and feel, including its font Computer Modern; | |
* - Automatic numbering of (sub)sections and figures; | |
* - Print / export to PDF, (On macOS Safari/Chrome, File > Print) | |
*/ |
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
// | |
// cli-ptcloud.c | |
// - Lingdong Huang 2019 | |
// | |
// View point clouds (.ply format) in commandline | |
// | |
// Dependencies: | |
// - curses (-lcurses, comes with most unix systems) | |
// - rply (http://w3.impa.br/~diego/software/rply/, place in path below: | |
#define RPLY_PATH "include/rply/rply.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
// npy-rw.js | |
// READ AND WRITE .NPY (NUMPY) FILES | |
// Lingdong Huang 2019 | |
// npy specs: https://numpy.org/devdocs/reference/generated/numpy.lib.format.html | |
// reference: https://gist.github.com/nvictus/88b3b5bfe587d32ac1ab519fd0009607 | |
const is_node = (typeof process !== 'undefined') | |
var npy = {}; |
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
/** Finding contours in binary images and approximating polylines. | |
* Implements the same algorithms as OpenCV's findContours and approxPolyDP. | |
* <p> | |
* Made possible with support from The Frank-Ratchye STUDIO For Creative Inquiry | |
* At Carnegie Mellon University. http://studioforcreativeinquiry.org/ | |
* @author Lingdong Huang | |
*/ | |
var FindContours = new function(){let that = this; | |
let N_PIXEL_NEIGHBOR = 8; |
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
/* Poisson Filling for Processing | |
* Made possible with support from The Frank-Ratchye STUDIO For Creative Inquiry | |
* At Carnegie Mellon University. http://studioforcreativeinquiry.org/ | |
*/ | |
package poissonfill; | |
import processing.core.*; | |
import processing.opengl.*; | |
import java.util.*; |
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
// ln.c | |
// | |
// simple, fast, accurate natural log approximation | |
// when without <math.h> | |
// featuring * floating point bit level hacking, | |
// * x=m*2^p => ln(x)=ln(m)+ln(2)p, | |
// * Remez algorithm | |
// by Lingdong Huang, 2020. Public domain. |
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
/* =============================================================================== | |
* triangulateMTX.ts | |
* TypeScript implementation of Mei-Tipper-Xu algorithm for polygon triangulation | |
* (c) Lingdong Huang 2020 (MIT License) | |
* =============================================================================== */ | |
namespace triangulateMTX{ | |
export function triangulate( | |
vertices : Array<[number,number]>, | |
params : {sliverThreshold? : number, | |
greedyHeuristic? : boolean, |
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
// Wormhole.java | |
// Lingdong Huang 2021, Public domain | |
// Simple app to create "wormholes" connecting different displays: | |
// When cursor enters a black patch, it comes out from the other | |
// Idea inspired by this mac app "Wormhole by Tod LLC": https://macdownload.informer.com/wormhole1/ | |
// I implemented the idea in java to work on Windows | |
// | |
// Usage: | |
// javac Wormhole.java; java Wormhole <x0> <y0> <x1> <y1> | |
// (arguments being the positions of the two holes) |
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
// | |
// core_midi_synth.mm | |
// | |
// a barebones midi synthesizer demo that calls | |
// mac's low level API (CoreMIDI and CoreAudio) directly | |
// (because I can't be bothered to compile other people's libraries) | |
// | |
// with code fragments adapted from | |
// - https://stackoverflow.com/a/7964300 | |
// - https://github.com/thestk/rtmidi |
OlderNewer