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
require "socket" | |
gs = TCPServer.open(0, 20000) | |
socks = [gs] | |
addr = gs.addr | |
addr.shift | |
printf("server is on %s\n", addr.join(":")) | |
while true | |
Thread.start(gs.accept) do |s| |
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
require "socket" | |
require "time" | |
require "date" | |
gs = TCPServer.open(0, 20000) | |
socks = [gs] | |
addr = gs.addr | |
addr.shift | |
printf("server is on %s\n", addr.join(":")) |
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
#!/usr/bin/bash | |
pkgin -y install scmgit tmux rrdtool gmake gcc-compiler | |
mkdir -p /usr/local/bin | |
curl -Lk http://xrl.us/cpanm -o /usr/local/bin/cpanm | |
chmod +x /usr/local/bin/cpanm | |
cd /usr/local | |
git clone https://github.com/kazeburo/GrowthForecast.git |
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
require 'yaml' | |
require 'erb' | |
CLI_NUM = ENV["CLI_NUM"] || 10 | |
INTERVAL = ENV["INTERVAL"] || 5 | |
task :default do | |
puts "default do nothing" | |
puts p | |
end |
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
require 'json' | |
gf_1 = "locate_name" | |
gf_2 = "riak_stat" | |
gfcast = "http://user:password@your_gfcast_address/api/#{gf_1}/#{gf_2}" | |
r_add = "your_riak_address:8098/stats" | |
r_stats = JSON.load(`curl -s #{r_add} | json`) |
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 'csv' | |
require 'json' | |
## machines | |
owner_uuid = "oooooooo-oooo-oooo-oooo-oooooooooooo" | |
zone_uuids = [ | |
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", | |
"yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy", | |
"zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz" ] |
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 'csv' | |
require 'json' | |
require 'pp' | |
csvh = ["owner_uuid", "zone_uuid","net_if","period_start","period_end","Megabytes_sent_delta","Megabytes_received_delta"] | |
jfile = "data/billing.json" | |
rfile = "result/all_result.csv" |
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
<source> | |
type tail | |
format /(?<c_ip>[\w\.]+):(?<c_port>\d+) \[(?<a_date>.+)\] (?<f_end>[\w-]+) (?<b_end>[\w-]+)\/(?<b_server>[\w-]+) (?<tw>\d+)\/(?<tc>\d | |
+)\/(?<tt>\d+) (?<bytes>\d+) (?<t_state>[\w-]+) (?<actconn>\d+)\/(?<feconn>\d+)\/(?<beconn>\d+)\/(?<srv_conn>\d+)\/(?<retries>\d+) (?< | |
srv_queue>\d+)\/(?<backend_queue>\d+)/ | |
time_format %d/%B/%Y:%H:%M:%S | |
path /var/log/haproxy/haproxy_access.log | |
pos_file /opt/fluentd/var/pos/haproxy_access.pos | |
tag haproxy.access | |
</source> |
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
function pp { | |
echo pretty | |
} |
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
#!/usr/bin/env ruby | |
# -*- coding:utf-8 -*- | |
require 'socket' | |
require 'openssl' | |
require 'timeout' | |
require 'pp' | |
include OpenSSL | |
timeout=15 |