Skip to content

Instantly share code, notes, and snippets.

@tily
tily / restore.sh
Last active January 29, 2017 06:11
restore.sh
[codesuki/ecs-nginx-proxy: Reverse proxy for AWS ECS. Lets you address your docker containers by sub domain.](https://github.com/codesuki/ecs-nginx-proxy)
@tily
tily / 2016-winter-goods.md
Last active December 27, 2016 14:14
2016 冬の帰省時に持ち帰るものリスト
  • キャップ
  • メガネ
  • ジャケット
    • ポケット
      • 財布
        • 切符
        • 保険証
        • クレジットカード
        • お守り
  • iPhone
@tily
tily / add-note.rb
Created December 21, 2016 03:53
すぐにローカルのメモを書きはじめられるやつ
require 'fileutils'
require 'highline'
BASE_DIR = File.join(ENV['HOME'], 'Desktop')
TITLE = 'Untitled'
def main
title = HighLine.new.ask("Title: ")
title = TITLE if title == ""
path = note_path(title)
@tily
tily / dot.mongorc.js
Created October 7, 2011 13:40
MongoDB DBQuery extension for easier printjson
DBQuery.prototype.p = function() {
var args = arguments
this.forEach(function(e) {
var result = {}
if(args.length == 0) {
result = e
} else {
for(var i = 0; i < args.length; i++) {
var target = e
var keys = args[i].split('.')
@tily
tily / detect-data-track.rb
Created September 23, 2016 23:00
Detect data track from XLD logs
def main
Dir["/Users/tily/Music/CDs/*/*.log"].each do |path|
f = File.open(path)
table_num, track_num = parse(f)
if table_num != track_num
puts "#{path}: table -> #{table_num}, track -> #{track_num}"
end
end
end
@tily
tily / dht11-to-twitter.go
Last active July 12, 2016 00:07
温湿度センサー DHT11 から取得した情報を一定間隔で Twitter へポスト
package main
import (
"github.com/d2r2/go-dht"
"github.com/ChimeraCoder/anaconda"
"fmt"
"time"
)
func main() {
@tily
tily / mysqld_spec.rb
Last active December 19, 2015 17:19
JTF ニフティクラウドオートメーション ハンズオン資料の回答例
require 'spec_helper'
describe package('mysql-server') do
it { should be_installed }
end
describe service('mysqld') do
it { should be_enabled }
it { should be_running }
end
#!/bin/bash
OPSWORKS_USERDATA_LOG_FILE='/var/log/aws/opsworks/user-data.log'
export OPSWORKS_USERDATA_LOG_FILE
mkdir -p $(dirname ${OPSWORKS_USERDATA_LOG_FILE})
touch ${OPSWORKS_USERDATA_LOG_FILE} && chmod 0600 ${OPSWORKS_USERDATA_LOG_FILE}
exec &> >(tee -a ${OPSWORKS_USERDATA_LOG_FILE}) 2>&1
conslog () {
echo "[$(date --rfc-2822)] opsworks-init: $1" | tee -a ${OPSWORKS_USERDATA_LOG_FILE} > /dev/console
@tily
tily / read_resque_source.md
Last active December 17, 2015 05:59
resque のソースコードを読む

resque のソースコードを読む

概要

自分で似たようなのを作りたいので resque のソースコードを読む。

詳細

雑記

@tily
tily / amqp-test.rb
Created April 14, 2013 02:26
AMQP Ruby サンプル
require 'rubygems'
require 'amqp'
BANNER = 'ruby amqp-test.rb [hostname]'
def main(args)
host = args.first
abort BANNER if host.nil?
EventMachine.run do