Skip to content

Instantly share code, notes, and snippets.

View okazu-dm's full-sized avatar

Kazuma Okada okazu-dm

View GitHub Profile
@okazu-dm
okazu-dm / correct.rb
Created March 9, 2022 06:28
sinatra(classic style) + ddtrace sample code
# THIS WORKS
require 'ddtrace'
require 'sinatra'
Datadog.configure do |c|
c.use :sinatra
end
get '/' do
@okazu-dm
okazu-dm / rbenv_install.sh
Last active February 7, 2022 14:32
rbenv install script
sudo yum install -y git gcc openssl-devel readline-devel zlib-devel;
git clone https://github.com/rbenv/rbenv.git ~/.rbenv;
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile;
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile;
git clone https://github.com/rbenv/ruby-build.git "$($HOME/.rbenv/bin/rbenv root)"/plugins/ruby-build;
echo "============="
echo "exec $SHELL -l"
echo "curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash"
@okazu-dm
okazu-dm / loop.sh
Last active December 29, 2021 09:04
実行中にシェルスクリプト自体が書き換えられた際の挙動確認
#!/bin/bash
for i in {0..10}; do
echo "$i: old version"
if [ $i -eq 5 ]; then
cp loop_new.sh loop.sh
fi
sleep 1
done
window.setInterval(function() {
const trendElement = document.querySelector('[aria-label="タイムライン: トレンド"]');
if (trendElement) {
trendElement.remove();
}
}, 500);
@okazu-dm
okazu-dm / atocoder_notification.rb
Created May 5, 2020 12:18
notify AtCoder recent contest and update contest schedule
require 'faraday'
require 'nokogiri'
require 'json'
require 'time'
require 'dotenv'
Dotenv.load
DEBUG = !ENV['DEBUG'].nil?
@okazu-dm
okazu-dm / .gitconfig
Last active April 27, 2021 07:15
gitcofnig
[alias]
cb = rev-parse --abbrev-ref HEAD
p = ! git push origin $(git cb)
pl = ! git pull origin $(git cb)
merged = ! git branch --merged | grep -v '*'
dmerged = ! git pull --prune && git branch -d `git merged`
s = switch
@okazu-dm
okazu-dm / gcr-push
Last active November 1, 2019 03:40
GCRにpushするくん
#!/bin/bash -eu
GCR_HOST="asia.gcr.io"
image_name=$1
tag_name=${2:-latest}
project_id=${3:-$(gcloud config get-value project)}
if [ "-$image_name" == "-" ]; then
echo "usage: $0 image_name [tag_name] [project_id]" >/dev/null
exit 1
@okazu-dm
okazu-dm / exec_log
Last active June 5, 2019 05:18
特定のURLへアクセスした際に発生する通信のログ
[ 'https://github.com/',
'https://github.githubassets.com/assets/frameworks-41c2037bf12f1e46d8f08b88a04a8d8f.css',
'https://github.githubassets.com/assets/site-294181adec18ed639e160b96b45d17ac.css',
'https://github.githubassets.com/assets/github-5604f7ab2b481e74ad33491877db1226.css',
'https://github.githubassets.com/images/search-key-slash.svg',
'https://github.githubassets.com/images/modules/site/icons/play-button_white.svg',
'https://github.githubassets.com/images/modules/site/logos/airbnb-logo.png',
'https://github.githubassets.com/images/modules/site/logos/sap-logo.png',
'https://github.githubassets.com/images/modules/site/logos/ibm-logo.png',
'https://github.githubassets.com/images/modules/site/logos/google-logo.png',
@okazu-dm
okazu-dm / reish_build_osx.patch
Created June 2, 2018 04:23
Build Reish on my MBP
diff --git a/lib/reish/exenv.rb b/lib/reish/exenv.rb
index 6474995..1818a4b 100644
--- a/lib/reish/exenv.rb
+++ b/lib/reish/exenv.rb
@@ -120,7 +120,7 @@ module Reish
attr_reader :display_method
def display_mode=(opt)
- if i = IRB::INSPECTORS[opt]
+ if i = IRB::Inspector::INSPECTORS[opt]
@okazu-dm
okazu-dm / json_jruby.log
Created June 2, 2018 01:47
JSON with jruby 2.4.0.0
//-> % ruby --version
jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.152-b16 on 1.8.0_152-b16 +jit [darwin-x86_64]
// -> % ruby -rjson -e 'puts JSON(orig = 1 << 62)'
4611686018427387904
// -> % ruby -rjson -e 'puts JSON(orig = 1 << 63)'
Unhandled Java exception: java.lang.ClassCastException: org.jruby.RubyBignum cannot be cast to org.jruby.RubyFixnum
java.lang.ClassCastException: org.jruby.RubyBignum cannot be cast to org.jruby.RubyFixnum
generate at json/ext/Generator.java:224