Skip to content

Instantly share code, notes, and snippets.

View utensil's full-sized avatar

Utensil utensil

  • 18:24 (UTC +08:00)
View GitHub Profile
@utensil
utensil / svn_graph.rb
Created August 25, 2011 05:14
ruby script to generate svn revision graph, focus on branching and tagging
#README
# In order to run this script, the following command line tools must be installed:
# 1) a subversion client, under Windows, Slik SVN is recommended: http://www.sliksvn.com/en/download
# 2) a Graphviz toolset, which can be downloaded from http://www.graphviz.org/
# Also the following ruby gems must be installed:
require 'rubygems'
#'xmlsimple'
# gem: http://rubyforge.org/frs/?group_id=638
# doc: http://xml-simple.rubyforge.org/
@utensil
utensil / matrix.html
Created August 28, 2011 12:57
A simple js page to do elementary transformation of matrix.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>matrix</title>
<meta name="author" content="">
<link rel="stylesheet" href="http://www.blueprintcss.org/blueprint/screen.css" _href="../stylesheets/blueprint/screen.css" type="text/css" media="all" />
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/redmond/jquery-ui.css" type="text/css" media="all"/>
@utensil
utensil / gist:1290465
Created October 16, 2011 03:23
gem erubis install fail dump
==ENV==
OS: ubuntu desktop 11.10
RUBY: ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
GEM: 1.3.7
==ERROR LOG==
bundle install
Fetching source index for http://rubygems.org/
Installing rake (0.8.7)
@utensil
utensil / segment.md
Created October 18, 2011 06:24
中文分词那些事
@utensil
utensil / gist:1305822
Created October 22, 2011 09:48
Apache version of https://gist.github.com/1216602, reverse proxy for rubygems
来源:http://baoz.net/use-reves-proxy-fvck-gfw-to-gem-from-rubygem/
用的apache做的反向代理,配置如下
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName rubygems.org
ProxyRequests Off
<Proxy *>
@utensil
utensil / lol.md
Created November 12, 2011 02:19
LOL那些事

LOL那些事

反向工程基本工具

I can't run db-charmer-sandbox on my Ubuntu 11 in any way, no matter rspec, RAILS_ENV=test rails server or RAILS_ENV=test rails console, no matter with ruby 1.9.1 installed by apt-get or ruby 1.9.2 installed by rvm.

It's always the same result(after exhausting CPU and mem):

script/rails:6: stack level too deep (SystemStackError)

I seriously doubt that there is something wrong in the require tree.

@utensil
utensil / binary-debug-tools.md
Created November 17, 2011 02:56
二进制调试那些事
@utensil
utensil / node-and-npm-in-30-seconds.sh
Created February 12, 2012 12:14 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
@utensil
utensil / cpp_relection.md
Created March 10, 2012 02:50
C++反射那些事

对于C++反射,我关心的使用领域包括:模版元编程可以解决的那一部分编译时反射,运行时反射在实现IoC、ORM等中可以让程序员写得更惬意的语法糖衣、DSL,在类Rspec测试和Mock中所需要的对于被测程序非侵入式的信息获取和校验。

http://www.garret.ru/cppreflection/docs/reflect.html , 我们可以了解到在C++中达成反射的基本方法:

Program was build with enabled debugging support and distributed with debugging
ApproachAdvantagesDisadvantages
Parse debugging information
  • Program should not be changed
  • It is possible to extract complete information about types used in the programs