This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 找出java进程并杀掉 | |
ps -ef | grep java | kill -9 `awk '{print $2}'` | |
# MAC下看某个端口被占用情况 (TCP/LISTEN) | |
lsof -n -i4TCP:8080 | grep LISTEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ds; | |
import java.util.*; | |
public class Test { | |
LinkedList<Pos> path = new LinkedList<Pos>(); | |
boolean[][] used; | |
String target; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for singly-linked list. | |
* public class ListNode { | |
* int val; | |
* ListNode next; | |
* ListNode(int x) { | |
* val = x; | |
* next = null; | |
* } | |
* } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code{margin:0 4px;padding:0 4px;} | |
.hljs{border-radius:8px;} | |
.hljs-dark {background: transparent;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-Dawt.useSystemAAFontSettings=lcd | |
-Dswing.aatext=true | |
-Dsun.java2d.xrender=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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] || '', |