Skip to content

Instantly share code, notes, and snippets.

@shirou
shirou / open_in_tmux.sh
Created June 4, 2020 00:13
Open file from other window
alias coder="VSCODE_IPC_HOOK_CLI=`ls --sort=time /tmp/vscode-ipc-* | head -n 1` `ls ~/.vscode-server/bin/*/bin/code | head -1`"
@shirou
shirou / dictionary.md
Last active June 3, 2020 13:06
opentelemtry翻訳一時的置き場

辞書

  • document
    • 文章
  • context
    • コンテキスト
  • context propagation
    • コンテキスト伝搬
  • Metrics
  • メトリック
@shirou
shirou / display.sh
Created April 25, 2020 12:41
how to enable high resolution display with Ubuntu 20.04 on VirtualBox
# change your display setting in VirtualBox to VBoxVGA
# execute 'cvt 2560 1360' to get the newmode line
xrandr --newmode "2560x1360_60.00" 293.50 2560 2744 3016 3472 1360 1363 1373 1410 -hsync +vsync
xrandr --addmode VGA-1 "2560x1360_60.00"
xrandr --output VGA-1 --mode 2560x1360_60.00
# 2560x1400 is not working for me with below error and I don't know why
#
import sys
import cv2
def sliding_window(image, stepSize, windowSize):
for y in range(0, image.shape[0], stepSize):
for x in range(0, image.shape[1], stepSize):
# yield the current window
yield (x, y, image[y : y + windowSize[1], x : x + windowSize[0]])
#!/usr/bin/env python3
import sys
import os
import unicodedata
from tempfile import NamedTemporaryFile
def is_nfd(line):
for char in line.strip():
@shirou
shirou / dummy.go
Last active October 19, 2019 13:13
marketstore dummy plugin
package main
import (
"context"
"math/rand"
"time"
)
// DummySubscriber is an dummy
type DummySubscriber struct {
@shirou
shirou / race_pipe.go
Last active April 21, 2019 05:52
go version go1.11.1 linux/amd64 build with `go build -race`
package main
import (
"bytes"
"context"
"fmt"
"os/exec"
)
// copied from internal/common/common.go
package info.tdoc.spring.example.tracer;
import io.opencensus.trace.Tracing;
import io.opencensus.trace.Tracer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.resource.jdbc.spi.StatementInspector;
import io.opencensus.trace.AttributeValue;
import org.springframework.stereotype.Component;
package main
import (
"fmt"
"github.com/shirou/gopsutil/disk"
)
func main() {
parts, err := disk.Partitions(true)
@shirou
shirou / ssm-connect.sh
Last active October 21, 2020 05:21
connect instance via ssm selecting with peco
#!/bin/bash
# fetch Inventory from SSM
INVENTORY=$(aws ssm get-inventory --output json | jq -r '.Entities[].Id' )
# select with Tag.Name by peco
EC2=$(aws ec2 describe-instances --instance-ids $INVENTORY --output json --query 'Reservations[].Instances[*].{Id:InstanceId,Name:Tags[?Key==`Name`].Value}' | jq -r '.[][0] | (.Id) + " " + (.Name[0])' | peco)
# parse instance-id
INSTANCE_ID=$(echo ${EC2} | cut -f 1 -d " ")