Skip to content

Instantly share code, notes, and snippets.

@bash0C7
bash0C7 / rails_new.sh
Created June 2, 2012 06:01
install rails and run rails new
#!/bin/bash
if [ $# -ne 1 ]; then
echo "引数1にrailsアプリ名を入れて下さい" 1>&2
exit 1
fi
cat << EOS > Gemfile
source "http://rubygems.org"
gem "rails", "3.2"
@bash0C7
bash0C7 / gist:4010438
Created November 4, 2012 05:32
scrape(Webrat)
# -*- coding: utf-8 -*-
require 'mechanize'
require 'webrat'
require 'pry'
Webrat.configure do |config|
config.mode = :mechanize
end
@bash0C7
bash0C7 / my_json_parser.rb
Created May 25, 2013 07:31
Fluent Parser
module Fluent
class TextParser
class MyJSONParser
include Configurable
config_param :time_key, :string, :default => 'time'
config_param :time_format, :string, :default => nil
def call(text)
#require 'open-uri'
max_id = 999999999999999999
twitter_name = 'XXXXXXXXXXXXXXXX'
2.times do
tl = Twitter.user_timeline(twitter_name, count: 200, max_id: max_id, include_rts: false)
media_tl = tl.select{|tweet| !(tweet.media.empty?)}
media_tl.each {|tweet| `open #{tweet.media.first.url}`}
max_id = current.last.id
@bash0C7
bash0C7 / README.md
Last active December 20, 2015 03:09
bash set -e option

parent.sh

呼び出し元。set -exののち、スタートメッセージを表示 -> 引数で渡されたシェルスクリプトをsource -> エンドメッセージ表示

child*.sh

呼び出される子供。

child_set_e.sh

セッションタイトル

ミッションクリティカル&ハイパフォーマンスシステムにおける技術統合と運用の勘所

セッション概要

広告配信システムというミッションクリティカルかつハイパフォーマンスが要求されるシステムの開発・運用を通じて会得した技術的・チーム的な知見をお話します。

このセッションでは、事業や技術の第一線で踏ん張るPHPカンファレンス参加のみなさんに、下記の大きな事柄についての理想像を持ち帰っていただけます。

@bash0C7
bash0C7 / idobatar.go
Created November 9, 2013 09:32
Idobata General Webhook Client (golang)
package main
import "net/http"
import "net/url"
import "os"
import "fmt"
import "flag"
import "io/ioutil"
@bash0C7
bash0C7 / gorutine_training.go
Last active December 27, 2015 20:49
Gorutine Training
package main
import "fmt"
import "time"
import "os"
import "flag"
func main() {
buffer_size := func() int {
b := 0
@bash0C7
bash0C7 / hoge.rb
Created November 12, 2013 15:25
Web serfing with Webrat
require 'webrat'
require 'mechanize'
class Hoge
Webrat.configure do |config|
config.mode = :mechanize
end
include Webrat::Methods
@bash0C7
bash0C7 / idobatir.exs
Created December 7, 2013 06:04
「idobatir」 Post messege to 'idobata Generic Web Hook'
:application.start(:asn1)
:application.start(:crypto)
:application.start(:public_key)
:application.start(:ssl)
:application.start(:inets)
[url, message] = System.argv()
:httpc.request(:post, {'#{url}', [], 'application/x-www-form-urlencoded', 'source=#{message}'}, [{:ssl,[{:verify,0}]}], [])