Skip to content

Instantly share code, notes, and snippets.

View takuma-saito's full-sized avatar

takuma.saito takuma-saito

  • 23:26 (UTC +09:00)
View GitHub Profile
socat Examples
===============
* 注意
- SYSTEM で : を使う時は必ずエスケープすること
* 相手に接続
# telnet, netcat, socat それぞれの場合
$ socat - TCP:127.0.0.1:8000
@takuma-saito
takuma-saito / setup.sh
Created November 25, 2015 14:43
mac setup
#!/bin/bash
brew update
brew tap sanemat/font
brew tap caskroom/cask
brew cask install coteditor
brew cask install evernote
brew cask install google-chrome
brew cask install iterm2
brew cask install menumeters
@takuma-saito
takuma-saito / tmux.conf
Created December 1, 2015 15:37
tmux.conf
# prefixキーをctrl+tへ変更
set-option -g prefix C-t
bind-key C-t send-prefix
# ターミナルを256色にする
set -g default-terminal "xterm-256color"
# Shift + 上下左右でペインを移動できるようにする。
bind -n C-left select-pane -L
@takuma-saito
takuma-saito / ascii2decimal.sh
Created December 1, 2015 18:23
ascii2decimal
#!/bin/zsh
echo -en "$1" | hexdump -v -e '/1 "%02x "' | tr ' ' '\n' | xargs -I{} zsh -lc 'printf "\\\0%03d\n" $(echo $[[#8] 16#{}] | cut -b3-)' | tr -d '\n'
@takuma-saito
takuma-saito / con-db.sh
Created December 4, 2015 03:51
ruby connect to mysql database
#!/bin/bash
ruby -e "require 'mysql'; p Mysql.new('hostname', 'username', 'password', 'dbname')"
$ 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/