Skip to content

Instantly share code, notes, and snippets.

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

hellojinjie hellojinjie

🏠
Working from home
View GitHub Profile
@hellojinjie
hellojinjie / .vimrc
Created April 28, 2012 06:07 — forked from htom78/.vimrc
Set up Vim on Mac or Linux. curl https://raw.github.com/gist/532968/vim.sh | sh
" this is the configuration file for linux and mac systems
" symlink this to your home folder as .vimrc
" It loads pathogen and loads all modules from ~/.vim/bundles.
" It then loads ~/.vimrc_main which has the main
" configuration that works across all systems.
call pathogen#runtime_prepend_subdirectories(expand('~/.vim/bundles'))
call pathogen#helptags()
source ~/.vimrc_main
@hellojinjie
hellojinjie / XinDianBaoSessionService.java
Created September 2, 2012 08:48
top sync user session serivice
package com.xindianbao.isv;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.concurrent.ExecutionException;
import com.google.common.cache.CacheBuilder;
package com.xindianbao.isv;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.gearman.Gearman;
import org.gearman.GearmanClient;
import org.gearman.GearmanServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@hellojinjie
hellojinjie / UrlParse.java
Last active August 21, 2019 06:33
五种不同的 URL 参数解析方法的性能比较
package conger;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
@hellojinjie
hellojinjie / 五种不同的 URL 参数解析方法的性能比较.md
Last active November 22, 2022 04:02
五种不同的 URL 参数解析方法的性能比较

五种不同的 URL 参数解析方法的性能比较

因为在我们的项目中需要解析日志中的 URL 的参数,所以我对比了一下五种不同 的 URL 参数解析方法的性能。

##URL 参数解析方法:

  1. httpclient org.apache.http.client.utils.URLEncodedUtils

@hellojinjie
hellojinjie / repair-maven-local-repository.sh
Created June 26, 2013 13:11
由于网路的原因,我们在下载 jar 包或者 source 的时候,会中断,导致 maven 认为在 central repository 不存在这个文件。 这时我们可以手动删除不完整的 jar 包。
find . -name "*-lastUpdated" -or -name "*-not-available" -exec rm {} \;
find . -size 0 -exec rm {} \;
@hellojinjie
hellojinjie / PS1.sh
Last active December 19, 2015 00:18
酷酷的 PS1 : )
// 第一个是原文的,但是不对的,下面的第二个是我修改的。
// original from http://jamiedubs.com/ps1-collection-customize-your-bash-prompt
// export PS1="\[\e[01;32m\]\u@\h \[\e[01;34m\]\W \`if [ \$? = 0 ]; then echo -e '\e[01;32m:)'; else echo -e '\e[01;31m:('; fi\` \[\e[01;34m\]$\[\e[00m\] "
export PS1="\[\e[01;32m\]\u@\h \[\e[01;34m\]\W \`if [ \$? = 0 ]; then echo -e '\[\e[01;32m\]:)'; else echo -e '\[\e[01;31m\]:('; fi\` \[\e[01;34m\]$\[\e[00m\] "
@hellojinjie
hellojinjie / NaN.java
Last active June 25, 2018 16:22
Java 中判断 Double 是不是 NaN
// 哼,这是个坑,我会跟你说嘛。。。
Double num = Double.NaN
// :(
if (num == Double.NaN) {
System.out.println(num);
}
// :)
@hellojinjie
hellojinjie / 行尾结束符.sh
Last active December 19, 2015 13:48
坑爹的行尾结束符。
#!/usr/bin/env bash
java -jar dbmigrate.jar $*
# 在 windows 中编辑的 shell 脚本复制到 linux 运行出现 : No such file or directory 错误
# 你绝对想不到,上面的代码在 shell 看来应该是下面这样的
#!/usr/bin/env bash^M
java -jar dbmigrate.jar $*^M
# 运行 dos2unix ,去掉 \r 即可。
@hellojinjie
hellojinjie / redis-usage.sh
Created July 11, 2013 05:58
请问这是 column store吗?
$ redis-cli incr next.news.id
(integer) 1
$ redis-cli set news:1:title "Redis is simple"
OK
$ redis-cli set news:1:url "http://code.google.com/p/redis"
OK
$ redis-cli lpush submitted.news 1
OK