Skip to content

Instantly share code, notes, and snippets.

@munrocket
munrocket / wgsl_3d_sdf.md
Last active July 25, 2024 19:13
WGSL 3D SDF Primitives

WGSL 3D SDF Primitives

Revision: 06.08.2023, https://compute.toys/view/407

Sphere - exact

fn sdSphere(p: vec3f, r: f32) -> f32 {
  return length(p) - r;
}
Yacht v1.1
(Yet Another Cycle Hunting Table)
-------------------------------------------------------------------------------
Forewords :
-------------------------------------------------------------------------------
This document is based on :
- 9th Edition of M68000 8-16-32-bit Microporcessor User's Manual
(Motorola, 1993) (laterly refered as M68000UM)
@RyanJeong
RyanJeong / A_WAY_TO_CONVERT.md
Last active January 28, 2024 14:53
A way to convert char[] to/from TCHAR[] in C/C++(WinAPI)

TCHAR -> char

#define SIZE 1024

TCHAR src[SIZE] = L"This string will be char type";
char  dest[SIZE];

WideCharToMultiByte(CP_ACP, 0, src, lstrlen(src), dest, SIZE, NULL, NULL);

68000 instructions timings

When I started to write some pure 68000 I didn't find a nice doc that would cover all the op codes I used which a nice diagram for the cycle counts so I made one. This info has been assembled / hacked up using this tool https://github.com/emoon/68k_documentation_gen with a bunch of manual work and some automation for generating the cycle tables. If you find any errors in this (I'm sure there are plenty but it has been useful for me) please contact me or even better do a PR :)

ABCD

Operation: Source10 + Destination10 + X → Destination

/**
* int16, and uint16 numbers in JS.
*
* by Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
*/
const assert = require('assert');
/**
* Converts a number to signed 16-bit integer.
@codebrainz
codebrainz / gist:8587a1ddc8e020a71fef
Last active January 11, 2022 16:25
Simple assembly parser in Bison
%{
#include "stdinc.h"
#include "parser.h"
#include "tokens.h"
#include "lexer.h"
static void parser_error(YYLTYPE *locp, struct Parser* par, const char *message);
#define parser_lex(a,b,c) parser_lex(a,b,(c)->scanner)
; ___ _ __ ___ __ ___
; / __|_ _ __ _| |_____ / /| __|/ \_ )
; \__ \ ' \/ _` | / / -_) _ \__ \ () / /
; |___/_||_\__,_|_\_\___\___/___/\__/___|
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself
; to learn a little bit about assembly. I **think** I understood everything, but I may
; also be completely wrong :-)
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@robmiller
robmiller / .gitconfig
Created July 17, 2013 07:52
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@andycole
andycole / .gitconfig
Last active January 11, 2023 09:26
My git config
## Basic colours
[color]
branch = auto
diff = auto
status = auto
interactive = auto
ui = auto
[color "branch"]
current = yellow bold