Skip to content

Instantly share code, notes, and snippets.

View muziyoshiz's full-sized avatar

Masahiro Muzi Yoshizawa muziyoshiz

View GitHub Profile
@muziyoshiz
muziyoshiz / line-decoder-sample.rb
Created March 15, 2015 07:26
LineDecoder Usage Sample
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 / myproject.log.20150314
Last active August 29, 2015 14:17
Dummy multi-line log
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 / myapp.rb
Created May 30, 2015 08:36
Sample filter: embulk-filter-myapp
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 08:38
config.yml for using embulk-filter-myapp
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 September 13, 2015 11:53
Serverspec Rakefile creating tasks from Ansible inventory
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 September 13, 2015 12:12
Serverspec Rakefile creating tasks from Ansible inventory with status
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 / jp.muziyoshiz.embulk-healthplanet.plist
Created February 2, 2016 13:34
Launchd setting for embulk-output-healthplanet
<?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 / swim_com_parser.rb
Created April 21, 2016 16:05
JSON Parser for swim.com workout data
# -*- 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
@muziyoshiz
muziyoshiz / admiral_stats_exporter.js
Last active October 14, 2016 22:37
Admiral Stats エクスポータ(JS版)
javascript:(function(){var a=new Date,e=[a.getFullYear(),("0"+(a.getMonth()+1)).slice(-2),("0"+a.getDate()).slice(-2),"_",("0"+a.getHours()).slice(-2),("0"+a.getMinutes()).slice(-2),("0"+a.getSeconds()).slice(-2)].join(""),f=["Personal/basicInfo","TcBook/info","CharacterList/info"];window.location.href.match(/^https:\/\/kancolle-arcade.net\/ac\/#\/(area|list|pictureBook)/)?f.forEach(function(a){var b=new XMLHttpRequest,g=a.replace("/","_")+"_"+e+".json";b.open("GET","https://kancolle-arcade.net/ac/api/"+a);b.setRequestHeader("X-Requested-With","XMLHttpRequest");b.responseType="blob";b.onload=function(){if(200===b.status){var d=new Blob([b.response]);if(window.navigator.msSaveBlob)window.navigator.msSaveBlob(d,g);else{var d=(window.URL||window.webkitURL).createObjectURL(d),c=document.createElement("a");document.body.appendChild(c);c.download=a.replace("/","_")+"_"+e+".json";c.href=d;c.click();document.body.removeChild(c)}}else a===f[0]&&alert("Admiral Stats \u30a8\u30af\u30b9\u30dd\u30fc\u30bf(JS\u7248) v1.0.0
@muziyoshiz
muziyoshiz / gist:6ba5edd6e7cd2021e8c9bab43244581e
Created November 6, 2016 11:28
Admiral Stats API が返す JSON の素案
['Personal/basicInfo', 'Area/captureInfo', 'TcBook/info', 'EquipBook/info', 'Campaign/history', 'Campaign/info', 'Campaign/present', 'CharacterList/info', 'EquipList/info', 'Quest/info', 'Event/info']