Skip to content

Instantly share code, notes, and snippets.

View Eun's full-sized avatar
💭
I may be slow to respond.

Tobias Salzmann Eun

💭
I may be slow to respond.
View GitHub Profile
@Eun
Eun / Code.gs
Last active January 12, 2023 10:24
simple google apps script router that routes based on `path` url query
const router = Router();
router.Method("GET", "/", function(req, vars) {
return {"status": "ok"};
});
router.Method("GET", "/?<id>[A-Za-z0-9]+)", function(req, vars) {
return {"status": "ok", "id": vars.id};
});
router.Method("POST", "/", function(req, vars) {
@Eun
Eun / database.go
Last active February 21, 2024 10:53
testcontainers-go with postgres
// usage:
// testDB := testhelpers.NewTestDatabase(t)
// defer testDB.Close(t)
// println(testDB.ConnectionString(t))
package testhelpers
import (
"context"
"fmt"
"testing"
@Eun
Eun / avn-pg
Last active July 6, 2021 16:56
connect to an aiven postgres database with ease
#!/bin/bash
set -euo pipefail
######################################################
## REQUIREMENTS
## * proper configured and running avn cli: (https://github.com/aiven/aiven-client)
## * installed fzf (https://github.com/junegunn/fzf)
## * installed jq (https://github.com/stedolan/jq)
## * docker
######################################################
## CHANGE BELOW IF NECESSARY
@Eun
Eun / selectgo
Last active March 25, 2021 11:14
selectgo
# add this to your config.fish
# make sure your $HOME looks like
# ls /home/tobias/go
# go1.14.6/ go1.15.2/ go1.15.4/ go1.16/
function selectgo
set -l GOVERSIONS
pushd $HOME/go/
for f in go*
set -l LINE $f
@Eun
Eun / kubesh
Last active February 11, 2020 08:57
kubesh
#!/bin/bash
if [ ${#@} -lt 1 ]; then
echo "usage: kubesh <pod> [shell]"
exit 1
fi
SHELL="sh"
if [ ${#@} -gt 1 ]; then
SHELL=${@:2}
fi
kubectl exec -ti ${1} ${SHELL}
@Eun
Eun / gocross-alpine
Created October 9, 2018 10:33
cross compile golang using alpine
#!/bin/bash
PWD=$(pwd)
if [ -n "${PWD##*$GOPATH*}" ]; then
echo "$PWD not in $GOPATH"
exit 1
fi
P=${PWD:${#GOPATH}}
@Eun
Eun / DisableDVR.reg
Created August 4, 2017 08:19
Disable DVR
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\System\GameConfigStore]
"GameDVR_Enabled"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\GameDVR]
"AllowGameDVR"=dword:00000000
@Eun
Eun / gist:aa7300176fc36a385e468d3c90f222a0
Last active July 25, 2017 07:00
go trace for executable
{
f, err := os.Create("trace.out")
if err != nil {
panic(err)
}
err = trace.Start(f)
if err != nil {
panic(err)
}
@Eun
Eun / StartAndAttachDebugger.reg
Last active November 29, 2016 12:41
StartAndAttachDebugger
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell\StartAndAttachDebugger]
@="Start and Attach Debugger"
"Icon"="vsjitdebugger.exe"
"Extended"=""
[HKEY_CLASSES_ROOT\exefile\shell\StartAndAttachDebugger\command]
@="powershell Start-Process \"vsjitdebugger.exe\" -Verb runAs -ArgumentList \"%1 %*\""
@Eun
Eun / project.csproj
Created November 16, 2016 10:02
ILMerge AfterBuild
<Target Name="AfterBuild" Condition="'$(Configuration)'=='Release'">
<CreateItem Include="$(SolutionDir)\packages\ILMerge.*\tools\ILMerge.exe">
<Output TaskParameter="Include" ItemName="ILMergeExe" />
</CreateItem>
<Error Text="@(ILMergeExe) does not exists" Condition="!Exists('@(ILMergeExe)')" />
<CreateItem Include="@(ReferencePath)" Condition="'%(CopyLocal)'=='true'">
<Output TaskParameter="Include" ItemName="ILMergeAssemblies" />
</CreateItem>
<Delete Files="$(OutputPath)\ILMerge.log" Condition="Exists('$(OutputPath)\ILMerge.log')" />
<Exec Command="&quot;@(ILMergeExe)&quot; /ndebug /log:$(OutputPath)\ILMerge.log /out:@(MainAssembly) &quot;@(IntermediateAssembly)&quot; @(ILMergeAssemblies-&gt;'&quot;%(FullPath)&quot;', ' ')" />