Skip to content

Instantly share code, notes, and snippets.

@kano4
kano4 / .vimrc
Created March 8, 2013 11:32
mrubyをquickrun.vimで実行する ref: http://qiita.com/items/595e8f88c8625ea35b82
" quickrun for MRuby
augroup AddFileType
autocmd BufWinEnter,BufNewFile *.mrb set filetype=ruby.mruby
augroup END
let g:quickrun_config['mruby'] = { 'command': 'ruby.mruby' }
#include <stdio.h>
int main(int argc, char const* argv[])
{
FILE *infile;
FILE *outfile;
char buf[256];
int i;
if ((infile = fopen(argv[1], "r")) == NULL) {
rails new $APP_NAME --skip-bundle -T -d postgresql
cd $APP_NAME
git init
# Gemfile
gem 'haml-rails'
group :development, :test do
gem 'thin'
gem 'rspec-rails'
end
@kano4
kano4 / keigo_demo.rb
Created July 29, 2012 00:16
keigoのデモ
require 'keigo'
'TokyuRuby会議'.sama
'今日あいつが来る'.keigo
'あいつが今日から本を読む'.keigo
@kano4
kano4 / draggable
Created May 18, 2012 10:09
make image draggable and search contains by jQuery
$('img').draggable();
$("td:contains('自己資本比率')").next().next().css("text-decoration", "underline");
@kano4
kano4 / port_scan.rb
Created March 30, 2012 08:16
Port Scanner with timeout method.
require 'timeout'
require 'socket'
puts "Enter IP Address to Scan:"
ipaddress = gets
1.upto(1024) {|port|
begin
timeout(5) do
TCPSocket.open(ipaddress.chop, port)
@kano4
kano4 / tdpdf
Created March 23, 2012 03:17
script to convert tex to pdf
@echo off
rem texをpdfに変換
if "%1"=="" goto USAGE
rem if "%1"=="" goto INPUT1
goto INPUT2
rem コマンドでtexファイルを指定
rem :INPUT1
rem set /p INP="Input tex file > "
rem goto CHECK
remote: Failed to start new server.
remote:
remote: * * * tail of '/var/svc/log/site-node-service:default.log' * * *
remote: [ Mar 14 15:37:40 Stopping because all processes in service exited. ]
remote: [ Mar 14 15:37:40 Executing stop method (:kill). ]
remote: [ Mar 14 15:37:40 Executing start method ("env `cat /home/node/node-service/profile` /home/node/.nvm/v0.4.12/bin/node /home/node/node-service/releases/20120314153548/server.js &"). ]
remote: [ Mar 14 15:37:40 Method "start" exited with status 0. ]
remote: env: /home/node/.nvm/v0.4.12/bin/node: No such file or directory
remote: [ Mar 14 15:37:40 Stopping because all processes in service exited. ]
remote: [ Mar 14 15:37:40 Executing stop method (:kill). ]
@kano4
kano4 / active_mq
Created March 9, 2012 06:16
active mq
現在rubyからfirefoxなどを実行する方法を調査中。
クライアント
#!/bin/ruby
require 'yaml'
require 'rubygems'
require 'stomp'
conn = Stomp::Client.new("test", "", "localhost", 61613)
dest = "/queue/stomp_sample"
@kano4
kano4 / User-Agent_setting
Created March 6, 2012 13:33
How to modify User-Agent in Mechanize and Net::HTTP
# Mechanize http://d.hatena.ne.jp/takuya_1st/20120301/1330605502
mech = Mechanize.new
mech.user_agent_alias = 'Windows IE 7’ #キーを指定。
AGENT_ALIASES = {
'Windows IE 6' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
'Windows IE 7' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
'Windows Mozilla' => 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6',
'Mac Safari' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; de-at) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10',
'Mac FireFox' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6',