Skip to content

Instantly share code, notes, and snippets.

import os
import sys
import time
import argparse
import boto3
if os.environ.get('AWS_PROFILE') is None:
sys.exit('Environment variable AWS_PROFILE not set')
argparser = argparse.ArgumentParser(description='Snapshot EC2 instance volume with volume ID specified by argument')
@KitaitiMakoto
KitaitiMakoto / application.html.erb
Created July 18, 2015 17:12
PadrinoでHTML Imports用のヘルパーを設定する ref: http://qiita.com/KitaitiMakoto/items/55abf926cfcc6f72a5b9
<%= html_import_tag 'elements' %>
@KitaitiMakoto
KitaitiMakoto / rougify-gdp-book.rb
Last active January 16, 2016 17:31
Gihyo Digital Publishingの本のソースコードをシンタックスハイライトする
# coding: utf-8
gem 'epub-parser', '>= 0.2.4'
gem 'epub-maker', '0.0.3'
require 'English'
require 'epub/maker'
require 'rouge'
require 'rouge/lexers/docker'
ROUGE_THEME = 'github'
ROUGE_CSS_SCOPE = 'code'
require 'pathname'
def main(middlewares, files)
files.each do |filename|
pathname = Pathname.new(filename).expand_path
raise "No such file: #{filename}" unless pathname.file?
content_type = middlewares.inject(nil) {|ct, mw|
mw.call(pathname) || ct
}
$stderr.puts [pathname.to_path, content_type].join(': ')
@KitaitiMakoto
KitaitiMakoto / influxdb.service
Created June 21, 2015 15:13
Systemd Unit file for InfluxDB
[Unit]
Description=InfluxDB Server
After=network.target
[Install]
WantedBy=network.target
[Service]
User=influxdb
Group=influxdb
@KitaitiMakoto
KitaitiMakoto / file0.txt
Last active August 29, 2015 14:23
JavaScriptでSassのカスタム関数を作る ref: http://qiita.com/KitaitiMakoto/items/8083258f58066fee970c
.book-cover {
width: image-width("path/to/image");
max-width: 36px;
}
@KitaitiMakoto
KitaitiMakoto / gist:aaaa60ae8cf92d112544
Last active August 29, 2015 14:23
IE10はa要素にtextContentがないとdispatchEventできない
var a = document.createElement('a');
a.addEventListener("click", function(event) {
console.log(event);
});
a.textContent = "click me"; // これがないとIE10でイベント発火しない
var evt = document.createEvent('MouseEvents');
evt.initEvent("click", true, true);
a.dispatchEvent(evt);
console.log(evt);

Running Lean 2章 Running Leanの実例

Running Leanの実例として、『Running Lean』執筆の過程を記す。
後続の章の地図になっている。

『Running Lean』は元々ブログで書いていた内容をまとめ、リライトした本である。

Step 0

@KitaitiMakoto
KitaitiMakoto / client-with-promise.js
Last active August 29, 2015 14:20
Socket.IOでメッセージが届いたことを確認する ref: http://qiita.com/KitaitiMakoto/items/aedf9737b2fc7fd70f8f
// クライアント側
var ws = io();
// 色々初期化処理
post(data).then(function(response) {
doSomethingWith(response);
});
function post(data) {
return new Promise(function(resolve, reject) {
ws.emit("post", data, resolve);
@KitaitiMakoto
KitaitiMakoto / learn-streams.js
Last active August 29, 2015 14:20
Learning WHATWG Streams
"use strict";
// push source
var timeStream = {
start: function(controller) {
setInterval(function() {
controller.enqueue(new Date());
}, 1000);
}
};