Skip to content

Instantly share code, notes, and snippets.

View decriptor's full-sized avatar

Stephen Shaw decriptor

View GitHub Profile
public static void Main()
{
// Load the source image and mask image
using Bitmap sourceImage = new Bitmap("path/to/source/image.png");
using Bitmap maskImage = new Bitmap("path/to/mask/image.png");
// Apply the mask
using Bitmap resultImage = ApplyMask(sourceImage, maskImage);
// Save the result
Param(
[Parameter(Mandatory=$true)]
[string]$SolutionFilePath
)
# Get all lines that start with "Project("
$projectLines = Get-Content $SolutionFilePath | Where-Object { $_ -match '^Project\(' -and $_ -match '\.csproj"' }
# Extract project names and paths
$projects = $projectLines | ForEach-Object {
@decriptor
decriptor / gist:b6a98784fdb5c20384e5391d0ada0517
Created February 18, 2023 03:33
ChatGPT explain Rocket Science
Explain rocket science to me like I was 9 years old
Rocket science is all about building machines that can fly really, really high and really, really fast! Just like how you can throw a ball really far, rockets have a special engine that shoots out hot gases to make them go really fast and really far into the sky. Rockets are used to send people and things into space, and explore planets and stars far, far away! It's kind of like a big, exciting adventure!
Even simpler
Rocket science is about building machines that can fly really high and really fast using special engines that shoot out hot gases. Rockets are used to explore space and go on big adventures!
@decriptor
decriptor / Day6_2022.cs
Last active December 6, 2022 16:56
Day6_2022
var file = @"c:\code\AoC\AoC2022\Day6\input.txt";
var message = File.ReadAllText(file).AsSpan();
var set = new HashSet<char>(4);
var part1 = FindUniqueSegment(message, 4);
var part2 = FindUniqueSegment(message, 14);
(part1 == 1760).Dump("Part 1");
(part2 == 2974).Dump("Part 2");
var file = @"d:\code\decriptor\input3.txt";
var input = File.ReadLines(file).ToArray();
var priority = 0;
var badgePriority = 0;
for(int i = 0; i < input.Count(); i += 3)
{
var input1 = input[i];
var input2 = input[i+1];
var path = @"D:\code\decriptor\input2.txt";
var lost = 0;
var draw = 3;
var won = 6;
var rock = 1; // A, X
var paper = 2; // B, Y
var scissors = 3; // C, Z
Foo.csproj:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Day12
{
class PlantGenerations
{
public string InitialState { get; }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks.Dataflow;
namespace SimpleProblems
{
class Program
{
static readonly IEnumerable<int> numbers = Enumerable.Range(1, 100);