Skip to content

Instantly share code, notes, and snippets.

View castor4bit's full-sized avatar

Toru Okugawa (Tanaka) castor4bit

View GitHub Profile
@castor4bit
castor4bit / newt.rb
Created October 8, 2011 13:53 — forked from d235j/newt.rb
Patched newt.rb
require 'formula'
class Newt < Formula
url 'https://fedorahosted.org/releases/n/e/newt/newt-0.52.13.tar.gz'
homepage 'https://fedorahosted.org/newt/'
md5 '77de05b3f58540152a4ae32a1a64e5d0'
depends_on 'gettext'
depends_on 'slang'
depends_on 'popt'
@castor4bit
castor4bit / httpd.rb
Created January 23, 2012 02:01
httpd (2.4.0 with mod_lua) homebrew formula
require 'formula'
class Httpd < Formula
url 'http://httpd.apache.org/dev/dist/httpd-2.4.0.tar.gz'
homepage 'http://httpd.apache.org/'
sha1 'c30d7035a2888aa28424f8ed1497843cbb1c2270'
skip_clean :all
def install
@castor4bit
castor4bit / affiliatebutton.user.js
Last active October 1, 2015 03:57
Axxxon Affiliate Button
// ==UserScript==
// @name Amazon Affiliate Button
// @namespace http://example.com/
// @description -
// @include http://www.amazon.co.jp/*
// ==/UserScript==
(function() {
var affiliateId = 'HogeAffiliateId-22';
var pattern = /\/(gp\/product|ASIN|dp)\/([0-9A-Z]+)/;
var item = '';
@castor4bit
castor4bit / vim.rb
Created July 16, 2012 03:54 — forked from mugijiru/vim.rb
Homebrew Formula for vim+ruby
require 'formula'
class Vim < Formula
# url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2' url 'https://vim.googlecode.com/hg/', :tag => 'v7-3-600' version '7.3.600'
homepage 'http://www.vim.org/'
# md5 '5b9510a17074e2b37d8bb38ae09edbf2'
head 'https://vim.googlecode.com/hg/'
# depends_on 'cmake' => :build
@castor4bit
castor4bit / cybozu.user.js
Created November 22, 2012 07:02
CybouzuAutoLogon
// ==UserScript==
// @name CybouzuAutoLogon
// @namespace http://cbz.example.co.jp/
// @include http://cbz.example.co.jp/cgi-bin/ag.cgi
// @include http://cbz.example.co.jp/cgi-bin/ag.cgi?page=AGIndex
// ==/UserScript==
(function() {
var member_id = 00000;
var member_name = 'member_name';
var check = 0;
@castor4bit
castor4bit / automator_convert_path.rb
Last active December 14, 2015 11:09
Automatorで選択範囲の共有ディレクトリパスを、Windows/Macそれぞれに変換して出力
ARGF.each do |path|
path.force_encoding("UTF-8") unless path.nil?
puts path
if path =~ /^smb:/
puts path.gsub(%r|^smb://|, "\\\\\\").gsub(%r|/|, "\\")
else
puts "smb:#{path.gsub("\\", "/")}"
end
end
@castor4bit
castor4bit / automator_open_shared_directory.rb
Last active December 14, 2015 11:08
Automatorで選択範囲の共有ディレクトリパスを開く
ARGF.each do |path|
path.force_encoding("UTF-8") unless path.nil?
if path =~ /^\\/
path.gsub!(%r|^\\\\|, "smb://").gsub!(%r|\\|, "/")
end
system("open #{path}")
end
@castor4bit
castor4bit / generate_dummydata.rb
Created March 20, 2013 20:18
MySQL5.6.10でのSTART TRANSACTION READ ONLY効果検証
require 'faker'
require 'date'
now = Time.now
100000.times do |i|
line = [
i+1,
Faker::Name.name,
Faker::Internet.email,
Faker::PhoneNumber.phone_number,
@castor4bit
castor4bit / SyckModuleTest.php
Created June 16, 2013 07:44
Spyc tests with syck module.
<?php
require_once ("../Spyc.php");
class SyckModuleTest extends PHPUnit_Framework_TestCase {
public function testLoad() {
$spyc = new Spyc();
$data = file_get_contents('./example.yaml');
@castor4bit
castor4bit / index.html
Last active August 29, 2015 14:07
jQuery Performance Issue in IE8
<!doctype html>
<html>
<head>
<title>test</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
jQuery(function($) {
// mouse event
var box = document.getElementById("box");
var outer = document.getElementById("outer");