Skip to content

Instantly share code, notes, and snippets.

View babarot's full-sized avatar
:octocat:
Work Hard

Masaki ISHIYAMA babarot

:octocat:
Work Hard
View GitHub Profile
package main
import (
"errors"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
)
func main() {
Output afx.gif
# Set Theme "Builtin Solarized Dark"
Set FontSize 55
Set Width 2400
Set Height 800
Type "afx install"
Enter
@babarot
babarot / gocover.sh
Created February 16, 2023 01:28
Get go test coverage and open it in browser
#!/bin/bash
out=/tmp/cover.out
html=/tmp/cover.html
go test -cover ./... -coverprofile=$out
go tool cover -html=$out -o $html
open $html
sleep 1
rm $out $html
@babarot
babarot / tmuxx.sh
Created March 11, 2022 15:18
tmux executor
#!/bin/bash
# is_login_shell returns true if current shell is first shell
is_login_shell() {
[[ $SHLVL == 1 ]]
}
# is_git_repo returns true if cwd is in git repository
is_git_repo() {
git rev-parse --is-inside-work-tree &>/dev/null
#!/bin/bash
if ! type sd &>/dev/null; then
echo "sd: command not found" >&2
exit 1
fi
case "${#}" in
0)
echo "too few arguments" >&2
@babarot
babarot / gcp-context
Last active February 28, 2022 07:32
Get current GCP project name / Kubernetes context which you are on.
#!/bin/bash
if ! type jq &>/dev/null; then
echo "jq: not found" >&2
exit 1
fi
if ! type gcloud &>/dev/null; then
echo "gcloud: not found" >&2
exit 1
@babarot
babarot / migrate.sh
Created February 28, 2020 04:00
migrate rego file
for policy in $@
do
if [[ $policy == *_test.rego ]]; then
continue
fi
if [[ $policy == *.rego ]]; then
file=${policy##*/}
mkdir -p .policy/rego/prc/"${file%*.rego}"
git mv $policy .policy/rego/prc/"${file%*.rego}"/src.rego
@babarot
babarot / dockerfile-parser.go
Created February 3, 2020 11:07
Test for parsing Dockerfile
package main
import (
"io"
"os"
"github.com/k0kubun/pp"
"github.com/moby/buildkit/frontend/dockerfile/instructions"
"github.com/moby/buildkit/frontend/dockerfile/parser"
)
@babarot
babarot / README.md
Last active February 11, 2020 07:38
test

action-opa

Run opa test command with GitHub Actions

You can use the fixed version from: Releases

@babarot
babarot / pien
Last active February 11, 2020 16:07
pien
pien