Skip to content

Instantly share code, notes, and snippets.

Avatar
🏔️
Hey how's it going

49fl lf94

🏔️
Hey how's it going
  • Internet
View GitHub Profile
@lf94
lf94 / adafruit_gfx.html
Created Aug 17, 2021
Adafruit GFX API in JS
View adafruit_gfx.html
<canvas id="canvas" width="800" height="600"></canvas>
<script>
const canvas = document.getElementById("canvas");
const context = canvas.getContext('2d');
const rgbs = {};
// color is in 565 format
function toRGB(color) {
const rgb = rgbs[color];
View hearts.scad
// P = (1−t)2P1 + 2(1−t)tP2 + t2P3
function bezier3(points, segments) = let (
s = 1 / segments
) [
for(t = 0; t <= 1 + s; t = t + s)
pow((1 - t), 2) * points[0]
+ 2 * (1 - t) * t * points[1]
+ pow(t, 2) * points[2]
];
View re:when-will-browsers-be-complete.txt
RE: WHEN WILL WEB BROWSERS BE COMPLETE?
2020-10-31 02:46PM
A follow-up.
There has been some great conversation around the opinion piece. Having read all
200+ comments on YCombinator and Gist GitHub, I think it's most productive to
respond to them all in this follow-up piece.
The piece will be structured by looking at what I think are the most relevant
critiques and comments, followed by adding context to others' comments, and
View when-will-web-browsers-be-complete.txt
WHEN WILL BROWSERS BE COMPLETE?
A short exploration into the end game of web browsers.
This article may seem to be about bashing Google but it isn't. It's just about
reflecting on the current state and how much longer we should see ourselves
here.
So what is the Web? Well we can agree the Web is a conglomerate of standards
proposed by the W3C. So what do those standards define?
View andb_eq_orb.v
Theorem andb_eq_orb :
forall (b c : bool),
(andb b c = orb b c) ->
b = c.
Proof.
intros b c.
destruct b eqn:Eb.
- destruct c eqn:Ec.
+ reflexivity.
View z-strings.adoc

"Strings" form a group

By the end of this, we will have defined insert, delete, find and replace operations.

Talking about polymorphism with someone in the context of JS, the following example came up:


View curl.s
.intel_syntax noprefix
.include "std.macro"
.include "curl.const"
.section .data
curl: .quad 0
.section .rodata
url_google: .asciz "http://google.com"
View fib.s
.intel_syntax noprefix
.include "std.macro"
.section .text
fib: op1 = rdi; op2 = rsi; iterations = rcx
xadd op2, op1
loop fib
ret
View lambda.js
// Propositional logic implemenation
const True = a => b => a;
const False = a => b => b;
const If = x => x;
const Not = a => a(False)(True);
const And = a => b => a(True)(False)(b(True)(False))(False);
const Or = a => b => a(True)(b(True)(False));
const Xor = a => b => And(Or(a)(b))(Not(And(a)(b)));
// SKI calculus implementation
@lf94
lf94 / zmap.py
Created Jun 17, 2018
zmap to ply converter
View zmap.py
def toAddress(bytes):
return int.from_bytes(bytes, byteorder='big')
class Map:
# Map structure is tied to a file
def __init__(self, fileHandle):
self.fileHandle = fileHandle
self.header = self.Header(fileHandle)
fileHandle.seek(toAddress(self.header.commands[-1].data))
self.mesh = Mesh(fileHandle)