Skip to content

Instantly share code, notes, and snippets.

@yamachu
Created November 8, 2023 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamachu/d65ca3ddb277633d0e2e92f511a3f589 to your computer and use it in GitHub Desktop.
Save yamachu/d65ca3ddb277633d0e2e92f511a3f589 to your computer and use it in GitHub Desktop.
ISUCONでインスタンスに入った後にコピペしたりcurlで引っ張ってくるいつものMakefieのGitHub CLIに限定した部分を公開
# >() がbashじゃないと使えないので
SHELL=/bin/bash
# Issue番号は用途によって分けているけど、とりあえずDB周りは1
ISSUE=1
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md#official-sources
gh:
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
# isucon11qの接続パラメータであるため、今後いい感じにする
mysql/client:
@mysql -h 127.0.0.1 -P 3306 -u isucon isucondition -pisucon
# echoを見せているのは、どんなクエリ投げたっけを見るためにしてる
mysql/query: QUERY=
mysql/query:
echo "$(QUERY)" | $(MAKE) mysql/client
mysql/query/gh: QUERY=
mysql/query/gh:
$(MAKE) mysql/query QUERY="$(QUERY)" | tee >(gh issue comment $(ISSUE) -F -)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment