This file contains hidden or 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
非常简单,假设你用的是 debian 或者是番茄花园 debian, | |
apt-get install racoon | |
racoon 包必须为 0.8+ | |
配置请不要随便更改,否则可能丧失某平台兼容,测试通过:iOS/OSX、黑莓(OS4/5/6/7),WebOS,诺基亚,VPNC等。 | |
软件安装完毕,修改 /etc/racoon/motd ,这是 VPN 连接成功后的 banner,可有可无; | |
修改 /etc/racoon/psk.txt ,这是 VPN 连接的 group name 和 group secret,格式很简单, 一行即可,例如 |
This file contains hidden or 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
Show hidden characters
# Copy the following and place it a file called Leiningen.sublime-build in the Sublime user packages folder (~/.config/sublime-text-2/Packages/User on Linux). | |
# Select this as the build system for the project using Tools/Build System/Leiningen. | |
# You can then bring up the Sublime Command Palette (ctrl+shift+P on Windows/Linux) and issue any of the commands # (build, documentation, clean, run, test, etc). By default, build is bound to ctrl+b and run to ctrl+shift+b. | |
{ | |
"cmd": ["lein", "compile", ":all"], | |
"working_dir": "$project_path", | |
"variants": [ | |
{ "cmd": ["lein", "marg", "-m", "-d", "docs"], |
This file contains hidden or 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
{ | |
"auto_complete_commit_on_tab": true, | |
"bold_folder_labels": true, | |
// "color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme", | |
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme", | |
"ensure_newline_at_eof_on_save": true, | |
"file_exclude_patterns": | |
[ | |
".DS_Store", | |
".tags*", |
This file contains hidden or 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
yum remove -y pptpd ppp | |
iptables --flush POSTROUTING --table nat | |
iptables --flush FORWARD | |
rm -rf /etc/pptpd.conf | |
rm -rf /etc/ppp | |
# check the latest version on http://poptop.sourceforge.net/yum/stable/rhel6/i386/ | |
wget http://poptop.sourceforge.net/yum/stable/rhel6/i386/pptpd-1.3.4-2.el6.i686.rpm | |
wget http://poptop.sourceforge.net/yum/stable/rhel6/i386/ppp-2.4.5-23.0.rhel6.i686.rpm |
This file contains hidden or 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
| Sort | Average | Best | Worst | Space | Stability | Remarks | | |
|---- | |
| Bubble sort | O(n^2) | O(n^2) | O(n^2) | Constant | Stable | Always use a modified bubble sort | | |
| Modified Bubble sort | O(n^2) | O(n) | O(n^2) | Constant | Stable | Stops after reaching a sorted array | | |
| Selection Sort | O(n^2) | O(n^2) | O(n^2) | Constant | Stable | Even a perfectly sorted input requires scanning the entire array | | |
| Insertion Sort | O(n^2) | O(n) | O(n^2) | Constant | Stable | In the best case (already sorted), every insert requires constant time | | |
| Heap Sort | O(nlog(n)) | O(nlog(n)) | O(nlog(n)) | Constant | Instable | By using input array as storage for the heap, it is possible to achieve constant space | | |
| Merge Sort | O(nlog(n)) | O(nlog(n)) | O(nlog(n)) | Depends | Stable | On arrays, merge sort requires O(n) space; on linked lists, merge sort requires constant space | | |
| Quicksort | O(nlog(n)) | O(nlog(n)) | O(n^2) | Constant | Stable | Randomly picking a pivot value (or shuffling the array prior to |
This file contains hidden or 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 KMP { | |
private final int R; // the radix | |
private int[][] dfa; // the KMP automoton | |
private char[] pattern; // either the character array for the pattern | |
private String pat; // or the pattern string | |
// create the DFA from a String | |
public KMP(String pat) { | |
this.R = 256; |
NewerOlder