Skip to content

Instantly share code, notes, and snippets.

View ProphetLamb's full-sized avatar

ProphetLamb ProphetLamb

View GitHub Profile
@ProphetLamb
ProphetLamb / AsyncStreamBufferWriter.cs
Last active November 17, 2023 15:20
Queues non-blocking synchronous writes to an asynchronous only Stream.
using System.Buffers;
using System.Diagnostics;
using System.Threading.Channels;
namespace System.Buffers;
/// <summary>
/// Queues non-blocking synchronous writes to an asynchronous only <see cref="Stream"/>.
/// </summary>
/// <remarks>
@ProphetLamb
ProphetLamb / PooledChunks.cs
Created October 25, 2023 13:57
Stack-like datastructure with a pool bound data source
internal sealed class PooledChunks<T> : IDisposable, IReadOnlyList<T>, ICollection<T>
{
private readonly List<ArraySegment<T>> _chunks = new();
private int _count;
public PooledChunks() : this(null) { }
public PooledChunks(ArrayPool<T>? pool)
{
@ProphetLamb
ProphetLamb / poeninja_gem_leveling_profit_analyzer.py
Created May 21, 2023 21:30
Queries poe.ninja to obtain the difference in price between a unleveled and leveled gem
import pandas as pd
import requests
def get_listings() -> list:
# load json https://poe.ninja/api/data/itemoverview?league=Crucible&type=SkillGem&language=en
# format:
# {
# "lines": [
# {"id":96951,"name":"Awakened Enlighten Support","icon":"https://web.poecdn.com/gen/image/WzI1LDE0LHsiZiI6IjJESXRlbXMvR2Vtcy9TdXBwb3J0L1N1cHBvcnRQbHVzL0VubGlnaHRlbnBsdXMiLCJ3IjoxLCJoIjoxLCJzY2FsZSI6MX1d/7ec7d0544d/Enlightenplus.png","levelRequired":80,"variant":"5/23c","itemClass":4,"sparkline":{"data":[],"totalChange":0},"lowConfidenceSparkline":{"data":[0,0,9.56,9.56,63.25,83.88,47.33],"totalChange":47.33},"implicitModifiers":[],"explicitModifiers":[{"text":"This Gem gains 115% increased Experience","optional":false}],"flavourText":"","corrupted":true,"gemLevel":5,"gemQuality":23,"chaosValue":69159.71,"exaltedValue":4749.98,"divineValue":309.29,"count":3,"detailsId":"awakened-enlighten-support-5-23c","listingCount":3}
# ],
@ProphetLamb
ProphetLamb / lang_spec.txt
Last active April 24, 2023 17:41
Fun little functional language specification
# types are infered by default
let variable = "string \n with escapes"
# variables are immutable
let variable = 'string without escaped'
# variables shadow eachother localized to the scope
let variable = `string with ${variable} $interpolation`
# anonymous object
# type can be specified aswell
let variable: Any = { }
# cast of a Any variable is either the target Str or Nil
@ProphetLamb
ProphetLamb / netstd-compat-matrix.md
Created April 18, 2023 10:13
Netstandard compatibility matrix

Netstandard compatibility matrix

Netstandard .NET .NET Framework Mono
1.0 $\ge 1.0$ $\ge 4.5$ $\ge 4.6$
1.1 $\ge 1.0$ $\ge 4.5$ $\ge 4.6$
1.2 $\ge 1.0$ $\ge 4.5.1$ $\ge 4.6$
1.3 $\ge 1.0$ $\ge 4.6$ $\ge 4.6$
1.4 $\ge 1.0$ $\ge 4.6.1$ $\ge 4.6$
1.5 $\ge 1.0$ $\ge 4.6.2$ ($4.6.1^1$) $\ge 4.6$
@ProphetLamb
ProphetLamb / remap-caps-escape-win10.reg
Last active January 10, 2023 17:24
Remapps the capslock key to escape in Windows10
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,46,00,01,00,3a,00,00,00,00,00
module Edgerunning.System
import Edgerunning.Logging.*
public class LaunchCycledRecoverHumanityRequest extends ScriptableSystemRequest {}
public class EdgerunningRecoverySystem extends ScriptableSystem {
// ------------------------------------------
// Fields
// ------------------------------------------
@ProphetLamb
ProphetLamb / 1_install_arch.sh
Created September 4, 2022 20:28 — forked from dylanbmorgan/1_install_arch.sh
Install arch zen on btrfs on luks with rEFInd bootloader
#!/bin/bash
# usage: ./arch_install.sh <cpu> <gpu> <install_disk> <swapfile [y/n]>
trap "exit" INT
# Set for different systems
if [[ $1 == "amd" ]]; then
ucode=amd-ucode
elif [[ $1 == "intel" ]]; then
ucode=intel-ucode
@ProphetLamb
ProphetLamb / newpipe-playlist.py
Created August 30, 2022 07:45
Create a temporary youtuble playlist from NewPipe exported database
#!/usr/bin/env python3
import typing as t
import click
import lxml.html as xaml
import pandas as pd
import requests as req
import sqlite3
def extract_csv(db_file: str) -> pd.DataFrame:
conn=sqlite3.connect(db_file)
@ProphetLamb
ProphetLamb / BenchmarkIntegerPowCastVsBitwise.cs
Last active August 1, 2022 14:09
Explorative Benchmarks comparing the established integer->float->pow->integer cast approach to computing `a^n` against a bitwise iterative approach in 32, 64 and native width.
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
Benchmark.RngSeed = Environment.TickCount;
BenchmarkRunner.Run<Benchmark>();