Skip to content

Instantly share code, notes, and snippets.

View kentaro's full-sized avatar

Kentaro Kuribayashi kentaro

View GitHub Profile
@kentaro
kentaro / gist:1308245
Created October 24, 2011 02:30
Test::mysqldにどばっとデータつっこむ
use DBI;
use Path::Class;
use Test::mysqld;
my $mysqld = Test::mysqld->new(
my_cnf => {
'skip-networking' => '',
}
) or plan skip_all => $Test::mysqld::errstr;
@kentaro
kentaro / file0.txt
Created November 11, 2011 12:08
使ってないポートを取得する (Perl) ref: http://qiita.com/items/1018
#!/usr/bin/env perl
use strict;
use warnings;
use v5.14;
use IO::Socket::INET;sub empty_port () {
my $sock = IO::Socket::INET->new(
Prot => 'tcp',
Listen => 1,
(($^O eq 'MSWin32') ? () : (ReuseAddr => 1)),
);
@kentaro
kentaro / gist:1575476
Created January 7, 2012 18:01
今日は何の日?
javascript:(function() {var date=(new Date()); location.href='http://ja.wikipedia.org/wiki/'+(date.getMonth()+1)+'月'+date.getDate()+'日#.E8.A8.98.E5.BF.B5.E6.97.A5.E3.83.BB.E5.B9.B4.E4.B8.AD.E8.A1.8C.E4.BA.8B';})()
@kentaro
kentaro / gist:1680577
Created January 26, 2012 02:30
Sub::Name
#!/usr/bin/env perl
use strict;
use warnings;
package A;
use Carp qw(cluck);
*name = sub { cluck 'no name' };
package B;
use Sub::Name;
@kentaro
kentaro / gist:2182582
Created March 24, 2012 13:07
cdd.zsh
#
# zaw-src-cdd
#
# zaw source for cdd command
#
(( $+functions[cdd] )) || return
function zaw-src-cdd () {
if [ -r "$CDD_PWD_FILE" ]; then
@kentaro
kentaro / chef_solo_bootstrap.sh
Created June 3, 2012 13:08
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install
/*
Do not change this file.
Generated from BridgeSupport.
*/
#include "cocoa.h"
#import "UIKit/UIAccelerometer.h"
#import "UIKit/UIAccessibility.h"
#import "UIKit/UIAccessibilityAdditions.h"
#import "UIKit/UIAccessibilityConstants.h"
#import "UIKit/UIAccessibilityElement.h"
/*
Do not change this file.
Generated from BridgeSupport.
/usr/bin/gen_bridge_metadata --no-64-bit -f "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/QuartzCore.framework" -c "-I/Users/usr0600239/tmp/mobiruby-ios/modules/mruby/include -I/Users/usr0600239/tmp/mobiruby-ios/modules/libffi/include -I/Users/usr0600239/tmp/mobiruby-ios/modules/mobiruby-common/include -I/Users/usr0600239/tmp/mobiruby-ios/modules/mruby-cocoa/include -I/Users/usr0600239/tmp/mobiruby-ios/modules/mruby-cfunc/include -DALLOC_PADDING=8 -DUSE_MRBC_DATA -arch i386 -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk"
/usr/bin/gen_bridge_metadata --no-64-bit -f "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/AVFoundation.framework" -c "-I/Us
<?xml version='1.0'?>
<!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd">
<signatures version='1.0'>
<struct type='{CGAffineTransform=&quot;a&quot;f&quot;b&quot;f&quot;c&quot;f&quot;d&quot;f&quot;tx&quot;f&quot;ty&quot;f}' name='CGAffineTransform'/>
<struct type='{CGDataConsumerCallbacks=&quot;putBytes&quot;^?&quot;releaseConsumer&quot;^?}' name='CGDataConsumerCallbacks'/>
<struct type='{CGDataProviderCallbacks=&quot;getBytes&quot;^?&quot;skipBytes&quot;^?&quot;rewind&quot;^?&quot;releaseProvider&quot;^?}' name='CGDataProviderCallbacks'/>
<struct type='{CGDataProviderDirectAccessCallbacks=&quot;getBytePointer&quot;^?&quot;releaseBytePointer&quot;^?&quot;getBytes&quot;^?&quot;releaseProvider&quot;^?}' name='CGDataProviderDirectAccessCallbacks'/>
<struct type='{CGDataProviderDirectCallbacks=&quot;version&quot;I&quot;getBytePointer&quot;^?&quot;releaseBytePointer&quot;^?&quot;getBytesAtPosition&quot;^?&quot;releaseInfo&quot;^?}' name='CGDataProviderDirectCallbacks'/>
<struct typ
<?php
class Foo {
public function __call($name, $arguments) {
echo $name . "\n";
}
public function foo() {
echo "fooooo\n";
}