Skip to content

Instantly share code, notes, and snippets.

@zhammer
zhammer / README.md
Last active November 15, 2021 21:33
localstack aws v2 dynamodb bug recreation and logs

localstack aws-sdk-go-v2 dynamodb bug

there may be a bug with managing dynamodb tables in localstack using aws-sdk-go-v2. my team stumbled upon this while migrating an application from aws-sdk-go v1 to v2.

reproduce

to reproduce this locally, run docker compose up to spin up localstack, then run go run main.go (either in a separate terminal, or in the same if docker compose is run in the background.)

main.go

  1. connects to localstack (success)
type Dashboard struct {
URL string `json:"url"`
Title string `json:"title"`
Widgets []Widget `json:"widgets"`
}
type Widget struct {
ID int64 `json:"id"`
Definition struct {
Type string `json:"type"`
@zhammer
zhammer / app.py
Last active May 29, 2020 14:22
dd-trace-py RuntimeWorker daemon bug repro
from __future__ import print_function
import logging
import ddtrace
# disable "ERROR [ddtrace.internal.writer] [writer.py:270] - Failed to send traces to Datadog Agent at http://localhost:8126"
logging.getLogger("ddtrace.internal.writer").setLevel(logging.CRITICAL)
def main():
with ddtrace.tracer.trace("app-main"):
import os
import re
import sys
from pathlib import Path
from typing import List, Tuple
import libcst as cst
from libcst import CSTVisitorT
@zhammer
zhammer / SketchSystems.spec
Last active August 1, 2019 15:20
Seller Verification
Seller Verification
Not Onboarded
Onboard -> Onboarded
Onboarded&
Sanctions
Pending Automated Check -
Fail automated check - -> Failed automated check -
Pass automated check - -> Approved -
Failed automated check -
Agent approve - -> Approved -
@zhammer
zhammer / machine.js
Created July 20, 2019 16:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
function useResettableState(initialState) {
const initialStateRef = useRef(initialState);
const [state, setState] = useState(initialState);
function resetState() {
setState(initialStateRef.current)
}
return [state, setState, resetState];
}
import { useState } from 'react';
type FocusProps = {
autoFocus: boolean;
onBlur: () => void;
onFocus: () => void;
};
/**
* Hook that provides props to focus an element on mount.
[
{
"key": "ctrl+x 2",
"command": "workbench.action.splitEditorDown"
},
{
"key": "ctrl+x 3",
"command": "workbench.action.splitEditorRight"
},
{
import json
from contextlib import contextmanager
from typing import Any, Callable, Dict, Generator, List, NamedTuple, Optional, Set, Tuple
from urllib.parse import urlparse, parse_qs
import requests
import responses
class Request(NamedTuple):