This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# slow query のみ抽出 & 整形 | |
head -500 /var/log/mongodb/mongod.log |\ | |
jq -c 'select(.msg == "Slow query" and .attr.type == "command") | { collection: (.attr.command.find // .attr.command.aggregate // .attr.command.mapReduce), durationMillis: .attr.durationMillis, count: 1 } | select(.collection != null)' \ | |
> work-0 | |
# slow query の集計 | |
cat work-0 |\ | |
jq -s -c 'group_by(.collection) | .[] | reduce .[] as {$collection,$durationMillis,$count} (null; .collection = $collection | .durationMillis += $durationMillis | .count += $count)' \ | |
> work-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
base_dir=$(cd "$(dirname $0)" && pwd) | |
proj_dir=$(pwd) | |
prefix=${prefix:-"ss"} | |
version=${version:-"20190529-1356"} | |
echo "pwd: $proj_dir" | |
cd $proj_dir | |
rm -rf private public | |
tar xf $proj_dir/,memo/$prefix-files-$version.tar.bz2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 使用方法: | |
# bundle exec rails runner all_contents_download.rb www > all_contents.csv | |
# | |
site = Cms::Site.find_by(host: ARGV[0]) | |
exporter = Cms::AllContent.new(site: site) | |
enumerable = exporter.enum_csv(encoding: "Shift_JIS") | |
enumerable.each do |csv| | |
STDOUT.write csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SHIRASAGI OAuth 2.0 IdP 機能を利用したサンプルプログラム | |
# このサンプルでは jwt 拡張フローを用います。 | |
# | |
# 実行方法 | |
# bin/rails runner oauth2_sample_with_jwt_flow.rb | |
# ドメイン | |
your_domain = "https://localhost:3551/" | |
# トークンエンドポイントの URL | |
token_url = URI.join(your_domain, "/.mypage/login/oauth2/token") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SHIRASAGI OAuth 2.0 IdP 機能を利用したサンプルコード | |
# このサンプルでは implicit flow を用います。 | |
# | |
# 実行方法 | |
# bin/rails runner oauth2_sample_with_implicit_flow.rb | |
# ドメイン | |
your_domain = "https://localhost:3551/" | |
# 認可エンドポイントの URL | |
authorize_url = URI.join(your_domain, "/.mypage/login/oauth2/authorize") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:text/html,<html contenteditable> <script>window.onbeforeunload=function(){ return "%E9%96%89%E3%81%98%E3%81%BE%E3%81%99%E3%81%8B%EF%BC%9F" }</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew doctor で sudo xcode-select --install を実行しろと表示され実行するものの、また sudo xcode-select --install を実行しろと言われる場合: | |
次のコマンドを実行する | |
xcodebuild -runFirstLaunch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
以下のコマンドを実行した後で bundle install を実行する | |
bundle config build.debase --with-cflags="-Wno-error=implicit-function-declaration" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 少し凝った zshrc | |
# License : MIT | |
# http://mollifier.mit-license.org/ | |
######################################## | |
# 環境変数 | |
#export LANG=ja_JP.UTF-8 | |
#export PATH="/usr/local/opt/imagemagick@6/bin:$PATH" | |
#export PATH="/usr/local/opt/mongodb-community@4.2/bin:$PATH" | |
#export PATH="/usr/local/sbin:$PATH" |
NewerOlder