Skip to content

Instantly share code, notes, and snippets.

@kumakichi
kumakichi / dir2str.sh
Created December 19, 2021 11:58
pack direcotry to base64 string && unpack
#!/bin/bash
delim="#"
dirname=$(echo ${PWD##*/})
outname="${dirname}.tar.bz2"
tar cjf "$outname" *
base64Str=$(base64 "$outname" | tr -d '\n')
rm $outname
echo "${dirname}${delim}$base64Str"
@kumakichi
kumakichi / README.org
Created January 24, 2019 11:57
HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Bash
@kumakichi
kumakichi / merge-kube-configs.sh
Created May 28, 2021 01:44
merge multiple kubernetes configs
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 kubeconfigs-path"
exit
fi
kubeCfgPath="$1"
if [ ! -d "$kubeCfgPath" ]; then
echo "Directory '$kubeCfgPath' not exists"
@kumakichi
kumakichi / redis_pipeline_test.go
Last active May 20, 2021 09:25
test redis pipeline
package redis_pipeline_test
import (
"strconv"
"testing"
"time"
"github.com/go-redis/redis"
)
@kumakichi
kumakichi / download java from oracle without login.sh
Created July 25, 2020 03:55
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" 'https://download.oracle.com/otn-pub/java/jdk/14.0.2+12/205943a0976c4ed48cb16f1043c5c647/jdk-14.0.2_linux-x64_bin.tar.gz'
// or
curl -j -k -L -b "oraclelicense=accept-securebackup-cookie" 'https://download.oracle.com/otn-pub/java/jdk/14.0.2+12/205943a0976c4ed48cb16f1043c5c647/jdk-14.0.2_linux-x64_bin.tar.gz' -o jdk-14.0.2_linux-x64_bin.tar.gz
@kumakichi
kumakichi / realPath.go
Created November 26, 2019 06:11
get running executable file real path in golang
package main
import (
"log"
"os"
"path/filepath"
)
func main() {
ex, err := os.Executable()
@kumakichi
kumakichi / SimpleAuthServer.go
Last active April 29, 2016 06:50
A SimpleHTTPServer with authentication written in golang
package main
import (
"encoding/base64"
"fmt"
"net/http"
"os"
)
var (