This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "centos65-x86_64-20131205" | |
config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box" | |
#config.vm.network :public_network, ip: "192.168.1.99", bridge: "en0: Ethernet" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: ft=ruby | |
# Run me with: | |
# ovservr build.observr | |
# ovservr については https://github.com/kevinburke/observr | |
require 'terminal-notifier-guard' | |
def notify(message, succeeded = true) | |
type = succeeded ? "success" : "failed" | |
system("terminal-notifier-#{type} -message '#{message}' -title 'Docker'") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> | |
<key>Label</key> | |
<string>org.jenkins-ci.node.plist</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/bin/java</string> | |
<string>-Dfile.encoding=UTF-8</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
def temporary_table_class(name, sql = nil, primary_key: nil, &block) | |
name = name.to_s.tableize | |
if block | |
ActiveRecord::Schema.define do | |
create_table(name, :temporary => true, &block) | |
end | |
elsif sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'benchmark' | |
require 'ostruct' | |
require 'hashie' | |
n = 1000000 | |
O = Struct.new(:foo, :bar, :baz) | |
puts "Benchmark: Initialize" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- conn-ssl.c.orig 2014-10-16 09:37:47.303936573 +0000 | |
+++ conn-ssl.c 2014-10-16 09:38:31.513421919 +0000 | |
@@ -296,7 +296,7 @@ | |
return false; | |
} | |
- newctx = SSL_CTX_new(SSLv23_method()); | |
+ newctx = SSL_CTX_new(TLSv1_method()); | |
if (!newctx) { | |
LogOpenSSLError("Failed to create SSL context", NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File.open("x.txt",'w'){|f| f.puts File.read("SKK-JISYO.L", external_encoding: Encoding::EUC_JP).encode(Encoding::UTF_8).split(/\n+/).map{|x| x.scan(%r!/(\p{Han}{2})(?=[;/])!).flatten.first if x !~ /[a-z]/ }.compact.flatten.sort.uniq } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
HOST=$1 | |
if [ -z "$HOST" ]; then | |
echo "$0 host [port]" | |
exit 1 | |
fi | |
PORT=${2:-443} | |
openssl s_client -tls1 -connect $HOST:$PORT 2>&1 < /dev/null | openssl x509 -enddate | awk -F '=' '/^notAfter/{ print $2 }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gimei' | |
def daime(max=99) | |
[*(2..max)].sample.to_s.tr('0123456789','〇一二三四五六七八九') + "代目" | |
end | |
def name | |
"#{daime}#{Gimei.first.kanji}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails で test-unit を使う. 参考: | |
# * https://github.com/test-unit/test-unit-activesupport | |
# * https://github.com/rails/rails/blob/master/activesupport/lib/active_support/test_case.rb | |
# | |
require 'minitest' | |
def Minitest.autorun; end # remove Minitest at_exit process | |
require 'active_support/test_case' | |
require 'active_support/testing/tagged_logging' | |
require 'active_support/testing/assertions' |
OlderNewer