Skip to content

Instantly share code, notes, and snippets.

@peterhirn
peterhirn / FakeFirestoreClient.fs
Last active January 9, 2022 20:42
F# Fake Firestore Client
open System
open System.Linq
open System.Reflection
open System.Collections.Generic
open System.Threading
open System.Threading.Tasks
open Grpc.Core
open Google.Protobuf
open Google.Cloud.Firestore
@peterhirn
peterhirn / .gitlab-ci.yml
Last active January 8, 2022 18:04
Run evolve and pgTAP in Gitlab CI (shared runner ~45sec.)
stages:
- test
test:
image: postgres:14.1-bullseye
stage: test
services:
- name: postgres:14.1-bullseye
alias: db
variables:
@peterhirn
peterhirn / msi.fsx
Last active November 29, 2021 19:04
F# ProductCode from msi
/// F# impl. of https://stackoverflow.com/a/19765999/16368506
module private Msi =
open System
open System.Text
open System.Runtime.InteropServices
open Microsoft.Win32.SafeHandles
[<Literal>]
let private MsiDll = "msi.dll"
open System.Text.Json
open System.Text.Json.Serialization
open MathNet.Spatial.Euclidean
let private convertName (options : JsonSerializerOptions) : string -> string =
match options.PropertyNamingPolicy with
| null -> id
| policy -> policy.ConvertName
let private readOrFail (reader : Utf8JsonReader byref) =
@peterhirn
peterhirn / script.sh
Created August 22, 2020 06:57
Create osslsigncode compatible key/certificate from .pfx
openssl pkcs12 -in authenticode.pfx -nocerts -nodes -out key.pem
openssl pkcs12 -in authenticode.pfx -nokeys -nodes -out cert.pem
openssl rsa -in key.pem -outform DER -out authenticode.key
openssl crl2pkcs7 -nocrl -certfile cert.pem -outform DER -out authenticode.spc
# Encode to store in CI environment variables
base64 authenticode.key > authenticode.key.txt
base64 authenticode.spc > authenticode.spc.txt