Skip to content

Instantly share code, notes, and snippets.

Avatar

Cédric Luthi 0xced

  • Fribourg, Switzerland
  • Twitter @0xced
View GitHub Profile
@0xced
0xced / CultureIcu.csproj
Created Aug 12, 2022
Playing around with App-local ICU
View CultureIcu.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<DebugType>embedded</DebugType>
@0xced
0xced / Program.cs
Created May 17, 2022
ASP.NET Core route template constraints
View Program.cs
using System;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.AspNetCore.Routing.Template;
using Microsoft.Extensions.DependencyInjection;
var provider = new ServiceCollection().AddRouting(_ => {}).BuildServiceProvider();
var templateBinderFactory = provider.GetRequiredService<TemplateBinderFactory>();
@0xced
0xced / .gitignore
Last active Apr 17, 2022
Graphing the .NET RID Catalog with Graphviz
View .gitignore
*.user
bin/
obj/
.idea/
.vs/
@0xced
0xced / README.md
Created Dec 13, 2021
Scaffold an EF Core DbContex with nullable reference types
View README.md
@0xced
0xced / IgnoreUpdates.m
Last active May 27, 2021
Trying to ignore the macOS Big Sur update (unsuccessfully)
View IgnoreUpdates.m
#import <Foundation/Foundation.h>
#import <sysexits.h>
/*
* Trying to bypass the fact that running `sudo /usr/sbin/softwareupdate --reset-ignored && sudo /usr/sbin/softwareupdate --ignore "macOS Big Sur"`
* does not work anymore on macOS Mojave 10.14.6 (ignored updates is empty) by using the underlying SoftwareUpdate framework directly.
* Unfortunately, this did not work as expected. The preference is written when this tool is run as root but opening the software update
* preference pane still displays the macOS Big Sur update :-(
*
* References
@0xced
0xced / EmbeddedPdbCostura.csproj
Last active Mar 3, 2021
Minimal project to test producing a single executable which embeds its dll files and its pdb
View EmbeddedPdbCostura.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
<DebugType>embedded</DebugType>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<GenerateSupportedRuntime>false</GenerateSupportedRuntime>
</PropertyGroup>
@0xced
0xced / Program.cs
Created Oct 16, 2020
dnlib experiment
View Program.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using dnlib.DotNet;
namespace assemblyref
{
class Program
{
@0xced
0xced / FodyWeavers.xml
Last active Sep 14, 2020
Single exe using Microsoft.EntityFrameworkCore.Sqlite on .NET Framework 4.7.2
View FodyWeavers.xml
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
</Weavers>
@0xced
0xced / Program.cs
Created Jul 3, 2020
Formatting of -0 in .NET Core
View Program.cs
using System;
using System.Globalization;
static class Program
{
private static void Main()
{
static string FormatCoordinate(double x, double y) => $"({x.ToString(NumberFormatInfo.InvariantInfo)},{y.ToString(NumberFormatInfo.InvariantInfo)})";
const double a = 0;
const double b = 0;
View .NET global tools (dotnet tool list -g)
Package Id Version Commands
-------------------------------------------------------------------------------------------
alias 0.1.3 assemblyalias
cake.tool 1.3.0 dotnet-cake
codecov.tool 1.13.0 codecov
csharprepl 0.3.4 csharprepl
diffenginetray 8.3.0 DiffEngineTray
docfx 3.0.0-beta1-1050-g0d0102792b docfx
dotnet-ef 6.0.0 dotnet-ef
dotnet-project-licenses 2.3.6 dotnet-project-licenses