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 / 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 / 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
@muziyoshiz
muziyoshiz / admiral_stats_exporter.js
Last active Oct 14, 2016
Admiral Stats エクスポータ(JS版)
View admiral_stats_exporter.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 Nov 6, 2016
Admiral Stats API が返す JSON の素案
View gist:6ba5edd6e7cd2021e8c9bab43244581e
['Personal/basicInfo', 'Area/captureInfo', 'TcBook/info', 'EquipBook/info', 'Campaign/history', 'Campaign/info', 'Campaign/present', 'CharacterList/info', 'EquipList/info', 'Quest/info', 'Event/info']