Skip to content

Instantly share code, notes, and snippets.

View muziyoshiz's full-sized avatar

Masahiro Muzi Yoshizawa muziyoshiz

View GitHub Profile
@muziyoshiz
muziyoshiz / Word2VecModelGenerator.scala
Last active December 3, 2016 23:35
Simple Word2Vec application
package jp.muziyoshiz.word2vec
import org.apache.spark._
import org.apache.spark.rdd._
import org.apache.spark.SparkContext._
import org.apache.spark.mllib.feature.{Word2Vec, Word2VecModel}
object Word2VecModelGenerator {
def main(args: Array[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 / ansible_docs_picker.rb
Last active October 5, 2017 15:37
A list of new modules and options in Ansible 2.0
# -*- 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 / 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 / Rakefile
Last active February 8, 2018 14:28
Serverspec Rakefile for creating tasks from Ansible inventory file with server status
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 / 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 / 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 / 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 / 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 / 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)