Skip to content

Instantly share code, notes, and snippets.

@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 / 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 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
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
Created December 11, 2017 03:23
LTSVフォーマットから該当の項目のみを抽出 ref: https://qiita.com/S-T/items/2e41accb5279155830ee
time_local:11/Dec/2017:12:09:25 +0900 request:"GET /admin/widget/ HTTP/1.1" http_x_forwarded_for:"-" uid_got:"-" req_body_start:""
time_local:11/Dec/2017:12:09:25 +0900 request:"GET /admin/widget/ HTTP/1.0" http_x_forwarded_for:"192.168.120.120" uid_got:"app_uid=060012AC5A99275A050070A502030303" req_body_start:""
time_local:11/Dec/2017:12:09:26 +0900 request:"GET /admin/event/ HTTP/1.1" http_x_forwarded_for:"-" uid_got:"-" req_body_start:""
time_local:11/Dec/2017:12:09:26 +0900 request:"GET /admin/event/ HTTP/1.0" http_x_forwarded_for:"192.168.120.120" uid_got:"app_uid=060012AC5A99275A050070A502030303" req_body_start:""
@GitSumito
GitSumito / [作業前]docker-compose.production.yml
Created December 7, 2017 02:10
docker-compose内の時刻を日本時間に変更する ref: https://qiita.com/S-T/items/af88fc8f79c969dfb5ec
nginx:
image: redash/nginx:latest
ports:
- "443:443"
depends_on:
- server
links:
- server:redash
logging:
driver: "json-file"
@GitSumito
GitSumito / file0.txt
Last active September 13, 2017 00:50
15秒でわかるLet's Encryptのしくみ~無料で複数ドメイン有効な証明書作成~ ref: http://qiita.com/S-T/items/7ede1ccfae6fc7f08393
tsukada.test.jp
sumito.test.jp
coco.test.jp
@GitSumito
GitSumito / file0.txt
Created August 9, 2017 10:52
Docker上で動くre:dashのメールの送信設定 ref: http://qiita.com/S-T/items/04e28b6ec056ca99d28b
vi docker-compose.production.yml
REDASH_MAIL_SERVER: "MAIL SERVER IP"
REDASH_MAIL_PORT: 25
REDASH_MAIL_DEFAULT_SENDER: "[email protected]"
@GitSumito
GitSumito / file0.txt
Created July 14, 2017 03:27
kibana(ELK)でユーザーやグループ毎に見せる/見せないをコントロールする。 ref: http://qiita.com/S-T/items/5fa1d8d9cd83a7de8dfe
/usr/share/elasticsearch/bin/elasticsearch-plugin install -b com.floragunn:search-guard-5:5.4.2-12
cd /usr/share/elasticsearch/plugins/search-guard-5/tools
sh install_demo_configuration.sh
sh sgadmin_demo.sh
@GitSumito
GitSumito / file0.txt
Created July 12, 2017 10:54
アクセスログから任意のランキングを作る汎用的なワンライナー ref: http://qiita.com/S-T/items/73b2bb095c1b81e9337d
perl -ne 'next unless(/★単純にgrepするキーワード★/);/★集計単位★/;$counts{$1}++;END{for(sort keys %counts){print "$_ $counts{$_}\n"}}' access_log