Skip to content

Instantly share code, notes, and snippets.

View michaelwittig's full-sized avatar

Michael Wittig michaelwittig

View GitHub Profile
@michaelwittig
michaelwittig / lambda.js
Created October 11, 2023 07:47
Build code for inline CloudFormation Lambda functions (can be used with CDK)
function zipFile(lambdaFile) {
return esbuild.buildSync({
entryPoints: [`lambda/${lambdaFile}`], // your path might be different
external: ['@aws-sdk/*'],
target: ['node18'],
platform: 'node',
bundle: true,
write: false,
treeShaking: true
}).outputFiles[0].text;
@michaelwittig
michaelwittig / cfn-template-diff.js
Created October 11, 2023 07:45
Diff two CloudFormation YAML templates
// dependencies
// npm i yaml-cfn
// npm i jest-diff
// usage: node cfn-template-diff.js a.yaml b.yaml
const {yamlParse} = require('yaml-cfn');
const {readFileSync} = require('node:fs');
const {diff} = require('jest-diff');
@michaelwittig
michaelwittig / mp42gif.sh
Created March 11, 2021 12:11 — forked from troyane/mp42gif.sh
See script and documentation here: https://github.com/troyane/StackOverflow-pro/tree/master/mp42gif Script to convert MP4 file to GIF (via ffmpeg). It creates intermediate custom color palette out of input video file and use it for resulting GIF for better picture quality. For more info see https://superuser.com/a/556031
#!/bin/bash
#
# Script to convert MP4 video to GIF with generation of custom color palette.
#
#=== Do not touch code below
# Inner variables
input_file=""
input_fps="20"
input_height="512"
// script
import {
DynamoDBClient,
UpdateItemCommand,
paginateScan
} from '@aws-sdk/client-dynamodb';
async function updateItem(dynamodb, id) {
return dynamodb.send(new UpdateItemCommand({
TableName: 'table-name',

Keybase proof

I hereby claim:

  • I am michaelwittig on github.
  • I am michaelwittig (https://keybase.io/michaelwittig) on keybase.
  • I have a public key ASA0Z_YOphx6BNo_fnVk1ws7F05Y3k0RkxLUFZFEsG7FnQo

To claim this, I am signing this object:

@michaelwittig
michaelwittig / rmS3.js
Created November 13, 2015 07:59
Delete all keys / versions from S3 bucket without API throtteling (flow control)
var MAX_CONCURRENT_API_CALLS = 12;
var BUCKET = "bucket-name";
var AWS = require("aws-sdk");
var s3 = new AWS.S3();
var async = require("async");
var queue = async.queue(function(task, cb) {
console.log(task.action);
if (task.action === "list") {
@michaelwittig
michaelwittig / policy.json
Created August 7, 2015 21:09
IAM policy to allow role delegation only with MFA
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Action": [
"sts:AssumeRole"
],
"Resource": "*",