Skip to content

Instantly share code, notes, and snippets.

View novoland's full-sized avatar

Liu Jing novoland

View GitHub Profile
@novoland
novoland / useful_shell.sh
Last active August 29, 2015 14:18
常用shell命令
# 找出java进程并杀掉
ps -ef | grep java | kill -9 `awk '{print $2}'`
# MAC下看某个端口被占用情况 (TCP/LISTEN)
lsof -n -i4TCP:8080 | grep LISTEN
// check sub tree n1 == sub tree n2
bool isSame(const TreeNode* n1, const TreeNode* n2){
if( n1 == NULL && n2 == NULL )
return true;
if( n1 == NULL || n2 == NULL )
return false;
if( n1->data != n2->data )
return false;
@novoland
novoland / Palindrome Partitioning.java
Created August 27, 2014 08:45
Palindrome Partitioning
public class Solution {
Map<String,List<List<String>>> cache = new HashMap<String, List<List<String>>>();
public List<List<String>> partition(String s) {
if(cache.containsKey(s)) {
return cache.get(s);
}
List<List<String>> result = new LinkedList<List<String>>();
if(isP(s)){
@novoland
novoland / word_ladder_2.java
Last active August 29, 2015 14:05
word ladder 2
public class Solution {
String from;
String to;
Set<String> dict;
Map<String,Choice> nextLevel;
Map<String,Choice> curLevel;
public List<List<String>> findLadders(String start, String end, Set<String> dict) {
@novoland
novoland / T.java
Last active August 29, 2015 14:05
package ds;
import java.util.*;
public class Test {
LinkedList<Pos> path = new LinkedList<Pos>();
boolean[][] used;
String target;
@novoland
novoland / BloomFilter.java
Created July 28, 2014 07:13
一个布隆过滤器
package org.hustsse.spider.util;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.BitSet;
import java.util.concurrent.atomic.AtomicInteger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) {
* val = x;
* next = null;
* }
* }
code{margin:0 4px;padding:0 4px;}
.hljs{border-radius:8px;}
.hljs-dark {background: transparent;}
@novoland
novoland / idea.vmoptions
Created July 7, 2014 01:52
修复intellij在ubuntu下的字体渲染问题
-Dawt.useSystemAAFontSettings=lcd
-Dswing.aatext=true
-Dsun.java2d.xrender=true
/*jslint regexp: true, white: true, maxerr: 50, indent: 2 */
function parseURI(url) {
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
// authority = '//' + user + ':' + pass '@' + hostname + ':' port
return (m ? {
href : m[0] || '',
protocol : m[1] || '',
authority: m[2] || '',
host : m[3] || '',