Skip to content

Instantly share code, notes, and snippets.

View GolezTrol's full-sized avatar
👶
Currently programming a little human

j.visser GolezTrol

👶
Currently programming a little human
View GitHub Profile
@GolezTrol
GolezTrol / day7.bat
Created December 8, 2023 15:18
Advent of code 2023 day 7 Camel Cards (Windows Batch file)
@echo off
REM script calls itself with 'sethandtype' to calculate the hand type for a batch of hands.
REM A batch consists of a series of 'hands and bids, all space separated
if "%1"=="sethandtype" (
:item
call :sethandtype %3 %4
shift /3 & shift /3
if not "%3"=="" goto :item
REM echo Thread %2 done
exit & REM without /b, because this is a separate process
@GolezTrol
GolezTrol / Day11.bat
Created December 14, 2022 11:35
Advent of Code 2022 Day 11, Monkey business
@echo off
setlocal EnableDelayedExpansion
set debug=rem
REM Embed by clearing this variable and copying the contents of lib.bat to the end of this file
set lib=lib.bat
REM CONFIG
REM number of stacks supported
set maxstack=20
@GolezTrol
GolezTrol / Day9.bat
Created December 11, 2022 00:38
Advent of Code 2022 Day 9, Rope bridge Planck distance knotting. Somewhat animated
@echo off
setlocal EnableDelayedExpansion
REM MODIFY to tweak speed vs feedback
set feedback=5
REM 0 very little, 1 progress on found positions, 3 snapshot animation, 4 step animation, 5 with small delay, 6 with 1 sec delay per step
REM #$E# makes prompt echo the escape character, which is then captured and stored in a variable.
REM The escape is used for ANSI escape sequences for color an positioning
@GolezTrol
GolezTrol / Day5.bat
Created December 10, 2022 20:00
Advent of Code 2022 Day 5, batch file with ASCII art animation
@echo off
setlocal EnableDelayedExpansion
REM CONFIG
REM number of stacks supported
set maxstack=20
REM line on which to draw the stacks
set baseline=23
REM Offset from the left of drawing stacks
set lpad=5
@GolezTrol
GolezTrol / FizzBuzz.dpr
Created November 1, 2022 08:29
An FizzBuzz implementation in Delphi
program FizzBuzz;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils, System.Diagnostics;
begin
@GolezTrol
GolezTrol / FuzzyMatching.md
Last active June 1, 2021 03:25
Fuzzy matching algorithm for Delphi, originally inspired by Sublime

Fuzzy matching algorithm for Delphi/FreePascal

Returns if all characters of a given pattern are found in a string, and calculates a matching score Applies case insensitive matching, although case can influcence the score

Based on the C++ version by Forrest Smith: Original source, Blog

Adapted slightly for own use, especially:

  • Calculation corrected for double byte chars
@GolezTrol
GolezTrol / CrashingApp.dpr
Created October 3, 2020 12:02
Delphi JclCompressedDebug-1
program CrashingApp;
uses
SysUtils,
Dialogs,
JclDebug,
JclCompressedDebug;
function CrashString: String;
begin
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose