Skip to content

Instantly share code, notes, and snippets.

View sanemat's full-sized avatar
🍢

Matt Murahashi Kenichi sanemat

🍢
View GitHub Profile
@sanemat
sanemat / hubot-lightning-talks.md
Last active August 29, 2015 14:04
Hubot Lightning Talks

Hubot Lightning Talks

日時

未定

場所

未定

コンテンツ

1本3分のLT * 10~

@sanemat
sanemat / wercker-postgres-json-type.md
Created July 21, 2014 11:06
wercker-postgres-json-type

I met ERROR: type "json" does not exist

rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedObject: ERROR:  type "json" does not exist
LINE 1: ...ULT 0 NOT NULL, "job_class" text NOT NULL, "args" json DEFAU...

with:

@sanemat
sanemat / clear-job-with-que.rb
Created August 9, 2014 07:32
Clear job with que
class JobQueue
def self.clear(job_class, *args)
case
when job_class == RepoSynchronizationJob
user_id = args.first[:user_id]
sql = <<-"EOQ".strip_heredoc
DELETE FROM que_jobs
WHERE
job_class = #{ActiveRecord::Base.connection.quote(job_class)}
AND
@sanemat
sanemat / install-fluentd.txt
Created August 11, 2014 16:25
For ubuntu 14.04 and td-agent2
# fluentd
curl -L http://packages.treasure-data.com/debian/RPM-GPG-KEY-td-agent | sudo apt-key add -
sudo apt-add-repository 'deb http://packages.treasuredata.com/2/ubuntu/trusty/ trusty contrib'
sudo apt-get -yq update
sudo apt-get -yq install td-agent
sudo service td-agent configtest
sudo service td-agent restart

Rails and job queue

Use case

Action mailer, api request, ...

TL;DR

Use sucker_punch. If you already use redis, why don't you use sidekiq(or resque). If you have a few resources (and if you have enough time) and IF YOU WANT TO BE 'HITOBASHIRA', using que is one option.

@sanemat
sanemat / tachikomaio-with-github-travis-ci-ecosystem.md
Last active August 29, 2015 14:05
Tachikoma.io with GitHub, Travis CI ecosystem

Tachikoma.io with GitHub, Travis CI ecosystem

sanemat sanemat_AT_tachikoma.io

Use Case

Your are a user of OSS(Open Source Software).

You met below:

@sanemat
sanemat / docker-upstart.conf
Created August 14, 2014 16:15
Parse docker upstart log, for v1 format
<source>
type tail
tag docker.host.house
path /var/log/upstart/docker.log
pos_file /var/log/td-agent/docker-upstart.log.pos
format multiline
format_firstline /\\A\\d{4}\\/\\d{2}\\/\\d{2}\\s\\d{2}:\\d{2}:\\d{2}/
format1 /\\A(?<time>\\d{4}\\/\\d{2}\\/\\d{2}\\s\\d{2}:\\d{2}:\\d{2})\\s*(?<head>\[^\\r\\n\]+)/
# FIXME: [identifier.method()]
<!-- === begin markdown block ===
generated by markdown 1.1.1 on Ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
on 2014-09-04 02:09:42 +0900 with Markdown engine kramdown (1.3.3)
using options {}
-->
<link href="z.css" rel="stylesheet" />
<link href="http://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css" />
@sanemat
sanemat / Vagrantfile
Created August 21, 2014 10:18
Tachikoma.io host's vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
Dotenv.load
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.omnibus.chef_version = '11.12.8'
@sanemat
sanemat / mask.conf
Created August 28, 2014 12:25
Use fluent-plugin-record-reformer
<match docker.containers.**>
type record_reformer
tag reformed.${tag}
<record>
message ${message.gsub(%r(://[\\w:-]{20,}), '://MASKED')}
</record>
</match>