Skip to content

Instantly share code, notes, and snippets.

View kemokemo's full-sized avatar
🎮
ebiten is awesome

kemokemo kemokemo

🎮
ebiten is awesome
View GitHub Profile
@kemokemo
kemokemo / checkout.ps1
Created June 18, 2024 14:07
Interactive git operations on the PowerShell
git branch -a | fzf | % { git checkout $_.Trim() }
@kemokemo
kemokemo / get-free-port.go
Last active January 18, 2023 08:00
Get free port sample. Respect to https://github.com/phayes/freeport.
package main
import (
"fmt"
"net"
)
// GetFreePort returns the available port of the local environment.
func GetFreePort() (int, error) {
addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
@kemokemo
kemokemo / say.cs
Created February 18, 2022 06:46
PowerShellスクリプトからC#コードを使う例
using System;
public static class Speaker
{
public static void Say(string word)
{
char[] trimChars = {'/'};
word = word.TrimEnd(trimChars);
Console.WriteLine(word + "!");
}
@kemokemo
kemokemo / jenkins-influxdb-telegraf.md
Created September 26, 2021 03:56
jenkins metrics collecting sample

WIP

docker run -name jenkins -p 8080:8080 -p 50000:50000 -d jenkins:2.60.3
docker create network jenkins-net
docker run --name influxdb --net jenkins-net -p 8086:8086 -d influxdb:2.0.8
docker run --net jenkins-net -d telegraf
@kemokemo
kemokemo / colored-out.go
Last active August 7, 2020 04:49
A golang sample with colored terminal output. Cross-platform support, of course.
package main
import (
"fmt"
"github.com/fatih/color"
"github.com/mattn/go-colorable"
)
var out = colorable.NewColorableStdout()
@kemokemo
kemokemo / gorp-db.sh
Last active January 19, 2020 15:33
docker run script to test go-gorp/gorp
#!/bin/bash
# PostgreSQL
docker run --name pggorp -e POSTGRES_USER=posuser -e POSTGRES_PASSWORD=pospass -e POSTGRES_INITDB_ARGS="--encoding=UTF-8 --locale=C" -p 5432:5432 -d postgres:latest
# MySQL
docker run --name gorp-mysql -e MYSQL_ROOT_PASSWORD=gorptest -e MYSQL_DATABASE=gorptest -e MYSQL_USER=gorptest -e MYSQL_PASSWORD=gorptest -d -p 3306:3306 mysql:latest
@kemokemo
kemokemo / htmldiff.go
Created November 22, 2019 03:57
html diff sample using "documize/html-diff"
package main
import (
"fmt"
"log"
htmldiff "github.com/documize/html-diff"
)
var (
@kemokemo
kemokemo / insert-sample.go
Last active November 4, 2019 02:15
A sample to insert a comment into the Postgre database using gorp.
package main
import (
"database/sql"
"log"
"os"
"time"
"github.com/go-gorp/gorp"
@kemokemo
kemokemo / install-vscode-ext.sh
Last active October 14, 2019 05:30
memo to backup and restore the vscode extensions.
code --install-extension Arjun.swagger-viewer
code --install-extension be5invis.vscode-icontheme-nomo-dark
code --install-extension bungcip.better-toml
code --install-extension darkriszty.markdown-table-prettify
code --install-extension donjayamanne.githistory
code --install-extension dracula-theme.theme-dracula
code --install-extension eamodio.gitlens
code --install-extension esbenp.prettier-vscode
code --install-extension jebbs.plantuml
code --install-extension kenhowardpdx.vscode-gist
@kemokemo
kemokemo / go-petstore.sh
Last active February 2, 2019 09:19
openapi generator #1869
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"