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

Keyboards

Planck

2022-04-01 Planck

Preonic

2022-04-01 Preonic

Message Types

Reference: Metering service APIs - Microsoft commercial marketplace

https://docs.microsoft.com/en-us/azure/marketplace/marketplace-metering-service-apis#metered-billing-batch-usage-event

Inconsistency in request data structures for "Marketplace metered billing APIs", between managed apps and SaaS offers

  • When submitting a single event, the payload only seems to contain a resourceId, and the note says that resourceId has different meaning for SaaS app and for Managed app emitting custom meter.", being a resourceGroupID for managed apps, and the SaaS subscription GUID for SaaS.
@chgeuer
chgeuer / create_json_functionally.md
Last active November 19, 2021 22:35
Creates a JSON structure in the shell

A purely functional JSON processing pipeline using jq in bash

It starts with an empty JSON object, and each jq step in the pipeline further augments the structure. In case you want to step-by-step build up a JSON string in a shell.

How does it work

The --arg binds a string variable from bash to the jq-variable x.

The jq expression ($x | fromjson) parses the string into whatever JSON would be appropriate. So the bash variable true becomes the proper true boolean in the JSON. If we only would use $x (instead of ($x | fromjson)), the bash variable true would become the JSON string "true".

#r "nuget: Thoth.Json.Net, 7.1.0"
open Thoth.Json.Net
type Foo =
{ Name: string
Age: int }
module Encoders =
let fooDecoder : Decoder<Foo> =
@chgeuer
chgeuer / main.rs
Created September 14, 2021 09:43
Strike Training Solution
// My solution to https://strikecommunity.azurewebsites.net/articles/8612/course-introduction-to-the-rust-programming-langua-1.html
use std::collections::HashMap;
fn main() -> Result<(), std::io::Error> {
let mut arguments = std::env::args().skip(1);
let k = arguments.next().unwrap();
let v = arguments.next().unwrap();
let mut db = Database::from_disk("kv.db")?;
@chgeuer
chgeuer / DownloadBlobsToMemory.cs
Created September 2, 2021 06:36
A gazillion ways to download a blob
using System;
using System.IO;
using System.Threading.Tasks;
using Azure;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
static class Program
{
// https://github.com/Azure/azure-sdk-for-net/issues/22022
#!/bin/bash
mkdir device server
cd device
# Create a key pair
openssl genrsa -out device-priv.pem 2048

Regex

[\+\(]?\d[\(\)\-\d\ ]+

Demo text