This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# you shold modify /etc/resolv.conf | |
urls=$1 | |
cat $urls | xargs -P 0 -I{} curl -L -sSfk -m 10 -o /dev/null -w "%{http_code} %{url_effective}\n" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# client | |
gem lists > gem-lists.txt | |
# server | |
gem install -v $(cat gem-lists.txt | cut -d' ' -f1 | tr '\n' ' ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SERVER='8.8.8.8' | |
cat $1 | sed -E 's;^https?://(.*)/;\1;g' | xargs -I{} dig +short +time=5 @$SERVER {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
InstanceId="$1" | |
# allocation id of current ip | |
OldAllocationId=$(aws ec2 describe-addresses | | |
jq -r '.Addresses[] | select(.InstanceId == "'$InstanceId'") | .AllocationId') | |
# create address | |
NewAllocationId=$(aws ec2 allocate-address | jq -r '.AllocationId') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'nokogiri' | |
require 'open-uri' | |
require 'uri' | |
instanceID = 'xxxxxx' | |
## if you are blocked by google, you have to change your ip address. | |
## You can change it with "elastic ip address" provided by ec2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
AMI="ami-xxxxxxx" # Official CentOS 7.0 AMI in ap-northeast-1 region | |
ALOCID="eipalloc-xxxxxxx" # Allocating ip address | |
SIZE="m3.large" | |
KEYNAME="jobfind" | |
SEC_GROUP="default" | |
InstanceId=$(aws ec2 run-instances \ | |
--count 1 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* GIL (Global Interepter Lock) が存在するために ruby, python ではマルチコアを生かせない(コア数に比例してクローリングの数が増えない) | |
⇒ 対策: マルチコアを生かすには GIL が存在しない java や C++ か、メッセージバッシングの行える Scala, Go, Closure を使う | |
⇒ 今回はあまり癖がなく Garbage Collector が付いている Go を選択する | |
### 20 (page/second) の壁 | |
* ファイルディスクリプタの枯渇で死ぬ | |
⇒ 対策 | |
* ulimit -u 40000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dnsperf -d domain-1000000.txt -s 127.0.0.1 -p 53 -c 128 -t 10 -q 5000 -Q 150000 -S 1 2>&1 | grep -v -E 'Timeout|Warning' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl 'http://s3.amazonaws.com/alexa-static/top-1m.csv.zip' | zcat -d | awk -F',' '{print $2}' | paste -d' ' - <(yes A | head -n 200000) > queries-200000.txt | |
dnsperf -d queries-10000.txt -s 8.8.8.8 -p 53 -c 128 -t 10 -q 1000 -Q 1500 -S 1 2>&1 | grep -v -E 'Timeout|Warning' | |
dnsperf -d queries-200000.tx -s 127.0.0.1 -p 53 -c 120000 -t 10 -q 20000 -Q 20000 -S 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** メモ ** | |
# コメント付きで keygen | |
$ ssh-keygen -C taku@hacker -t rsa -f ~/.ssh/github | |
# 通信している ARP アドレスの確認 | |
$ arp -a | |
# ネットワークの統計 |
OlderNewer