Skip to content

Instantly share code, notes, and snippets.

View atruskie's full-sized avatar
🤨

Anthony Truskinger atruskie

🤨
View GitHub Profile
@atruskie
atruskie / AbstractNodeNodeTypeResolver.cs
Last active May 11, 2023 03:07
Inferring abstract/interface types for YamlDotNet Deserialization
using System;
using System.Collections.Generic;
using System.Linq;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NodeDeserializers;
namespace Egret.Cli.Models
{
@atruskie
atruskie / Program.cs
Created April 14, 2020 01:17
Test ImageSharp pixel blending
using System;
using System.IO;
using SixLabors.Fonts;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using Color = SixLabors.ImageSharp.Color;
using Pen = SixLabors.ImageSharp.Processing.Pen;
namespace ImageSharpTests
@atruskie
atruskie / Program.cs
Last active January 12, 2022 08:27
System.Drawing and SkiaSharp - fill blending via opacity channel for rgb (no alpha) image
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.Processing;
using SkiaSharp;
using System;
using System.IO;
namespace ConsoleApp1
@atruskie
atruskie / test.md
Created April 7, 2020 06:12
hard line break

Hello I am a single paragraph

I am another paragraph. There are no line breaks in me.

@atruskie
atruskie / template_strings.ts
Created January 22, 2020 04:16
Typescript: strongly typed, lazy evaluated, interpolated strings
let id = (x: number) => x;
let param = (x: string) => x;
type ParamType<T> = T extends (arg: infer R) => any ? R : never;
/**
* Templates a string by substituting placeholders for tokens later in execution.
* It is designed to work as the tag function for tagged interpolated strings.
* @returns A reusable template function that is statically checked for arity and
@atruskie
atruskie / terminal-keybind.ahk
Last active December 30, 2022 15:44
AutoHotkey script to bind Win+~ keyboard shortcut to Windows Terminal
#NoEnv
#SingleInstance force
SendMode Input
DetectHiddenWindows, on
SetWinDelay, 0
#`::
terminal := WinExist("ahk_exe WindowsTerminal.exe")
if (terminal)
{
@atruskie
atruskie / gist:91c299114038254cb88eb52f19e49352
Created April 11, 2019 11:43
Chocolatey Packages Statuses (Test)
empty
@atruskie
atruskie / Update-AUPackages.md
Last active November 16, 2024 00:06
Update-AUPackages Report #powershell #chocolatey
@atruskie
atruskie / README.md
Created April 10, 2019 07:06
Purposely corrupt a file for testing reasons (on Unix)

I'm testing file transfer methods (particularly to a SFTP remote).

In particular FileZilla does not detect corrupted files.

Use the above script to corrupt a remote file as a test.

If you are transferring files with rclone (https://rclone.org/) using the --checksums argument it will detect the fault and re-transfer the corrupt file.

@atruskie
atruskie / Contract.cs
Last active May 14, 2017 12:24
A dummy implementation of CodeContracts designed to be a signature-wise drop in replacement for common use cases
/// MIT License
/// Copyright (c) 2017 Anthony Truskinger
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///