Skip to content

Instantly share code, notes, and snippets.

View larryzhao's full-sized avatar
🐱
Meow

Larry Zhao larryzhao

🐱
Meow
View GitHub Profile
@larryzhao
larryzhao / ls -ld rvm_path
Created May 29, 2012 16:51
Output of installing rvm system widely
$ ls -ld $rvm_path/*
-rw-rw-r-- 1 root rvm 566 May 30 00:54 /usr/local/rvm/LICENCE
-rw-rw-r-- 1 root rvm 8662 May 30 00:54 /usr/local/rvm/README
-rw-rw-r-- 1 root rvm 7 May 30 00:54 /usr/local/rvm/RELEASE
-rw-rw-r-- 1 root rvm 7 May 30 00:54 /usr/local/rvm/VERSION
drwxrwsr-x 2 root rvm 4096 May 30 00:43 /usr/local/rvm/archives
drwxrwsr-x 2 root rvm 4096 May 30 00:54 /usr/local/rvm/bin
drwxrwsr-x 2 root rvm 4096 May 30 00:54 /usr/local/rvm/config
drwxrwsr-x 3 root rvm 4096 May 30 00:15 /usr/local/rvm/contrib
drwxrwsr-x 2 root rvm 4096 May 30 00:45 /usr/local/rvm/environments
@larryzhao
larryzhao / error
Created May 30, 2012 03:58
Permission denied error when `rvm get stable`
$ rvm get stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 185 100 185 0 0 441 0 --:--:-- --:--:-- --:--:-- 1456
100 9249 100 9249 0 0 8117 0 0:00:01 0:00:01 --:--:-- 8117
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 125 100 125 0 0 140 0 --:--:-- --:--:-- --:--:-- 174
100 1045k 100 1045k 0 0 304k 0 0:00:03 0:00:03 --:--:-- 440k
@larryzhao
larryzhao / error
Created May 30, 2012 12:19
torquebox launch error when using zip install
$ $JBOSS_HOME/bin/standalone.sh
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/web/torquebox-current/jboss
JAVA: java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml -Xss2048k
@larryzhao
larryzhao / ie9_bug.js
Created June 17, 2012 15:11
IE9 bug reproduction
function func1(flag){
if(flag){
alert("Caller is here!");
}else {
func2();
}
}
function func2(){
arguments.callee.caller(true);
@larryzhao
larryzhao / deploy.rb
Created June 27, 2012 09:52 — forked from bkutil/deploy.rb
Start and Stop tasks for resque workers and resque scheduler with capistrano deploy hook (without God)
after "deploy:symlink", "deploy:restart_workers"
after "deploy:restart_workers", "deploy:restart_scheduler"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
@larryzhao
larryzhao / Capfile
Created June 27, 2012 16:29
Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
@larryzhao
larryzhao / gist:3016272
Created June 29, 2012 06:34
rvm install jruby-1.6.7.2 --1.9 --trace
$ rvm install jruby-1.6.7.2 --1.9 --trace
jruby-1.6.7.2 --1.9 --trace
rvm 1.14.3 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
+ [[ -n '' ]]
+ export 'PS4=+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ PS4='+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ /scripts/cli : __rvm_parse_args() 795 > [[ -z install ]]
+ /scripts/cli : __rvm_parse_args() 797 > [[ 0 -eq 1 ]]
@larryzhao
larryzhao / test.rb
Created July 4, 2012 06:11
Twitter::Autolink breaks in jruby when text contains Chinese or Japanese
# encoding: utf-8
require 'twitter-text'
options = { :username_include_symbol => true }
text = "@baozi hi you are a dog #dog"
text_cn = "@baozi 嗨你是一条狗诶 #狗狗"
text_jp = "@baozi ねえ、あなたは犬だ #犬"
puts "=== original ==="
@larryzhao
larryzhao / result with jruby-1.6.7.2 1.9
Created July 5, 2012 09:28
MatchData.begin(n) always returns 0 on jruby with chinese/japanese characters in it
$ jruby --1.9 -S test.rb
==== Text in English ====
#<MatchData "@chichi dog dog" 1:"@" 2:"chichi" 3:" dog dog">
1. 11
2. 12
3. 18
==== Text in Chinese ====
#<MatchData "@chichi 狗狗" 1:"@" 2:"chichi" 3:" 狗狗">
1. 0
2. 0
// PgTest.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "libpq-fe.h"
#include <iostream>
#include <WinSock2.h>
#include <time.h>
#include <string.h>
#include <sstream>
#include <vector>