Skip to content

Instantly share code, notes, and snippets.

Avatar

Masahiro Yoshizawa muziyoshiz

View GitHub Profile
@muziyoshiz
muziyoshiz / myproject.log.20150314
Last active Aug 29, 2015
Dummy multi-line log
View myproject.log.20150314
2015-03-14 20:12:22,123 [ERROR] Book reader error
Exception in thread "main" java.lang.IllegalStateException: A book has a null property
at com.example.myproject.Author.getBookIds(Author.java:38)
at com.example.myproject.Bootstrap.main(Bootstrap.java:14)
Caused by: java.lang.NullPointerException
at com.example.myproject.Book.getId(Book.java:22)
at com.example.myproject.Author.getBookIds(Author.java:35)
... 1 more
2015-03-14 20:13:34,456 [INFO] Login (userId=12345)
2015-03-14 20:13:41,678 [INFO] Login (userId=2345)
@muziyoshiz
muziyoshiz / line-decoder-sample.rb
Created Mar 15, 2015
LineDecoder Usage Sample
View line-decoder-sample.rb
module Embulk
module Parser
class LineDecoderSampleParserPlugin < ParserPlugin
Plugin.register_parser("line-decoder-sample", self)
def self.transaction(config, &control)
# configuration code:
parser_task = config.load_config(Java::LineDecoder::DecoderTask)
@muziyoshiz
muziyoshiz / myapp.rb
Created May 30, 2015
Sample filter: embulk-filter-myapp
View myapp.rb
module Embulk
module Filter
class MyappFilterPlugin < FilterPlugin
Plugin.register_filter("myapp", self)
def self.transaction(config, in_schema, &control)
yield({}, in_schema)
end
@muziyoshiz
muziyoshiz / config.yml
Created May 30, 2015
config.yml for using embulk-filter-myapp
View config.yml
in:
type: file
path_prefix: /Users/myoshiz/devel/try1/csv/sample_
decoders:
- {type: gzip}
parser:
charset: UTF-8
newline: CRLF
type: csv
delimiter: ','
@muziyoshiz
muziyoshiz / Rakefile
Last active Sep 13, 2015
Serverspec Rakefile creating tasks from Ansible inventory
View Rakefile
require 'rake'
require 'rspec/core/rake_task'
# Sample of Ansible groups and hosts
# http://docs.ansible.com/ansible/intro_inventory.html
groups = {}
groups["webservers"] = [ "foo.example.com", "bar.example.com" ]
groups["dbservers"] = [ "one.example.com", "two.example.com", "three.example.com" ]
task :spec => 'spec:all'
@muziyoshiz
muziyoshiz / Rakefile
Created Sep 13, 2015
Serverspec Rakefile creating tasks from Ansible inventory with status
View Rakefile
require 'rake'
require 'rspec/core/rake_task'
# Sample of Ansible groups and hosts
# http://docs.ansible.com/ansible/intro_inventory.html
groups = {}
groups["webservers"] = [ "foo.example.com", "bar.example.com" ]
groups["dbservers"] = [ "one.example.com", "two.example.com", "three.example.com" ]
task :spec => 'spec:all'
@muziyoshiz
muziyoshiz / Rakefile
Last active Feb 8, 2018
Serverspec Rakefile for creating tasks from Ansible inventory file with server status
View Rakefile
require 'rake'
require 'rspec/core/rake_task'
unless ENV['inventory']
print "ERROR: Inventory file must be specified by 'inventory' environment variable\n"
print " e.g.) bundle exec rake inventory=./hosts spec:all\n"
exit
end
groups = {}
@muziyoshiz
muziyoshiz / jp.muziyoshiz.embulk-healthplanet.plist
Created Feb 2, 2016
Launchd setting for embulk-output-healthplanet
View jp.muziyoshiz.embulk-healthplanet.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- job name -->
<key>Label</key>
<string>jp.muziyoshiz.embulk-healthplanet</string>
<key>WorkingDirectory</key>
<string>/Users/myoshiz/job/embulk-healthplanet</string>
@muziyoshiz
muziyoshiz / ansible_docs_picker.rb
Last active Oct 5, 2017
A list of new modules and options in Ansible 2.0
View ansible_docs_picker.rb
# -*- coding: utf-8 -*-
require 'anemone'
version = ARGV[0] || "2.0"
class ModulePage
attr_accessor :category, :url, :name, :description, :is_extras, :version_added, :options
def to_markdown
s = "* ["
@muziyoshiz
muziyoshiz / swim_com_parser.rb
Created Apr 21, 2016
JSON Parser for swim.com workout data
View swim_com_parser.rb
# -*- coding: utf-8 -*-
require 'json'
require 'csv'
JSON_FILE = 'swim_com.json'
CSV_FILE = 'swim_com.csv'
class Workout
attr_accessor :name, :date, :id, :note, :distance, :duration, :achievement, :device, :pace, :url
end