Skip to content

Instantly share code, notes, and snippets.

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

Hiroki Yagita yagihiro

🏠
Working from home
View GitHub Profile
@yagihiro
yagihiro / contrast.py
Last active January 22, 2020 04:34
動画変換サンプルコード w/ opencv
import numpy as np
import cv2
import time
import sys
start_time = time.time()
input_path = sys.argv[1]
cap = cv2.VideoCapture(input_path)
@yagihiro
yagihiro / exponential_backoff_with_full_jitter.rb
Last active February 4, 2020 09:48
再送する時などに使用する Exponential Backoff の Ruby 実装です
# gem install retryable
require 'retryable'
# see: https://aws.typepad.com/sajp/2015/03/backoff.html
# ↑の full jitter back-off algorithm です
def with_retry
base = 1.0
cap = 12.0
Retryable.retryable(tries: 5, sleep: ->(n) { rand(base..([cap, base * (2 ** n)].min)) }) { yield }
@yagihiro
yagihiro / m1_setup.sh
Created November 12, 2021 18:10
M1 Mac Setup @ Monterey
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/yagihiro/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
brew install --cask google-chrome
brew install --cask google-japanese-ime
sudo softwareupdate --install-rosetta
brew install --cask google-japanese-ime
brew install --cask slack
brew install --cask docker