Skip to content

Instantly share code, notes, and snippets.

View hiroakis's full-sized avatar

Hiroaki Sano hiroakis

View GitHub Profile
package main
import (
"log"
"net/http"
//"io/ioutil"
)
func get(url string, c chan bool){
resp, err := http.Get(url)
@hiroakis
hiroakis / models.py
Last active August 29, 2015 13:57
SQLAlchemy test
from sqlalchemy import create_engine, Column, ForeignKey
from sqlalchemy.dialects.mysql import (
INTEGER,
VARCHAR,
TINYINT,
)
from sqlalchemy.orm import sessionmaker, relation
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
@hiroakis
hiroakis / ObjectStorage.scala
Created March 29, 2014 12:22
NTTコムのcloudnのオブジェクトストレージをscalaから使うサンプル
// NTTコムのcloudnのオブジェクトストレージをscalaから使うサンプル
// S3互換があるので、AWSのjava-sdkが使えた。
//
// 参考...
// SDK API: http://docs.aws.amazon.com/AWSAndroidSDK/latest/javadoc/index.html
// Developers IO: http://dev.classmethod.jp/cloud/aws-s3/
import com.amazonaws._
import com.amazonaws.auth._
import com.amazonaws.services.s3.AmazonS3
@hiroakis
hiroakis / dd_test
Created April 25, 2014 10:43
dd test
rm -rf /data/storage-*
mkdir -p /data/bench/logs
cd /data/bench
cat <<'EOF' > ./dd.sh
#!/bin/sh
for i in {1..300}; do
echo ID: $$ PASS: $i
date
@hiroakis
hiroakis / check.json
Last active August 29, 2015 14:01
sensu server example
{
"checks": {
"snmpd_proc": {
"handlers":["mailer"],
"command": "/etc/sensu/plugins/check-procs.rb -p snmpd -C 0 -W 1 ",
"subscribers": [
"common"
],
"interval": 180,
"occurrences": 2,
@hiroakis
hiroakis / client.json
Last active August 29, 2015 14:01
sensu client example
{
"client": {
"name": "web01",
"address": "192.168.1.101",
"subscriptions": [
"common",
"web"
]
},
"keepalive": {
@hiroakis
hiroakis / error
Last active August 29, 2015 14:03
fluentd 0.10.51 error occurred when "include" tag exists in td-agent.conf
[root@xxxxx gems]# /etc/init.d/td-agent start
Starting td-agent: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.51/lib/fluent/config/parser.rb:57:in `process_include': uninitialized constant Fluent::Config::Parser::URI (NameError)
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.51/lib/fluent/config/parser.rb:41:in `parse!'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.51/lib/fluent/config/parser.rb:8:in `parse'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.51/lib/fluent/config.rb:33:in `parse'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.51/lib/fluent/supervisor.rb:364:in `apply_system_config'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.51/lib/fluent/supervisor.rb:110:in `initialize'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.51/lib/fluent/command/fluentd.rb:160:in `new'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/
backend default {
.host = "127.0.0.1";
.port = "8000";
}
sub vcl_recv {
if (req.request == "POST") {
ban("req.url ~ /");
return(pass);
#!/bin/sh
touch production staging
mkdir group_vars
touch group_vars/group1
touch group_vars/group2
mkdir host_vars
touch host_vars/hostname1
touch host_vars/hostname2
mkdir library
@hiroakis
hiroakis / installation_perlbrew
Created December 28, 2012 06:12
My perl environment for CentOS
mkdir /perl
export PERLBREW_ROOT=/perl
curl -L --insecure http://xrl.us/perlbrewinstall | bash
echo 'export PERLBREW_ROOT=/perl' >> ~/.zshrc
echo '[ -f /perl/etc/bashrc ] && source /perl/etc/bashrc' >> ~/.zshrc
source ~/.zshrc
perlbrew available
perlbrew install perl-5.16.2
perlbrew switch perl-5.16.2
perlbrew install-cpanm