Skip to content

Instantly share code, notes, and snippets.

View marcusirgens's full-sized avatar

Marcus Pettersen Irgens marcusirgens

View GitHub Profile
<?php
/**
* Catch any exceptions, log them and rethrow the exception
*
* @see \Vendor\Library\Class::sendRequest()
* @param $subject
* @param callable $next
* @param mixed ...$args
* @return mixed
* @throws \Throwable
@marcusirgens
marcusirgens / throwaway-postgres.zsh
Last active October 21, 2020 14:43
Create a throwaway postgres instance
function throwaway-postgres() {
local port
port="$((RANDOM%1000+40000))"
docker info >/dev/null || return 1
if ! docker run \
--rm \
--detach \
// Code generated by openapi-embed. DO NOT EDIT.
package {{.PackageName}}
import (
"embed"
"io/fs"
)
//go:embed {{.Filename}}
@marcusirgens
marcusirgens / medicine.go
Last active December 22, 2023 21:57
Generate random medicine names
package main
import (
"crypto/rand"
"encoding/json"
"fmt"
"log"
"math/big"
"net/http"
"os"