Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Stevie-O
Stevie-O / tslater-aoc-2023-day16b.linq
Last active December 17, 2023 19:01
Caching solution for AOC 2023 day 16
#load "C:\Users\Stevie-O\Documents\LINQPad Queries\advent-of-code\common\aoc-input-util.linq"
#load "C:\Users\Stevie-O\Documents\LINQPad Queries\advent-of-code\common\aoc-parsers.linq"
const string EXAMPLE_1 = @"
.|...\....
|.-.\.....
.....|-...
........|.
..........
.........\
@Stevie-O
Stevie-O / aoc-2023-day14-state-compressor.cs
Created December 14, 2023 21:17
aoc-2023-day14-state-compressor
enum RockType { None, Round, Cube }
interface IPlatformState
{
int Width { get; }
int Height { get; }
RockType GetRockAt(int row, int col);
}
@Stevie-O
Stevie-O / aoc-2023-day6-solver.pgm
Created December 8, 2023 00:59
AOC 2023 Day 6 Intcode solver
1101,0,0,3,109,842,21101,822,0,1,21101,832,0,2,21101,21,0,0,1105,1,215,1201,1,0,820,21101,832,0,1,21101,842,0,2,21101,40,0,0,1105,1,215,2008,820,1,45,1106,0,678,21001,822,0,1,21001,832,0,2,21101,62,0,0,1105,1,95,202,1,821,821,101,-1,820,820,101,1,48,48,101,1,52,52,1005,820,47,21001,821,0,1,21101,92,0,0,1105,1,536,104,10,99,109,11,21201,-9,1,-8,22202,-10,-10,-7,22102,-4,-9,-6,22201,-7,-6,1,1207,1,1,118,1105,0,685,21101,127,0,0,1105,1,344,21202,1,-1,-5,22201,-10,-5,1,21101,142,0,0,1105,1,407,21201,1,0,-4,1202,-4,-1,152,21201,-10,0,-3,22202,-4,-3,-2,2207,-2,-8,163,1106,0,172,21201,-4,1,-4,1105,1,146,21201,-3,0,-1,1202,-1,-1,182,21201,-10,0,-3,22202,-1,-3,-2,2207,-2,-8,193,1105,0,202,21201,-1,1,-1,1105,1,176,21202,-4,-1,-10,22201,-1,-10,-10,109,-11,2105,1,0,109,7,21101,0,0,-3,1201,-6,0,293,1101,229,0,304,21101,0,0,-4,21101,0,0,-2,203,-1,1208,-1,10,244,1105,0,269,1207,-1,48,251,1105,0,260,2107,57,-1,258,1106,0,305,1005,1,237,1206,-2,237,1105,1,283,2201,-3,-2,274,1106,0,237,1206,-2,335,1101,335,0,304,2007,293,-5,28
@Stevie-O
Stevie-O / aoc-2022-day19-refined.linq
Created December 19, 2022 22:34
Solution to AOC 2022 Day 19 Part 1
<Query Kind="Program">
<Namespace>System.ComponentModel</Namespace>
<Namespace>System.Collections.Immutable</Namespace>
</Query>
#load "../common/aoc-input-util.linq"
#load "../common/aoc-parsers.linq"
void Main()
{
@Stevie-O
Stevie-O / elfcom-display-contrary-part2.S
Created December 10, 2022 22:14
ElfCom program for AOC 2022 Day 10 (part 2). Initial value for X must be set to 3.
addx -2
addx 6
addx 2
addx -2
addx 6
noop
noop
noop
noop
addx 6
@Stevie-O
Stevie-O / elfcom-display-contrary-part1.S
Created December 10, 2022 21:50
ElfCom program for AOC 2022 Day 10 (part 2). Initial value for X must be set to 3.
addx -2
addx 6
addx 2
addx -2
addx 6
addx 2
addx -2
addx 6
addx 2
addx -2
@Stevie-O
Stevie-O / elfcom-code-display-feelings-1.S
Last active December 10, 2022 22:15
ElfCom program for AOC 2022 Day 10. Initial value for X must be set to 2.
addx 1
addx 4
noop
noop
addx 3
addx -1
addx 5
addx -1
addx 6
addx 1
@Stevie-O
Stevie-O / getbroadcastaddr.pl
Created July 2, 2021 17:11
Perl script for getting the broadcast address from an IP address and netmask
#!/usr/bin/perl -s
our $v;
use Socket qw/inet_ntoa inet_aton/;
if (@ARGV[0] =~ s#(/\d+)$##) { $ARGV[1] = $1; }
@ARGV >= 2 or die "Usage: perl $0 <address> <netmask>\n
netmask may be of the form '255.255.255.0' or '/24'
<Query Kind="Program">
<NuGetReference>Microsoft.Build</NuGetReference>
<NuGetReference>Microsoft.Build.Framework</NuGetReference>
<NuGetReference>Microsoft.Build.Tasks.Core</NuGetReference>
<NuGetReference>Microsoft.Build.Utilities.Core</NuGetReference>
<NuGetReference>Microsoft.CodeAnalysis.CSharp</NuGetReference>
<NuGetReference>Microsoft.CodeAnalysis.CSharp.Workspaces</NuGetReference>
<NuGetReference>Microsoft.CodeAnalysis.Workspaces.MSBuild</NuGetReference>
<NuGetReference>NuGet.Build.Tasks</NuGetReference>
<NuGetReference>System.ValueTuple</NuGetReference>