Skip to content

Instantly share code, notes, and snippets.

View ginokent's full-sized avatar
🏠
Working from home

ginokent ginokent

🏠
Working from home
View GitHub Profile
@ginokent
ginokent / README.md
Last active February 21, 2022 01:24

Benchmark comparison rec.go with major logger libraries.

Comparison of benchmark results

Benchmark results are compared using benchstat.

Output of log entries with common JSON log format:

log sample:

@ginokent
ginokent / benchmark_test.go.bash
Last active November 27, 2021 18:58
Go benchmark ベンチマーク 覚書
# 前準備
mkdir -p /tmp/benchmark
cd /tmp/benchmark
# ベンチマークファイル作成
tee /tmp/benchmark/benchmark_test.go <<"EOF"
package benchmark_test
import (
"strconv"
package main
import (
"log"
"net/http"
"github.com/gorilla/websocket"
)
var upgrader = websocket.Upgrader{} // use default options
package main
import (
"fmt"
"log"
"net"
"sync"
"time"
)
@ginokent
ginokent / tcpdump.sh
Created March 16, 2019 01:04
tcpdump 実行するときは思考停止でこれ
sudo tcpdump -G300 -W1 -vvv -l -n -p -s 65535 -w "$(uname -n)_%Y%m%dT%H%M%S.pcap"
@ginokent
ginokent / mysql-5.6.sh
Last active April 29, 2021 05:50
MySQL 5.6 on Ubuntu 16.04
#!/bin/bash
# MySQL 5.6 client libraries
# https://launchpad.net/ubuntu/xenial/amd64/libmysqlclient-dev/5.6.28-1ubuntu3
# https://launchpad.net/ubuntu/xenial/amd64/mysql-client-5.6/5.6.28-1ubuntu3
# https://launchpad.net/ubuntu/xenial/amd64/mysql-client-core-5.6/5.6.28-1ubuntu3
# https://launchpad.net/ubuntu/xenial/amd64/mysql-common/5.6.28-1ubuntu3
# https://launchpad.net/ubuntu/xenial/amd64/libmysqlclient18/5.6.28-1ubuntu3
# DEPRECATED https://launchpad.net/ubuntu/xenial/amd64/libdbd-mysql-perl/4.033-1
@ginokent
ginokent / tcpdump.sh
Last active March 14, 2019 07:13
tcpdump 時限開始 5分で終了
while sleep 1; do
date
if [ "$(date +%Y%m%dT%H%M)" = "20190314T1612" ]; then
sudo tcpdump -w $(uname -n)_%Y%m%dT%H%M%S.pcap -W1 -G300
fi
done
@ginokent
ginokent / s3-delete-bucket.py
Last active March 14, 2019 01:46
バージョニングが有効化されている S3 バケットの削除
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import boto3
from boto3.session import Session
boto3.set_stream_logger()
session = Session(profile_name='YOUR_AWS_PROFILE_NAME')
s3 = session.resource('s3')
@ginokent
ginokent / aws-boto3-profile.py
Last active March 14, 2019 01:40
boto3 で profile 名を指定して new client
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from boto3.session import Session
session = Session(profile_name='YOUR_AWS_PROFILE_NAME')
ec2 = session.client('ec2')
ec2.describe_instances()
@ginokent
ginokent / difff.sh
Last active March 16, 2019 01:01
color diff
difff() {(R=$(printf '\e[31m');G=$(printf '\e[32m');B=$(printf '\e[36m');W=$(printf '\e[1m');N=$(printf '\e[0m');diff -u "$@"|sed $(uname -s|grep -q '^Darwin'&&printf -- -E||printf -- -r) "s/(^@@.+@@|@@.+@@$)/$B\1$N/g;s/(^\+.*)$/$G\1$N/g;s/(^\-.*)$/$R\1$N/g;s/^[^\+\-]*((\+{3}|-{3}) [^ ].*)/$W\1/g;")}