Skip to content

Instantly share code, notes, and snippets.

View takuma-saito's full-sized avatar

takuma.saito takuma-saito

  • 04:27 (UTC +09:00)
View GitHub Profile
$ echo -en "user@example.jp\0user@example.jp\0password" | base64 | pbcopy
$ socat -v SSL:smtp.gmail.com:465,verify=0,crlf -
EHLO localhost
AUTH PLAIN c3VwcG9ydEBtZWRpY....
MAIL FROM: <user@example.jp>
@takuma-saito
takuma-saito / port-forward.sh
Created December 8, 2015 04:54
ssh local port-fowarding
# ローカルの 2999 をリモートの 3000 にフォワード(接続)させる
$ ssh -vN -L 2999:127.0.0.1:3000 develop
@takuma-saito
takuma-saito / gist:140ff545a80683b64eda
Last active December 9, 2015 12:26
twillo-sample.xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="ja-jp" voice="woman">サーバーおちたよ!</Say>
</Response>
@takuma-saito
takuma-saito / http-request.sh
Last active December 14, 2015 15:16
socat-http-request
echo -en "GET / HTTP/1.1\r\nHost: localhost\r\nUser-Agent: curl\r\n\r\n" | socat UNIX-CONNECT:/var/lib/web/medicil.sock -
@takuma-saito
takuma-saito / test-virtualhost.sh
Created December 15, 2015 05:23
test-virtualhost
curl --header 'Host: example.jp' http://127.0.0.1/
$ aws s3 ls | awk -F" " '{print $3}' | xargs -I{} echo aws s3 sync s3://{} {} | sh
@takuma-saito
takuma-saito / check-cert-and-key.sh
Last active January 16, 2016 06:12
check-cert-and-key
# 秘密鍵から公開鍵を取得
$ openssl rsa -pubout -in server.key
# CSR から公開鍵を取得
$ openssl req -pubkey -in server.csr
# CRT から公開鍵を取得
$ openssl x509 -pubkey -in server.crt
# CSR を x509 形式で表示
$ openssl req -text -noout -in server.csr
# 比較
@takuma-saito
takuma-saito / aff.sh
Created January 16, 2016 12:59
worker-affinity.sh
$ ruby -e '(0..(16*16-1)).map {|x| if (x/16) == (x%16) then 1 else 0 end }.each {|x| print x}' | fold -16 | tr '\n' ' '
@takuma-saito
takuma-saito / collect-url.sh
Last active January 17, 2016 12:37
collect-url.sh
$ wget --no-check-certificate --spider -r http://example.jp 2>&1 | ggrep --line-buffer 'http://' | awk -F" " '{print $3; fflush()}' | tee urls.txt
@takuma-saito
takuma-saito / nginx-log.sh
Last active January 17, 2016 18:41
nginx-log
tail -f access.log | awk -F'\t' '{print $2, $9, $7, $16}'