Skip to content

Instantly share code, notes, and snippets.

View m1lkweed's full-sized avatar

m1lkweed

View GitHub Profile
@bert
bert / README
Created July 15, 2011 21:01
Bresenham Algorithms in C
Some possible implementations of the Bresenham Algorithms in C.
The Bresenham line algorithm is an algorithm which determines which points in an
n-dimensional raster should be plotted in order to form a close approximation
to a straight line between two given points.
It is commonly used to draw lines on a computer screen, as it uses only integer
addition, subtraction and bit shifting, all of which are very cheap operations
in standard computer architectures.
It is one of the earliest algorithms developed in the field of computer graphics.
A minor extension to the original algorithm also deals with drawing circles.
@rxaviers
rxaviers / gist:7360908
Last active June 2, 2024 11:04
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@lbruder
lbruder / lbForth.c
Created April 6, 2014 15:21
A minimal Forth compiler in ANSI C
/*******************************************************************************
*
* A minimal Forth compiler in C
* By Leif Bruder <leifbruder@gmail.com> http://defineanswer42.wordpress.com
* Release 2014-04-04
*
* Based on Richard W.M. Jones' excellent Jonesforth sources/tutorial
*
* PUBLIC DOMAIN
*
@jart
jart / dawkins.markdown
Created June 8, 2014 19:28
How Dawkins Got Pwnd by Mencius Moldbug (37,941 words)

How Dawkins got pwnd

By Mencius Moldbug c. Sep 2007

Part 1

Richard Dawkins recently wrote a book called The God Delusion. You've probably heard of it.

Professor Dawkins is a great scientist and one of my favorite writers. And I have no quarrel at all with his argument. I was raised as a scientific atheist, and I've never seen the slightest reason to think otherwise. These days I prefer the word "nontheist" - for reasons which will shortly be clear - but there's no substantive difference at all. Except in the context of role-playing games, I have no interest whatsoever in gods, goddesses, angels, devils, dryads, water elementals, or any such presumed metaphysical being.

Nonetheless, it's my sad duty to inform the world that Professor Dawkins has been pwned. Perhaps you're over 30 and you're unfamiliar with this curious new word. As La Wik puts it:

@Mischa-Alff
Mischa-Alff / AABB.cpp
Last active October 31, 2022 11:12
Simple AABB implementation using SIMD instructions for x86-64
#include <chrono>
#include <ctime>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <random>
struct AABB{int32_t left, top, right, bottom;};
extern "C" bool check_aabb(AABB *a, AABB *b);
extern "C" bool check_aabb_conventional(AABB *a, AABB *b);
@dannote
dannote / final-cut-pro-trial-reset.swift
Last active May 30, 2024 20:49
Final Cut Pro X trial reset
#!/usr/bin/swift
import Foundation
let path = URL(fileURLWithPath: NSString(string: "~/Library/Application Support/.ffuserdata").expandingTildeInPath)
let data = try! NSData(contentsOf: path) as Data
let dictionary = try! NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as! NSDictionary
let mutableDictionary = dictionary.mutableCopy() as! NSMutableDictionary
for (key, value) in mutableDictionary {
// Brute-force call using world-space bounding spheres.
for (buc_uint32_t frustum = 0; frustum < n_frusta; ++frustum) {
__m128 p_x0x1x2x3; __m128 p_y0y1y2y3; __m128 p_z0z1z2z3; __m128 p_d0d1d2d3;
__m128 p_x4x5x4x5; __m128 p_y4y5y4y5; __m128 p_z4z5z4z5; __m128 p_d4d5d4d5;
// Transpose frustum planes so we can test against them in parallel.
{
const __m128 x0y0z0d0 = _mm_load_ps((const float *)&frusta[frustum].planes[0]);
const __m128 x1y1z1d1 = _mm_load_ps((const float *)&frusta[frustum].planes[1]);
const __m128 x2y2z2d2 = _mm_load_ps((const float *)&frusta[frustum].planes[2]);
@vurtun
vurtun / _GJK.md
Last active May 1, 2024 22:49
3D Gilbert–Johnson–Keerthi (GJK) distance algorithm

Gilbert–Johnson–Keerthi (GJK) 3D distance algorithm

The Gilbert–Johnson–Keerthi (GJK) distance algorithm is a method of determining the minimum distance between two convex sets. The algorithm's stability, speed which operates in near-constant time, and small storage footprint make it popular for realtime collision detection.

Unlike many other distance algorithms, it has no requirments on geometry data to be stored in any specific format, but instead relies solely on a support function to iteratively generate closer simplices to the correct answer using the Minkowski sum (CSO) of two convex shapes.

@jart
jart / fone.go
Last active May 16, 2024 04:05
Linux CLI Telephone in 300 lines of Go. This is a NAT traversing SIP user agent. It can hook into the PSTN via gateways like Flowroute. The keyboard can be used to send DTMF tones.
// To the extent possible under law, Justine Tunney has waived
// all copyright and related or neighboring rights to this file,
// as it is written in the following disclaimers:
// - http://unlicense.org/
// - http://creativecommons.org/publicdomain/zero/1.0/
package main
// #cgo pkg-config: ncurses libpulse-simple
// #include <stdlib.h>