Skip to content

Instantly share code, notes, and snippets.

View mrgrain's full-sized avatar
🤖

Momo Kornher mrgrain

🤖
View GitHub Profile
#!/usr/bin/env node
const { spawnSync } = require("node:child_process");
const fs = require("node:fs");
const os = require("node:os");
const path = require("node:path");
const spawny = (command, cwd) => {
rawny(command.split(" "), cwd);
}
#!/usr/bin/env node
const { spawnSync } = require("node:child_process");
const fs = require("node:fs");
const path = require("node:path");
const spawny = (command) => {
const [cmd, ...rest] = command.split(" ");
console.log(command);
spawnSync(cmd, rest, { stdio: 'inherit', cwd: process.cwd() });
@mrgrain
mrgrain / integ-runner.ts
Created February 23, 2023 12:11
projen IntegRunner
import { Component, DependencyType, typescript } from 'projen';
/**
* This component adds support for using `integ-runner` and `integ-tests`
* in a construct library.
*/
export class IntegRunner extends Component {
constructor(project: typescript.TypeScriptProject, cdkVersion: string) {
super(project);
@mrgrain
mrgrain / stringify.js
Created February 6, 2023 11:28
stringify javascript values with support for Symbols that will be rendered as is
function stringify(data, indentation = 2) {
if (typeof indentation === "number") {
return doStringify(data, 0, " ".repeat(indentation))
}
return doStringify(data, 0, indentation)
}
function doStringify(data, level = 0, idt = " ") {
import {
DefaultStackSynthesizer,
FileAssetLocation,
FileAssetSource,
} from 'aws-cdk-lib';
import { DefaultStackSynthesizerProps } from 'aws-cdk-lib/core/lib/stack-synthesizers/default-synthesizer';
import * as path from 'path';
export interface FileAssetSynthesizerProps
extends DefaultStackSynthesizerProps {}
From 7a780eed2b9020ccf67e0797e746c9a904370fc4 Mon Sep 17 00:00:00 2001
From: Momo Kornher <mail@moritzkornher.de>
Date: Wed, 19 Oct 2022 17:16:00 +0100
Subject: [PATCH] feat: csharp & fsharp
---
.../lib/runner/integration-tests.ts | 4 +-
.../integ-runner/lib/runner/runner-base.ts | 4 +-
.../test/test-data-csharp/.gitignore | 11 ++
.../test/test-data-csharp/IntegTestCsharp.cs | 20 ++++
@mrgrain
mrgrain / ideas.md
Last active October 24, 2023 16:58
Project ideas

cdk-alexa (CDK Construct)

Alexa, what's the easiest way to create a Skill?

  • Split out what I have for private project

dotjen

projen, but for dotfiles!

@mrgrain
mrgrain / workflow.yaml
Created May 26, 2022 02:21
GitHub Action to deploy files via ssh/rsync
name: Deploy via ssh
on:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
@mrgrain
mrgrain / pinentry-1password.sh
Last active February 28, 2024 16:55
1Password CLI pinentry for gpg-agent
#!/bin/sh
COMMAND="op read $OP_PIN_ITEM"
echo "OK"
while read cmd rest; do
echo "cmd=$cmd rest=$rest" >&2
echo "cmd=$cmd rest=$rest" >> $LOG
case "$cmd" in
\#*)
@mrgrain
mrgrain / do-something-lambda.ts
Created December 9, 2021 12:47
CDK abstraction example
import { TypeScriptCode } from "@mrgrain/cdk-esbuild";
import { Duration } from "aws-cdk-lib";
import { Rule, Schedule } from "aws-cdk-lib/aws-events";
import { LambdaFunction } from "aws-cdk-lib/aws-events-targets";
import { Function, Runtime } from "aws-cdk-lib/aws-lambda";
import { Bucket, IBucket } from "aws-cdk-lib/aws-s3";
import { Construct } from "constructs";
interface DoSomethingLambdaProps {
schedule: Schedule;