Skip to content

Instantly share code, notes, and snippets.

View teneko's full-sized avatar

Teneko teneko

View GitHub Profile
@dfederm
dfederm / AsyncMutex.cs
Created November 3, 2022 06:44
AsyncMutex
public sealed class AsyncMutex : IAsyncDisposable
{
private readonly string _name;
private Task? _mutexTask;
private ManualResetEventSlim? _releaseEvent;
private CancellationTokenSource? _cancellationTokenSource;
public AsyncMutex(string name)
{
_name = name;
namespace System.Diagnostics.CodeAnalysis {
// Input: field, property, argument
// Output: field, property, argument, result
// AllowNull - Null input is allowed
// DisallowNull - Null input is disallowed
// MaybeNull - Output may be null
// MaybeNull/When - Output may be null (when result == true/false)
@dem1995
dem1995 / sd_video_ids_with_labels.txt
Created July 20, 2020 03:56
SupraDarky Channel Video IDs and Titles
6MQRL7xws7w - Best VGM 01 - Wild Arms - Town Theme
P8oefrmJrWk - Best VGM 02 - Metroid Prime - Ice Valley (Phendrana Deep Lake)
Y5HHYuQi7cQ - Best VGM 03 - Castlevania : Curse of Darkness - Garibaldi Courtyard
GBYsdw4Vwx8 - Best VGM 05 - Silent Hill 2 - Theme of Laura
iSP-_hNQyYs - Best VGM 06 - Chrono Trigger - Undersea Palace
AvlfNZ685B8 - Best VGM 07 - Chaos Legion - Feel No Fear (Sky Gallery)
AGWVzDhDHMc - Best VGM 08 - Shadow Hearts II : Covenant - Astaroth (Fallen Angel Battle)
DlcwDU0i6Mw - Best VGM 09 - Tribes 2 - Desert
jChHVPyd4-Y - Best VGM 11 - Zelda : Ocarina of Time - Song of Storms (Windmill Hut)
e9xHOWHjYKc - Best VGM 12 - Beyond Good & Evil - Home Sweet Home
@vtenq
vtenq / git-workflow.md
Last active April 19, 2024 07:53
Git workflow with conventional commits and semantic auto release

Git workflow with conventional commits and semantic auto release

This is an adoptation of Git flow by Vincent Driessen with conventional commits and semantic release.

The main concepts

At the core, the development model is greatly inspired by existing models out there. The central repo holds two main branches with an infinite lifetime:

@SteveSandersonMS
SteveSandersonMS / blazor-auth.md
Created June 11, 2019 10:49
Blazor authentication and authorization

Authentication and Authorization

Authentication means determining who a particular user is. Authorization means applying rules about what they can do. Blazor contains features for handling both aspects of this.

It worth remembering how the overall goals differ between server-side Blazor and client-side Blazor:

  • Server-side Blazor applications run on the server. As such, correctly-implemented authorization checks are both how you determine which UI options to show (e.g., which menu entries are available to a certain user) and where you actually enforce access rules.
  • Client-side Blazor applications run on the client. As such, authorization is only used as a way of determining what UI options to show (e.g., which menu entries). The actual enforcement of authorization rules must be implemented on whatever backend server your application operates on, since any client-side checks can be modified or bypassed.

Authentication-enabled templates for Server-Side Blazor

@SteveSandersonMS
SteveSandersonMS / sequence-number.md
Last active November 28, 2023 20:28
Why sequence numbers should relate to code line numbers, not execution order

Why sequence numbers should relate to code line numbers, not execution order

Or in other words, why you should hard-code sequence numbers, and not generate them programmatically.

Unlike .jsx files, .razor/.cshtml files are always compiled. This is potentially a great advantage for .razor, because we can use the compile step to inject information that makes things better or faster at runtime.

A key example of this are sequence numbers. These indicate to the runtime which outputs came from which distinct and ordered lines of code. The runtime uses this information to generate efficient tree diffs in linear time, which is far faster than is normally possible for a general tree diff algorithm.

Example

<!--Works-->
<Image Source="resm:CrossTestAppAvalonia.Images.info2_blue.png" Width="32" Height="32" Margin="5"/>
<!--Works-->
<Image Source="resm:CrossTestAppAvalonia.Images.warning2_yellow.png" Width="32" Height="32" Margin="5"/>
<!--Works-->
<TextBox Name="textbox" Margin="5">
<i:Interaction.Behaviors>
<ia:DataTriggerBehavior Binding="{Binding MyProperty.Boolean}" ComparisonCondition="Equal" Value="true">
<ia:ChangePropertyAction TargetObject="{Binding #textbox}" PropertyName="Text" Value="info2_blue.png" />
@LGM-AdrianHum
LGM-AdrianHum / JunctionPoint.cs
Last active April 16, 2023 18:27
Create, Delete and Examine Junction Points in C#
// File: RollThroughLibrary/CreateMaps/JunctionPoint.cs
// User: Adrian Hum/
//
// Created: 2017-11-19 2:46 PM
// Modified: 2017-11-19 6:10 PM
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
@hurricane-voronin
hurricane-voronin / README.md
Last active May 10, 2024 16:59
Naming Classes Without a 'Manager'
@Holger-Will
Holger-Will / jwtRS256.sh
Last active May 6, 2024 00:35
generate public private key pair (RSA RS256) for use with koa-jwt jasonwebtoken etc.
# generate private key
openssl genrsa -out private.pem 2048
# extatract public key from it
openssl rsa -in private.pem -pubout > public.pem