Skip to content

Instantly share code, notes, and snippets.

Hiroaki Sano hiroakis

Block or report user

Report or block hiroakis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.go
package main
import (
"bytes"
"fmt"
"go/ast"
"go/parser"
"go/token"
"io"
"log"
@hiroakis
hiroakis / status.rb
Created Apr 11, 2017
mkr command wrapper
View status.rb
require 'json'
service = ARGV[0]
role = ARGV[1]
status = ARGV[2]
roleFullnames = "#{service}:#{role}"
hosts = JSON.parse(`mkr hosts`)
target_host_ids = []
@hiroakis
hiroakis / tail.go
Created Jan 15, 2017
The tail command implementation written in go. The command support -F option. It is default action.
View tail.go
package main
import (
"flag"
"fmt"
"io"
"os"
"time"
"github.com/fsnotify/fsnotify"
@hiroakis
hiroakis / fsnotify_example.go
Last active Oct 3, 2018
fsnotify example: Detect file changes in real time.
View fsnotify_example.go
package main
import (
"log"
"os"
"time"
"github.com/fsnotify/fsnotify"
)
View IAM
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"NotAction": "iam:*",
"Resource": "*"
},
{
"Effect": "Allow",
View ansible_directory.sh
#!/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 / enqueue.rb
Last active Mar 27, 2017
queue implementation using MySQL
View enqueue.rb
require 'mysql2-cs-bind'
def get_db
return Mysql2::Client.new(
:host => 'localhost',
:port => 3306,
:username => 'root',
:password => '',
:database => 'queue_test',
:reconnect => true,
View varnish_memo
backend default {
.host = "127.0.0.1";
.port = "8000";
}
sub vcl_recv {
if (req.request == "POST") {
ban("req.url ~ /");
return(pass);
@hiroakis
hiroakis / error
Last active Aug 29, 2015
fluentd 0.10.51 error occurred when "include" tag exists in td-agent.conf
View error
[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/
@hiroakis
hiroakis / client.json
Last active Aug 29, 2015
sensu client example
View client.json
{
"client": {
"name": "web01",
"address": "192.168.1.101",
"subscriptions": [
"common",
"web"
]
},
"keepalive": {
You can’t perform that action at this time.