Skip to content

Instantly share code, notes, and snippets.

View hryk's full-sized avatar
🏠
Working from home

Hiroyuki Nakamura hryk

🏠
Working from home
View GitHub Profile
#!/usr/bin/ruby
require 'java'
require File.dirname(__FILE__) + "/../jars/commons-logging-1.1.1.jar"
require File.dirname(__FILE__) + "/../jars/httpcore-4.0.1.jar"
require File.dirname(__FILE__) + "/../jars/httpclient-4.0.1.jar"
import "org.apache.http.client.ResponseHandler"
import "org.apache.http.client.HttpClient"
@hryk
hryk / areaimol.pl
Created August 31, 2010 00:44
wrapper for AREAIMOL (in CCP4)
#!/usr/local/bin/perl
use strict;
use warnings;
use Carp;
use IPC::Run qw/start pump finish timeout run/;
use Getopt::Long;
use Term::ProgressBar;
use File::Which;
use FindBin qw/$Bin/;
use Data::Dumper;
@hryk
hryk / bundles.vim
Created September 4, 2010 18:32
my vimrc
set nocompatible
filetype off " for Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" github repos
Bundle 'Shougo/neocomplcache.git'
@hryk
hryk / vim_setting.sh
Created September 4, 2010 18:54
vim_setting.sh
#!/bin/sh
## FUNCTIONS
from_url_to_path(){
if [ $# -ne 1 ]; then echo "ArgumentError" && return 1; fi;
dirname=`echo $1 | sed 's/^git:\/\/github.com\/.*\///g' | sed 's/\.git$//g'`;
echo "$VIMSET_TMPDIR/$dirname";
return 0;
};
# from http://devoh.com/posts/2009/03/couchdb-leopard
# First, create the _couchdb user.
sudo dscl . create /Users/_couchdb UniqueID 115
sudo dscl . create /Users/_couchdb PrimaryGroupID 115
sudo dscl . create /Users/_couchdb RealName "CouchDB Server"
sudo dscl . create /Users/_couchdb NFSHomeDirectory /usr/local/pgsql/
sudo dscl . create /Users/_couchdb Password "*"
sudo dscl . append /Users/_couchdb RecordName couchdb
@hryk
hryk / dataurl.pl
Created October 26, 2010 10:05
generate data url.
#!/usr/bin/env perl
use strict;
use warnings;
use File::MimeInfo::Magic;
@File::MimeInfo::DIRS = qw(/usr/local/share/mime/);
File::MimeInfo->rehash();
use URI;
@hryk
hryk / constantize_with_context.rb
Created March 9, 2011 06:45
constantize_with_context
class String
def constantize_with_context(context=nil, args={:raise => true})
unless context.nil?
begin
const = context.const_get self.to_sym
rescue NameError => e
if args[:raise]
raise e
else
return constantize_without_context
# Gemfile
gem "ffi-rzmq"
# application.rb
module Foo
class Application
...
config.zeromq_context = ZMQ::Context.new
...
puts 'test'
puts 'foovar'
@hryk
hryk / Protscale.pm
Created April 20, 2011 09:29
Bio::Tools::Protscale
package Bio::Tools::Protscale;
use strict;
use warnings;
use base qw(Bio::Root::Root);
use LWP 5.64;
use HTML::TreeBuilder::XPath;
use Data::Dumper;
=head1 NAME