Skip to content

Instantly share code, notes, and snippets.

View chgeuer's full-sized avatar
🏠
Working from Düsseldorf

Dr. Christian Geuer-Pollmann chgeuer

🏠
Working from Düsseldorf
View GitHub Profile

A simple .NET Core 8 sample running on Linux to show AES GCM encryption...

using System.Security.Cryptography;
using System.Text;

// https://learn.microsoft.com/en-us/dotnet/standard/security/cross-platform-cryptography#authenticated-encryption
Console.Out.WriteLine($"Is supported: {AesGcm.IsSupported}");
/*
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.64.0" />

Wetterdaten

Mix.install([
  {:req, "~> 0.5.6"},
  {:explorer, "~> 0.9.0"},
  {:kino_explorer, "~> 0.1.21"},
  {:iconv, "~> 1.0"},
  {:floki, "~> 0.36.2"}
])

Livebook on WSL2

Compile Erlang and Elixir from scratch

Install Linux dependencies

  • autoconf
  • automake
  • build-essential
  • gcc

Entra Domain Discovery

Mix.install([
  # {:ex_token_toys, path: "C:\\github\\chgeuer\\ex_token_toys"}
  {:ex_token_toys, github: "chgeuer/ex_token_toys"}, 
  {:kino, "~> 0.12.3"}
])

Sample integrating Bandit and Req/Finch

Mix.install([
  {:finch, "~> 0.17.0"},
  {:req, "~> 0.4.8"},
  {:bandit, "~> 1.1"}
])

A notebook to use the local MSAL cache to talk to Azure

Mix.install([
  {:jason, "~> 1.4"},
  {:jsonrs, "~> 0.3.3"},
  {:req, "~> 0.4.8"},
  {:jose, "~> 1.11"},
  {:jose_utils, "~> 0.4.0"},
  {:explorer, "~> 0.7.2"},
unsafe static byte[] DoublesToBytes(double[] value)
{
var bytes = new byte[8*value.Length];
fixed (byte* b = bytes)
{
for (int i = 0; i < value.Length; i++)
{
var v = value[i];
*((int*)(b + 8*i)) = *(int*)&v;
*((int*)(b + 8*i+4)) = *(((int*)&v) + 1);