Skip to content

Instantly share code, notes, and snippets.

View Stephanvs's full-sized avatar

Stephan van Stekelenburg Stephanvs

View GitHub Profile
@gdagley
gdagley / EventStack.ts
Created November 8, 2023 13:48
Simplify adding EventBus rules to SST
import {Config, EventBus, EventBusRuleProps, Queue, Stack, StackContext, Table} from "@serverless-stack/resources";
const snakeToCamel = (s: string) => s.replace(/(_\w)/g, k => k[1].toUpperCase());
const addBusinessRule = (stack: Stack, bus: EventBus, dlq: Queue, eventType: string) => {
const ruleKey = eventType.replace(".", "_");
const queueName = `${ruleKey}_queue`;
const handlerLambda = `functions/events/${snakeToCamel(ruleKey)}/handler.main`;
const rules: Record<string, EventBusRuleProps> = {};
@clemensv
clemensv / messaging-and-eventing-platforms.md
Created January 5, 2022 14:43
Elements of Messaging and Eventing Platforms
title
Elements of Messaging and Eventing Platforms

This document provides a brief overview of the essential elements of a messaging and eventing platform and how they relate to each other.

Message and Event Broker Categories

@davidfowl
davidfowl / Example.cs
Last active June 6, 2023 08:10
An implementation of MessagePipe. Something like a channel but with buffer management so you can peek and advance the message that was read.
using System.Buffers;
using System.Net.WebSockets;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/ws", async (HttpContext context) =>
{
const int MaxMessageSize = 1024 * 1024;
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
@ld100
ld100 / ArchLinuxWSL2.md
Last active November 14, 2024 09:14
Steps for setting up Arch Linux on WSL2

Migrating from Ubuntu on WSL to ArchLinux on WSL2

Obsolete notice

This document was created back in 2020 and might not be actual nowadays. It is not supported anymore, so use thise information at your own risk.

Upgrading to WSL 2

  • Download WSL2 Kernel
  • run wsl --set-default-version 2 in windows command line, so that all future WSL machine will use WSL2.
@troygibb
troygibb / mosaic-tab-panel-implementation.md
Last active March 31, 2021 02:47
Description of how we created tabs with react-mosaic

Motivation

Our product, Webviz, often finds itself short of real estate when users attempt to use an increasing number of panels. We also run into performance constraints when rendering so many panels, so we decided to implement tabbed panels to reduce both the visual and compute headaches!

Check out our release PR here to see the feature!

Challenges

The tiling library we rely on, react-mosaic, does not support tabs out of the box, but it does allow nested layouts! So we created a special kind of tile that would render nested layouts, and wrote a tab-like interface on top of it.

@DustinCampbell
DustinCampbell / using-msbuildworkspace.md
Created April 10, 2018 21:36
Using MSBuildWorkspace

Introduction

Roslyn provides a rich set of APIs for analyzing C# and Visual Basic source code, but constructing a context in which to perform analysis can be challenging. For simple tasks, creating a Compilation populated with SyntaxTrees, MetadataReferences and a handful of options may suffice. However, if there are multiple projects involved in the analysis, it is more complicated because multiple Compilations need to be created with references between them.

To simplify the construction process. Roslyn provides the Workspace API, which can be used to model solutions, projects and documents. The Workspace API performs all of the heavy lifting needed to parse SyntaxTrees from source code, load MetadataReferences, and construct Compilations and add references between them.

@varemenos
varemenos / 1.README.md
Last active October 23, 2024 13:07
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@yoichitgy
yoichitgy / genassetimages.sh
Created March 17, 2015 05:27
A script to generates iOS asset PNG images from a PSD file for @1x, @2x and @3x scales.
#!/bin/sh
#
# genassetimages.sh
# Generates iOS asset PNG images from a PSD file for @1x, @2x and @3x scales.
# ImageMagick is used to resize the images.
#
# settings ==========
outputDir="image_assets"
assetSuffixes=(".png" "@2x.png" "@3x.png")
@davidfowl
davidfowl / dotnetlayout.md
Last active November 13, 2024 13:19
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/