Skip to content

Instantly share code, notes, and snippets.

View NTT1906's full-sized avatar
:shipit:
𓅱 bird is dirt poor

Arie1906 NTT1906

:shipit:
𓅱 bird is dirt poor
View GitHub Profile
@NTT1906
NTT1906 / renderPolygon.cpp
Created November 2, 2024 10:45 — forked from esmitt/renderPolygon.cpp
Fill a polygon using scan line algorithm
// Store an horizontal line (x1, y) --> (x2, y)
void line(int x1, int x2, int y)
{
Color c;
c.r = lastColor.r;
c.g = lastColor.g;
c.b = lastColor.b;
for (int x = x1; x <= x2; x++)
{
Vertex v;
@NTT1906
NTT1906 / mersenne-twister.js
Created May 22, 2024 15:31 — forked from banksean/mersenne-twister.js
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();
@NTT1906
NTT1906 / gist:ce67547b9df8ae4b7c19e4efc67333ba
Created May 22, 2024 08:35 — forked from rkalis/gist:eabdbba283f3807c0e38bd677672b6ae
128-bit integer proposal by Tobias Ruck
---
layout: specification
title: 2020-NOV-15 128-bit integer specification
date: 2020-01-14
activation: 2020-NOV-15
version: 1.0
author: Tobias Ruck
---
# Summary
@NTT1906
NTT1906 / new_gist_file
Created May 22, 2024 07:09 — forked from hz9xa/new_gist_file
Floating Point to Binary Value(C++)
#include <iostream>
#include <bitset>
int main()
{
union
{
float input; // assumes sizeof(float) == sizeof(int)
int output;
} data;
@NTT1906
NTT1906 / ANSI.md
Created March 26, 2024 18:13 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
// Simple example code to load a Wav file and play it with WASAPI
// This is NOT complete Wav loading code. It is a barebones example
// that makes a lot of assumptions, see the assert() calls for details
//
// References:
// http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
// Handmade Hero Day 138: Loading WAV Files
#include <windows.h>
#include <iostream>
class A {
protected:
// public:
int key = 1;
double key2 = 20.1;
int key3 = 123454654;
};
@NTT1906
NTT1906 / LaunchChromeMultipleInstances.cmd
Created January 21, 2024 19:56 — forked from jawn/LaunchChromeMultipleInstances.cmd
Launch new browser instance from Windows command line or batch file
REM Open new Chrome instance with two tabs
REM Thanks to https://stackoverflow.com/a/46488816/65545
start chrome --new-window "https://www.facebook.com" "https://www.microsoft.com"
REM Open new Chrome instance with single tab
start chrome --new-window "https://www.google.com"
@NTT1906
NTT1906 / binaryChrEncoder.php
Last active December 1, 2023 03:34
Binary character encoder
<?php
$in = ">?)8'1<$9'\"8526,03(-##4#030(3:>+0/%,'!& 8#%?5\"6-";
$out = "";
$chars = str_split($in);
var_dump(count($chars));
foreach ($chars as $char) {
$bin = decbin(ord($char));
$bin = substr($bin, 0 -5);
$out .= $bin;
}
<?php
function test1S(array $parameters) : void{
$newParameters = [];
foreach ($parameters as $parameter) { //special case, ~~~
$s = $parameter;
$l = strlen($s);
$currentPos = 0;
while ($currentPos < $l) {