Skip to content

Instantly share code, notes, and snippets.

@springcomp
springcomp / TableStorage.Utils.cs
Created October 16, 2019 09:03
Simple wrapper class for performing strongly-typed CRUD operations against an Azure Storage Table
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos.Table;
using Microsoft.Extensions.Logging;
namespace SpringComp.TableStorage.Utils
{
public class TableEntityStore<T> where T : TableEntity, new()

README.md

The following tools use the machine-wide certificate store.

Other tools have specific instructions:

@springcomp
springcomp / Date Time Regex
Last active November 9, 2021 21:55
A regex to parse gregorian date/times with leap year support
https://stackoverflow.com/questions/48352672/what-is-a-regular-expression-for-matching-numbers-divisible-by-4
years mod 400: (?<by400>\d[02468]00)
years mod 100: (?<by100>\d\d00)
years mod 4: (?<by4>\d\d(?:(?:[02468][048])|(?:[13579][26])))
years mod 4 (excluding mod 100): (?<by4>\d\d(?:(?:[02468][48])|(?:[2468][048])|(?:[13579][26])))
years (all others): (?<by1>\d{4})
year: (?<by400>\d[02468]00)|(?<by100>\d\d00)|(?<by4>\d\d(?:(?:[02468][48])|(?:[2468][048])|(?:[13579][26])))|(?<by1>\d{4})
test:
2000
interface IMap { [key: string]: string };
class TaskIdentifiersImpl implements IMap {
[name: string | symbol]: string;
private static indexHandler: ProxyHandler<TaskIdentifiersImpl> = {
get(target, property) {
return target[property];
},
set(target, property, value): boolean {
target[property] = value;
@springcomp
springcomp / README.md
Last active January 19, 2023 13:14
Installing Docker and Kubernetes for WSL2 without Docker Desktop

Overview

This file outlines the steps taken to install and run Docker on Windows (WSL2) without Docker Desktop. To mimic the existing experience, those steps will guide you through creating a separate Linux distribution to host the Docker engine.

Download and install Linux distro from tarball

Distribution Location
@springcomp
springcomp / README.md
Last active January 24, 2023 08:25
Azure API Management `foreach-` PowerShell scripts

Those scripts allow to perform an operation (a script block) to every item in Azure API Management. Supported scripts are:

  • foreach-api.ps1
  • foreach-api-operation.ps1
  • foreach-product.ps1

Those scripts call the following more general - albeit slightly more complex - script:

  • foreach-apim-object.ps1
@springcomp
springcomp / JMESPath.ebnf
Last active April 10, 2023 10:19
EBNF grammar for JMESPath
<expression> ::= <sub_expression>
| <index_expression>
| <comparator_expression>
| <list_filter_expression>
| <or_expression>
| <identifier>
| <and_expression>
| <not_expression>
| <paren_expression>
| <multi_select_list>
@springcomp
springcomp / JSON.ebnf
Created August 19, 2022 14:01
EBNF grammar for JSON
<quoted_string> ::= <quote> ( <unescaped_char> | <escaped_char> )+ <quote>
<escaped_char> ::= <escape> ( "\"" | "/" | "b" | "f" | "n" | "r" | "t" | <unicode> | <escape> )
<escaped_literal> ::= <escaped_char> | <escape> "`"
<unescaped_char> ::= <digit> | <letter> | " " | "!" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*+" | "," | "-" | "." | "/" | ":" | ";" | "<" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "`" | "{" | "|" | "}" | "~"
<unescaped_literal> ::= <digit> | <letter> | " " | "!" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*+" | "," | "-" | "." | "/" | ":" | ";" | "<" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "{" | "|" | "}" | "~"
<unicode> ::= "u" <digit> <digit> <digit> <digit>
<escape> ::= "\\"
@springcomp
springcomp / to-pypi.sh
Created February 26, 2023 17:02
Upload Package to PyPI
#!/bin/bash
rm -rf dist/
python setup.py sdist
python setup.py bdist_wheel
## username: __token__
## password: API Key token
twine upload --repository testpypi dist/*
@springcomp
springcomp / regexes.md
Created July 12, 2023 13:24
Useful Regexes

C# TimeSpan

([0-9]+\.)?([0-1][0-9]|2[0-3])(:([0-4][0-9]|5[0-9])){2}(\.[0-9]{7})?