Skip to content

Instantly share code, notes, and snippets.

@GitSumito
GitSumito / file0.txt
Created December 21, 2017 13:23
Pythonでparse_args後、ハイフンからアンダーバーに置き換わる。 ref: https://qiita.com/S-T/items/49febd9488a49efd8c9c
Example execution:
python mailer.py --query-id 2226 --query-api-key 6764573853b4065aac3258b8c7bc561dc4179092 --org-slug default \
--smtp-username "..." --smtp-password '...' --smtp-host 'smtp.mailgun.org' \
--sender 'Arik <[email protected]>' --to '[email protected]'
--subject "Test" --body-html-file html --body-text-file text
@GitSumito
GitSumito / file0.txt
Last active December 26, 2017 11:40
VulsをDockerで構築したけどHostKeyを登録しろと永遠言われる問題 ref: https://qiita.com/S-T/items/33d2a9d67fd8ccb40879
[Dec 26 09:28:48] ERROR [localhost] (5/5) Failed: SERVER, err: [Failed to detect OS: Unable to connect via SSH. Check SSH settings. If you have never SSH to the host to be scanned, SSH to the host before scanning in order to add the HostKey. [email protected] port: 22
execResult: servername: SERVER
cmd: /usr/bin/ssh -tt -o StrictHostKeyChecking=yes -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none [email protected] -p 22 -i /root/.ssh/id_rsa_vuls -o PasswordAuthentication=no stty cols 1000; ls /etc/debian_version
exitstatus: 255
stdout:
stderr:
err: %!s(<nil>)]
@GitSumito
GitSumito / file0.txt
Last active June 26, 2018 14:48
Linuxトラブルシュートと原因の特定 ref: https://qiita.com/S-T/items/2b48ce0aecb8788617d2
dstat -tlmnd
@GitSumito
GitSumito / file0.txt
Last active January 7, 2018 06:37
tracerouteコマンドの動きについて ref: https://qiita.com/S-T/items/4b4815a408a2ad71a58a
950 for (ttl = first_ttl; ttl <= max_ttl; ++ttl) {
951 u_int32_t lastaddr = 0;
952 int gotlastaddr = 0;
953 int got_there = 0;
954 int unreachable = 0;
955 int sentfirst = 0;
956 int loss;
957
958 Printf("%2d ", ttl);
959 for (probe = 0, loss = 0; probe < nprobes; ++probe) {
@GitSumito
GitSumito / BITHUMB_JPY_BTC.sh
Last active February 7, 2018 01:46
ビットコインでアービトラージを稼げるのか ref: https://qiita.com/S-T/items/f454c2668c6805e690e4
#!/bin/sh
TABLE=BITHUMB_JPY_BTC
ORIGINALPRICE=`curl -s https://api.bithumb.com/public/ticker/BTC | jq -r '.data.buy_price'`
RATE=`curl -s http://api.aoikujira.com/kawase/json/krw | jq -r '.JPY'`
PRICE=`echo "scale=0 ; $ORIGINALPRICE * $RATE" | /usr/bin/bc`
echo "insert into $TABLE(price) values(${PRICE%.*});" > sql/$TABLE.sql;
@GitSumito
GitSumito / file0.txt
Last active April 30, 2020 04:48
ssh/scp多段接続〜踏み台サーバを越えて〜 ref: https://qiita.com/S-T/items/18af2bfcc4e5a72202da
scp -r -o "ProxyCommand ssh -i ~/.ssh/key ユーザー@踏み台 -W %h:%p" testdir ユーザー@送信先:/tmp/.
もしくは
scp -r -o "ProxyCommand ssh -i ~/.ssh/key ユーザー@踏み台 nc %h %p" testdir ユーザー@送信先:/tmp/.
@GitSumito
GitSumito / file0.txt
Last active January 26, 2018 06:17
scpでPermission deniedになるファイルを無理やり転送する ref: https://qiita.com/S-T/items/fc9f34da43d6e80ad501
$ scp TargetServer:/tmp/sample /tmp/sample
scp: /tmp/sample: Permission denied
$
@GitSumito
GitSumito / file0.txt
Created February 14, 2018 05:39
source codeの追い方 -なぜlessコマンドはバイナリファイルを読めるのか- ref: https://qiita.com/S-T/items/afc356255c3c01beefaa
[root@tkd003 tmp]# which less
/usr/bin/less
@GitSumito
GitSumito / file0.txt
Created March 22, 2018 02:08
dockerコンテナ一個一個のリソースを確認する ref: https://qiita.com/S-T/items/d5a43076a51f5814ee32
wget https://github.com/bcicen/ctop/releases/download/v0.7.1/ctop-0.7.1-linux-amd64 -O /usr/local/bin/ctop
chmod +x /usr/local/bin/ctop
@GitSumito
GitSumito / file0.txt
Last active March 29, 2018 06:25
dockerで稼働するredashのトラブルと対策 ref: https://qiita.com/S-T/items/bee0ae9c8c0acbd940cc
worker:
image: redash/redash:latest
command: scheduler
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
QUEUES: "queries,scheduled_queries,celery"
WORKERS_COUNT: 1