Skip to content

Instantly share code, notes, and snippets.

@marcojahn
marcojahn / PublishingArtifactsWithAWSCodeartifactAndGitHubPackages.md How to publish software artifacts with AWS Codeartifact and GitHub Packages
@marcojahn
marcojahn / update-asdf-plugins.sh
Created December 21, 2021 06:45 — forked from developer-guy/update-asdf-plugins.sh
Update asdf plugins to their latest versions if necessary
#!/usr/bin/env sh
function update() {
for i in `asdf plugin list`
do
CURRENT_VERSION=`asdf current $i | awk '{print $2}'`
LATEST_VERSION=`asdf latest $i`
echo "Working with $i current version $CURRENT_VERSION but latest version is $LATEST_VERSION"
if [[ $(semver_check $LATEST_VERSION $CURRENT_VERSION) -lt 0 ]]; then
echo "Needs to update"
@marcojahn
marcojahn / tag.sh
Created December 2, 2021 09:09 — forked from julienperon/tag.sh
This shell tags all resources in a bucket. This is meant to be used at deploy time with cdk in conjunction with a life cycle policy to avoid keeping useless files.
#!/usr/bin/env bash
# This script manages a simple tagging lifecycle: current -> previous -> outdated.
# It is meant to be used with a bucket lifecycle policy, in order to delete all outdated tags.
# Why ?
# The deployment bucket has to be cleaned regularly, otherwise it will become a mess.
# However, having a simple lifecycle policy based on time is dangerous
# Deleting old objects without a recent deployment can lead to deletion of currently used assets.
# In case of error in the next deployment, the stack will try to rollback and will not find assets
@marcojahn
marcojahn / delete_local_branches.sh
Created June 7, 2021 10:31 — forked from TSMMark/delete_local_branches.sh
Delete local branches that don't exist on remote/origin
git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -r -n 1 git branch -D
@marcojahn
marcojahn / iterm2-solarized.md
Created March 15, 2021 22:21 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@marcojahn
marcojahn / upload.js
Created March 11, 2021 07:23 — forked from tonkla/upload.js
Parsing 'multipart/form-data' Excel (.xlsx) with Busboy on AWS Lambda (Node.js)
'use strict'
const Busboy = require('busboy')
const XLSX = require('xlsx')
function parseMultipartFormData(input, contentType) {
return new Promise((resolve, reject) => {
const buffers = []
const busboy = new Busboy({
headers: { 'content-type': contentType },
@marcojahn
marcojahn / generate-docusaurus-sidebar.js
Created February 19, 2021 09:05 — forked from rudasn/generate-docusaurus-sidebar.js
Generate docusaurus sidebar from folder structure
//
// Generates a sidebar based on file structure and
// markdown frontmatter properties.
//
// ---
// title: My Cool Feature
// sidebar_label: Introduction
// ---
//
// sidebar_sort_order: the sort order of this page in the sidebar
@marcojahn
marcojahn / self-signed-certificate-with-custom-ca.md
Created October 17, 2018 10:56 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@marcojahn
marcojahn / objectdeepcopy.js
Created August 15, 2018 12:07 — forked from izy521/objectdeepcopy.js
`JSON.parse( JSON.stringify( obj) )` has been regarded as the fastest method for deep copying Objects, but is it? This is mainly just to test. Obviously Functions aren't allowed in JSON.
var Types = new Map();
Types.set(Array, function(v) {
var l = v.length; i = 0, a = Array(l);
for (i; i<l; i++) {
a[i] = v[i];
}
return a;
});
Types.set(Number, function(v) {
return v * 1;
@marcojahn
marcojahn / after.scenario.js
Created May 22, 2018 05:38 — forked from wswebcreation/after.scenario.js
Setup for attaching the difference to the Cucumber report file. This can be used with Protractor + CucumberJS + protractor-image-comparison
import { After, Status } from 'cucumber';
import { resolve } from 'path';
const fs = require('fs');
const diffFolder = resolve(process.cwd(), '.tmp/report/screenshots/image-comparison/diff/');
const screenshotFolder = resolve(process.cwd(), '.tmp/screenshots/');
/**
* The After hook that checks the scenario status and creates a
* screemshot if needed