Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am hatyuki on github.
  • I am hatyuki (https://keybase.io/hatyuki) on keybase.
  • I have a public key ASDWCqj9T1q_mH3ISKgWBKryeSUwkKy9mZlT05Znp4LXTQo

To claim this, I am signing this object:

module Test
class RedisServer
# Create a new redis-server instance, and start it if block given.
#
# @param timeout [Fixnum]
# @param config [Hash]
def initialize (timeout: 3, config: { }, &block)
@owner_pid = $$
@pid = nil
@hatyuki
hatyuki / Gemfile
Last active December 5, 2016 15:29
ファイルパスから MP3 に適切な ID3 Tag を設定する
source 'http://rubygems.org'
gem 'mercenary'
gem 'taglib-ruby'
require 'benchmark'
N = 1000000
string = ''
Benchmark.bm(11) do |x|
100.times do |digits|
string << rand(10).to_s
fixnum = string.to_i
symbol = string.to_sym
require 'benchmark'
N = 1000000
fixnum = 1234567
float = 1.23456
string = 'abcdefg'
symbol = :symbol!
Benchmark.bm(11) do |x|
x.report 'Fixnum#to_s' do
require 'benchmark'
N = 1000000
fixnum = 1234567
float = 1.234567
string = 'abcdefg'
symbol = :symbol!
Benchmark.bm(11) do |x|
x.report 'Fixnum#to_s' do
require 'benchmark'
N = 1000000
fixnum = 1234567
string = 'abcdefg'
Benchmark.bm(11) do |x|
x.report 'Fixnum#to_s' do
(1..N).each { fixnum.to_s }
end
@hatyuki
hatyuki / app.js
Last active August 29, 2015 14:02
AngularJS で Semaphore してみたい
'use strict';
angular.module('myApp', [
'ngResource',
'ngSemaphore'
]).config(function ($provide) {
$provide.value('SemaphoreConfig', {
parallels: 5
});
}).controller(
#!/usr/bin/env perl
use strict;
use warnings;
my $count = 0;
my $fg = "\x1b[38;5;";
my $bg = "\x1b[48;5;";
my $rs = "\x1b[0m";
sub swatch
{
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw/ say /;
use Data::Lock qw/ dlock /;
use constant C_TRUE => 1;
use constant C_FALSE => 0;
dlock my $D_TRUE = 1;
dlock my $D_FALSE = 0;