Skip to content

Instantly share code, notes, and snippets.

View ngn999's full-sized avatar
💭
I may be slow to respond.

ngn999 ngn999

💭
I may be slow to respond.
View GitHub Profile
@ngn999
ngn999 / gist:3787447
Created September 26, 2012 11:24
在emacs里用find, grep

M-x find-grep

这是Emacs里的grep

M-x find-dired

这是Emacs里的find, 结果会用Dired Mode展示.

如果有启用ido-mode, 在指定目录时, 请先C-f取消ido的补全.

@ngn999
ngn999 / gist:3789504
Created September 26, 2012 17:54
如何写一个gitlab的web hook

工具

原理

hook原理

OAuth认证

@ngn999
ngn999 / gist:3791870
Created September 27, 2012 02:38
Regexp::Common

Regexp::Common

这个碉堡了!

use Regexp::Common;

if (/$RE{net}{IPv4}/){
  ...;
}
@ngn999
ngn999 / gist:3793491
Created September 27, 2012 11:12
TC 递归list所有文件.

Ctrl + B

@ngn999
ngn999 / gist:3863072
Created October 10, 2012 04:00
统计某一app来的query的特点
cat http2kfc.20121008  | grep tbskip |head -n 1000000 | 
perl -MURI -MList::Util -nale '$uri = new URI ("/bin/search?" . $F[-1]); 
%h = $uri->query_form; $fat= List::Util::reduce { $a . "_". $b } (keys %h); 
print $fat;'  | sort | uniq -c
@ngn999
ngn999 / gist:3888960
Created October 14, 2012 15:41
穿越分两种

穿越的电视剧,电影看多了, 来个总结, 穿越分两种:

历史是可改变的

代表作, <<回来未来>>系列, <<蝴蝶效应>>系列, <<终结者>>系列, 最近上映的<<looper>>.

这类电影一个主要的假设是: 未来人回到过去, 可以影响历史, 那当然也可以影响这个回去的人.

改变历史, 就带来了平行宇宙.

@ngn999
ngn999 / gist:3904987
Created October 17, 2012 11:10
终端下的"IM"软件

Linux console下给同一台机器上的另一个登陆用户发消息:

write admin pts/3

更多详细内容:

man write

@ngn999
ngn999 / gist:3916505
Created October 19, 2012 06:22
rvm的安装

安装rvm:

user$ \curl -L https://get.rvm.io | bash -s stable

可能得多试几次, 不知道和功夫网有没有关系

设置好环境:

echo "source /home/admin/.rvm/scripts/rvm" > ~/.bashrc
@ngn999
ngn999 / gist:3944107
Created October 24, 2012 05:15
why git?

分布式

更好的web端, syntax highlight, 使用模式, merge request

github

Git tracks content rather than files

Branches are lightweight and merging is easy, and I mean really easy.

@ngn999
ngn999 / gist:3953876
Created October 25, 2012 16:33
一个gdb脚本
set breakpoint pending on
dir /tmp/ksearch_trunk/src/searcher/
file /home/admin/ksearch/bin/sap_server
# core-file /home/admin/ksearch/core.4155
set args  -c /home/admin/ksearch/conf/sap_server_app.cfg -l /home/admin/ksearch/conf/sap_server_log.cfg -k start
# b result_format.cpp:341
b ResultFormat::formatPB(SearchResult const&, K3Shop&) if search_result.query_info->uid == 67740708
b ResultFormat::docFormatPB(QueryInfo*, Document const*, std::vector<FieldInfo*, std::allocator<FieldInfo*> > const&, K3Document*) if query_info->uid == 67740708
ignore 2 15