Skip to content

Instantly share code, notes, and snippets.

View NickDarvey's full-sized avatar

Nick Darvey NickDarvey

  • Melbourne, Australia
View GitHub Profile
@NickDarvey
NickDarvey / init.ps1
Last active July 3, 2023 09:50
VB6 on Windows 11
# Depends on
# ./msadc/msadcf.dll # https://stackoverflow.com/a/54931661/1259408
# ./msadc/msadcfr.dll
# ./msadc/msadcs.dll
# ./msvcrt/msvcrt20.dll # from a Windows 7 installation, for Crystal Reports only
# ./vb6/vb98ent.stf # attached in this gist, customizable with acost.exe
# ./vb6/vb6_1.iso # https://archive.org/download/en_vb6_ent_cd
# ./vb6/vb6_2.iso
# ./vb6/vb6_sp6.iso # https://my.visualstudio.com/downloads 'visual studio 6.0'
# ./vb6/updates/* # e.g. VB60SP6-KB2708437-x86-ENU.msi, VB60SP6-KB3096896-x86-ENU.msi
@NickDarvey
NickDarvey / stack.fs
Created March 20, 2022 23:31
Deploy FSharp.AWS.DynamoDB record schema to DynamoDB with AWS CDK
namespace Stacks
open FSharp.AWS.DynamoDB
open Amazon.CDK
open Amazon.CDK.AWS.DynamoDB
open State
type StateProps
@NickDarvey
NickDarvey / migrate.fsx
Created March 18, 2022 04:54
Deploy FSharp.AWS.DynamoDB record schema to DynamoDB
#r "nuget: FSharp.AWS.DynamoDB, 0.9.3-beta"
#r "nuget: AWSSDK.DynamoDBv2"
#load "../../server/src/Features/Conversations/State.fs"
open FSharp.AWS.DynamoDB
open Amazon.DynamoDBv2
open Amazon.Runtime
open Features.Conversations.State
@NickDarvey
NickDarvey / schema.json
Last active February 15, 2022 01:30
Verida credential schema test
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://gist.githubusercontent.com/NickDarvey/aa55096620a22368a5c442f5eb913c6b/raw/ff351942113edeb5d3d00da8ed6489e0917a69d8/schema.json",
"title": "Work-at-height Accreditation",
"titlePlural": "Work-at-height Accreditations",
"type": "object",
"database": {
"name": "credential"
},
"layouts": {
@NickDarvey
NickDarvey / SSMParameterReader.fs
Created November 18, 2021 03:30
Cross-region reading of SSM parameter values.
open Constructs
open Amazon.CDK.CustomResources
type SSMParameterReaderProps
(
ParameterName : string,
Region: string
) =
member _.ParameterName = ParameterName
name: Updating customXmlParts
description: Issue
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Word.run(async (context) => {
@NickDarvey
NickDarvey / DelegateResult.fs
Last active October 14, 2020 06:27
DelegateResult, an IActionResult useful for Azure Functions
open Microsoft.AspNetCore.Mvc
type DelegateResult(write : Stream -> System.Threading.Tasks.Task, encoding : System.Net.Http.Headers.MediaTypeHeaderValue, status : int) =
interface IActionResult with
member this.ExecuteResultAsync(ctx) =
ctx.HttpContext.Response.StatusCode <- status
ctx.HttpContext.Response.ContentType <- encoding.ToString ()
write ctx.HttpContext.Response.Body
open System.Text.Json
@NickDarvey
NickDarvey / arm-template.json
Last active September 9, 2020 08:24
Deploy an Azure Role Assignment to grant a User-Assigned Managed Identity access to Storage Account
// Based on https://docs.microsoft.com/en-us/azure/role-based-access-control/role-assignments-template#resource-scope
[
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"name": "[variables('myStorageAccountName')]",
"location": "[variables('location')]",
"sku": {
"name": "Standard_LRS"
},
@NickDarvey
NickDarvey / PointedList.fs
Last active August 21, 2020 06:45
PointedList: a list with a focus element
/// A list with a focus element.
/// Inspired by https://stackoverflow.com/a/38970195/1259408
/// Based on https://github.com/jeffwheeler/pointedlist/blob/master/Data/List/PointedList.hs
type PointedList<'a> =
private PointedList of
LeftsRev : 'a list
* Focus : 'a
* Rights : 'a list
with
@NickDarvey
NickDarvey / ReactiveLazyComponent.fs
Created May 25, 2020 01:46
Bolero (and Blazor and Elmish) and Rx.NET lazy component
open Bolero
open Elmish
open System.Reactive.Disposables
open System.Reactive.Subjects
type ReactiveLazyComponent<'model, 'event, 'msg>() =
inherit Bolero.ElmishComponent<'model, 'msg>()
let subject = new Subject<'event>()
let observer = subject :> IObserver<_>
let observable = subject :> IObservable<_>