Skip to content

Instantly share code, notes, and snippets.

@Makeshift
Makeshift / tutorial.md
Last active April 26, 2025 08:15
Tutorial for automatically syncing an Obsidian vault with Git on an Android device

How to sync Obsidian with Git on Android

Limitations

  • If Termux is closed in the background by Android, the cron service will stop updating your repository and you must open Termux again. Refer to instructions for your device model to disable the killing of certain background applications.
  • This may negatively affect your devices battery life. I'm not entirely sure yet.

Setup

@davidfowl
davidfowl / .NET6Migration.md
Last active April 11, 2025 11:12
.NET 6 ASP.NET Core Migration
@davidfowl
davidfowl / MinimalAPIs.md
Last active March 16, 2025 16:47
Minimal APIs at a glance
@richlander
richlander / modernizing-csharp9.md
Last active April 26, 2024 17:14
Modernizing a codebase for C# 9

Modernizing a codebase for C# 9

There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull example requires it.

Use the property pattern to replace IsNullorEmpty

Consider adopting the new property pattern, wherever you use IsNullOrEmpty.

string? hello = "hello world";
public abstract class HostedService : IHostedService
{
private Task _executingTask;
private CancellationTokenSource _cts;
private object serviceProvider;
protected HostedService(object serviceProvider)
{
this.serviceProvider = serviceProvider;
}
@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

@kenichi-shibata
kenichi-shibata / gke_helpers.sh
Last active January 31, 2021 14:10
gke command line tool for setting up kubeconfig automatically on your google account
#https://unix.stackexchange.com/questions/276471/piping-a-command-through-a-color-filter
# more info using man terminfo
function black() { tput setaf 0; cat; tput sgr0; }
function red() { tput setaf 1; cat; tput sgr0; }
function green() { tput setaf 2; cat; tput sgr0; }
function yellow() { tput setaf 3; cat; tput sgr0; }
function blue() { tput setaf 4; cat; tput sgr0; }
function magenta() { tput setaf 5; cat; tput sgr0; }
function cyan() { tput setaf 6; cat; tput sgr0; }
function white() { tput setaf 7; cat; tput sgr0; }
@ststeiger
ststeiger / RSAKeys.cs
Created October 25, 2018 11:29 — forked from therightstuff/RSAKeys.cs
Import and export RSA Keys between C# and PEM format using BouncyCastle
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{
@rmoff
rmoff / docker-compose.yml
Last active June 2, 2024 17:14
Docker-Compose for Kafka and Zookeeper with internal and external listeners
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka: