Skip to content

Instantly share code, notes, and snippets.

@mrange
mrange / 0_README.md
Last active May 26, 2023 03:58
Happy little terminal shader

Install shader

  1. Save happy.hlsl to disk, note the path for later.
  2. Open Windows terminal settings
  3. Open settings as JSON
  4. Add a custom shader to the default profile, see excerpt below.
{
 "profiles": {
@mrange
mrange / build.cake
Last active October 8, 2022 19:38
Cake model update
#nullable enable
#addin nuget:?package=Cake.Git&version=2.0.0
var target = Argument("target", "GithubAction");
var repoUri = "https://github.com/mrange/cake.tool.experiments.git";
record BuildData(
DirectoryPath RootPath
, DirectoryPath GithubPath
, DirectoryPath RepoPath
@mrange
mrange / Microsoft.PowerShell_profile.ps1
Created September 28, 2022 07:55
mrange powershell prompt
# Stored under My Documents\WindowsPowerShell
function global:prompt
{
"╭─ PS $($executionContext.SessionState.Path.CurrentLocation) $('+' * ($nestedPromptLevel))`n╰─$ ";
}
@mrange
mrange / commit-msg
Created September 26, 2022 09:28
gerrit commit hook
#!/bin/sh
# From Gerrit Code Review 2.12.3
#
# Part of Gerrit Code Review (https://www.gerritcodereview.com/)
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@mrange
mrange / FsDistanceField.fsproj
Last active September 24, 2022 10:42
F# Distance Field
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
@mrange
mrange / 0_readme.md
Last active May 26, 2023 03:58
Reactor shader inspired by Microsoft Reactor Graphics. For us in windows terminal

Install shader

Note: Doesn't work on latest preview of windows terminal (2022-09-15) but should work on later previews.

  1. Save reactor.hlsl to disk, note the path for later.
  2. Open Windows terminal settings
  3. Open settings as JSON
  4. Add a custom shader to the default profile, see excerpt below.
@mrange
mrange / thindal.hlsl
Created September 11, 2022 10:38
Thindal Windows Terminal
#define WINDOWS_TERMINAL
Texture2D shaderTexture;
SamplerState samplerState;
// --------------------
#if defined(WINDOWS_TERMINAL)
cbuffer PixelShaderSettings {
float Time;
float Scale;
@mrange
mrange / 0_the_easy_way.cs
Last active January 1, 2024 22:12
Examples IEnumerable implementing a fibonacci series
// Example on the "easy" way to generate the fibonacci sequence
// https://en.wikipedia.org/wiki/Fibonacci_number
// Take the first 20 fibonacci numbers and print them
// the "easy" way.
foreach(var n in Fibonacci().Take(20))
{
Console.WriteLine(n);
}
namespace CsDI
{
partial record DI
{
IY? _singletonOf_IY;
IZ? _singletonOf_IZ;
public void Get(out IX v)
{
@mrange
mrange / GenAll.cs
Last active June 12, 2022 05:27
T4 template to generate all version of a model
namespace CsGenAll
{
using System.Diagnostics;
// BooleanValue - BEGIN
// Kind: IsEnum
public enum BooleanValue
{