This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Archiver | |
# | |
# Lightweight file archiver. Store and compare files. | |
# File names, include their extensions, are used identification, not the full file path. | |
# | |
# Default archive directory in 'default_directory' variable below. To change the | |
# archive directory, edit archiver_config.ini in your home directory. | |
# | |
# archiver.py [-h] [--diff] [--list] [--meta] [--remove] [--file_name [FILE_NAME]] [--modified [MODIFIED]] file_path | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I have a plane of size A,B in 3D space. I have a camera, which is pointed dead-on at the plane. The camera is mapping the plane into a window of size X,Y. | |
// How far Z should the camera be away from the plane for the *entire* plane to be visible? | |
// | |
// Find the minimum distance where the entire plane is in view | |
float get_distance( float plane_width, float plane_height, float fov ) | |
{ | |
float half_width = plane_width / 2.0f; | |
float half_height = plane_height / 2.0f; | |
float half_fov = fov / 2.0f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <pthread.h> | |
#include <float.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <time.h> | |
#include "xoshiro128plus.c" | |
#include "splitmix64.c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Written with the aid of OpenAI Codex | |
# Implements a histogram and draws each bar with proportional number of '*' | |
# | |
# Example Usage: | |
# | |
# data = [] | |
# for i in range(0,10): | |
# data.append(random.uniform(-3.4, 6.7)) | |
# minVal = min(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Author: Lokno Decker | |
; Description: Autohotkey script that fills a number sequence 0-n into | |
; a text editor vertically. The user is prompted for the range n. | |
; Default Shortcut: Ctrl+N | |
; return the digit count of x | |
CountDigits(x) | |
{ | |
total := 0 | |
Loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script that uses arduino-cli to discover a Arduino board attached | |
# to serial to compile and upload an Arduino sketch | |
#!/usr/bin/env python3 | |
from subprocess import check_output | |
import re | |
import sys | |
program_name = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Downloads a public Google Sheets spreadsheet and prints it to stdout in CSV format | |
# | |
# NOTE: Sometimes if the format of cells are set to "Automatic" and there are mixed types in a single | |
# column, some values might be misinterpreted as empty. If this happens, set the format of all | |
# cells in that column, or even the entire table, to "Plain Text" | |
# | |
# To make a spreasheet public: | |
# In Google Sheets, click the Share button and then select "change to anyone with the link" | |
from urllib.parse import quote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import sys | |
if len(sys.argv) != 3: | |
print(f' usage: {sys.argv[0]:s} <declaration file> <name>') | |
sys.exit(0) | |
array_re = re.compile( "([A-Za-z_ ]+) +([a-zA-Z0-9_]+)\[([0-9]+)\];?\n" ) | |
value_re = re.compile( "([A-Za-z_ ]+) +([a-zA-Z0-9_]+);?\n" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <assert.h> | |
#include <random> | |
#include <limits> | |
#ifdef __unix__ | |
#include <pthread.h> | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Single Header Library for Simple Cross-Platform Threading | |
// Author: Lokno Decker | |
// | |
// sthread_handle handle; | |
// STHREAD_CREATE(handle, Func, &argument ); | |
// STHREAD_JOIN(handle); | |
// STHREAD_DESTROY(handle); | |
// | |
// STHREAD_RETVAL Func( void* pArguments ) | |
// { |