Skip to content

Instantly share code, notes, and snippets.

View warmist's full-sized avatar
๐Ÿ•น๏ธ

Warmist warmist

๐Ÿ•น๏ธ
View GitHub Profile
@imneme
imneme / randutils.hpp
Last active October 23, 2026 14:55
Addresses common issues with C++11 random number generation; makes good seeding easier, and makes using RNGs easy while retaining all the power.
/*
* Random-Number Utilities (randutil)
* Addresses common issues with C++11 random number generation.
* Makes good seeding easier, and makes using RNGs easy while retaining
* all the power.
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Melissa E. O'Neill
*
@merriam
merriam / as.gd
Last active October 9, 2026 14:11
Godot utililty routines for printing numbers
extends Resource
class_name As
static func demo_usage():
print("These are booleans: %s %s"
% [tf(true), tf(false)])
print("These are numbers: %s %s"
% [comma_int(1234), comma(1234.567, 2)])
print("This is scientific: %s %s"
% [scientific(0.000123), scientific(1234.56)])
@d7samurai
d7samurai / .readme.md
Last active August 31, 2026 09:24
Minimal D3D11 elaborations I

Minimal D3D11 elaborations I

A spin-off from the mainline Minimal D3D11 series, adding two-lane instanced rendering. As before: An uncluttered Direct3D 11 setup & basic rendering primer / API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft.

The main difference here is that the hollow cube itself is rendered using instancing (which saves a lot of vertices compared to the original, so geometry data is now small enough to be included in the source without being too much in the way), but also all trigonometry and matrix math is moved to the vertex shader, simplifying the main code (and not needing math.h).

In this case, each instance is mere

@jdkanani
jdkanani / notepad.html
Last active June 30, 2026 15:32 — forked from jakeonrails/Ruby Notepad Bookmarklet
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@mmozeiko
mmozeiko / win32_crt_float.cpp
Last active April 28, 2025 19:10
Visual C/C++ CRT functionality
extern "C"
{
int _fltused;
#ifdef _M_IX86 // following functions are needed only for 32-bit architecture
__declspec(naked) void _ftol2()
{
__asm
{
@beesandbombs
beesandbombs / starTorus.pde
Created September 5, 2018 22:57
star torus
// "star torus" by davey
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@ksmithdev
ksmithdev / Coin.scad
Created May 29, 2023 20:18
Used to create a standing coin with sides
$fn=10;
union() {
difference() {
cylinder(h=4, r=12.5, center=false);
cylinder(h=1, r=10.5, center=false);
translate([0,0,3])
cylinder(h=1, r=10.5, center=false);
}
@ksmithdev
ksmithdev / relief_generator.scad
Created May 29, 2023 20:16
Used to generate an STL coin face
layer_height = 0.2;
model_height = 1;
union() {
for (i=[0:layer_height:model_height]) {
translate([0,0,i])
linear_extrude(layer_height)
offset(-i*0.6)
resize([10,10,layer_height])
import("Symbol.svg", center = true);