Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Truskinger atruskie

View GitHub Profile
@atruskie
atruskie / AbstractNodeNodeTypeResolver.cs
Last active Sep 25, 2021
Inferring abstract/interface types for YamlDotNet Deserialization
View AbstractNodeNodeTypeResolver.cs
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 Apr 14, 2020
Test ImageSharp pixel blending
View Program.cs
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 Jul 16, 2021
System.Drawing and SkiaSharp - fill blending via opacity channel for rgb (no alpha) image
View Program.cs
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 Apr 7, 2020
hard line break
View test.md

Hello I am a single paragraph

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

@atruskie
atruskie / template_strings.ts
Created Jan 22, 2020
Typescript: strongly typed, lazy evaluated, interpolated strings
View template_strings.ts
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 Sep 23, 2021
AutoHotkey script to bind Win+~ keyboard shortcut to Windows Terminal
View terminal-keybind.ahk
#NoEnv
#SingleInstance force
SendMode Input
DetectHiddenWindows, on
SetWinDelay, 0
#`::
terminal := WinExist("ahk_exe WindowsTerminal.exe")
if (terminal)
{
@atruskie
atruskie / Update-AUPackages.md
Last active Sep 26, 2021
Update-AUPackages Report #powershell #chocolatey
View Update-AUPackages.md
@atruskie
atruskie / README.md
Created Apr 10, 2019
Purposely corrupt a file for testing reasons (on Unix)
View README.md

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
A dummy implementation of CodeContracts designed to be a signature-wise drop in replacement for common use cases
View Contract.cs
/// 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:
///