Skip to content

Instantly share code, notes, and snippets.

View t0yv0's full-sized avatar

Anton Tayanovskyy t0yv0

View GitHub Profile
/*
Add an option to ProgramTest framework to allow testing a Pulumi program against mock providers that
replay conversations from a previous run. Think of this as a useful way to test that P->P' program updates behave
identically in a quick-and-easy way.
- Unlike vanilla ProgramTest, on a warm cache the test does not touch the cloud.
- Unlike testing with mocks, there is no need to write mocks. Just record a successful run of the program.
@t0yv0
t0yv0 / .gitignore
Last active October 27, 2022 15:41
Pulumi Command CopyFile replacements
*.pyc
venv/
rsa
rsa.pub
@t0yv0
t0yv0 / .gitignore
Last active October 27, 2022 14:38
precompiled
@t0yv0
t0yv0 / pulum_10890.log
Created September 30, 2022 20:43
pulumi_10890.log
I0930 16:39:26.624970 6791 backend.go:461] found username for access token
I0930 16:39:27.051280 6791 util.go:557] errors detecting git metadata: 1 error occurred:
* detecting Git remote URL: could not read origin information: remote not found
I0930 16:39:27.052175 6791 backend.go:461] found username for access token
I0930 16:39:27.163292 6791 ignore.go:44] Explicitly ignoring and discarding error: could not read origin information: remote not found
I0930 16:39:27.274070 6791 backend.go:461] found username for access token
I0930 16:39:27.273620 6791 backend.go:1018] Stack dev being updated to version 103
I0930 16:39:27.491770 6791 update.go:190] *** Starting Update(preview=true) ***
I0930 16:39:27.491985 6791 plugins.go:120] gatherPluginsFromProgram(): gathering plugins from language host
@t0yv0
t0yv0 / MyStack.cs
Created November 24, 2021 23:21
Reproduce NPE in Pulumi .NET SDK
/*
To reliably hit the race NullPointerException with Pulumi, modify Pulumi.Core Resource.cs constructor to introduce a delay:
+ System.Threading.Thread.Sleep(100);
+ System.Console.WriteLine($"Delaying resource: {name}");
Deployment.InternalInstance.ReadOrRegisterResource(this, remote, urn => new DependencyResource(urn), args, options);
*/
@t0yv0
t0yv0 / main.go
Created March 18, 2021 15:42
Cost of embedding Go structs with methods
TBD
(*
# Setup.fsx
Adds registry keys for proper F# Web project support.
**Problem**: pure-F# Web projects do not work well in Visual Studio by default,
in particular adding a new item to the project is not possible.
**Solution**: This will hopefully be addressed in future VS versions.
@t0yv0
t0yv0 / Clone.fs
Created June 3, 2014 04:52
Generic clone recipe with Infers.
module Main
open Infers
open Infers.Rep
type SimpleRecord = { Name: string; Age: int }
type LotsOfRecords = { People: SimpleRecord [] }
type Cloneable<'T> =
| C of ('T -> 'T)
(*
Towards verifying message-passing protocols.
Protocol typically involves two parties, let us call Client and Server,
a number of states and state transitions involving passing of messages.
Client has agency - non-deterministic process in process calculi.
Server is deterministic, but it should handle all possible clients.
Ideally, we would take a DSL for the protocol, and spit out F# code that
module M =
[<PrivateRecordConstructor>] // how about F# had something like this?
type Config =
{
A: string
B: string
// ...
}