# Fetch all commits
git fetch upstream master
# Find the commit id of last merge
git log
# Generate patches per commit
git format-patch -o <patches dir> <last merge commit id>
# git_svn_repo should be a clean svn repository
git_svn_repo=<path>
git_repo=<path>
git_remote_repo=<url>
git_user_email=<email>
git_user_name=<name>
cd $git_svn_repo
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
#!/bin/bash | |
hexo clean | |
rm -rf .deploy | |
hexo deploy | |
git add -A . | |
git commit -m "Update sources" | |
git push |
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
# encoding: utf-8 | |
# ---------------------------------------- | |
# 最终的解决方案是利用这个脚本生成的URL, | |
# 通过迅雷下载所有的文件 | |
# ---------------------------------------- | |
Encoding.default_internal = Encoding::UTF_8 | |
Encoding.default_external = Encoding::UTF_8 |
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
#!/bin/bash | |
HOST=$(hostname) | |
function install_postfix() { | |
echo | sudo debconf-set-selections <<__EOF | |
postfix postfix/root_address string | |
postfix postfix/rfc1035_violation boolean false | |
postfix postfix/mydomain_warning boolean | |
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 |
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
<?xml version="1.0" encoding="utf-8"?> | |
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" | |
xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" | |
height="100" | |
width="100"> | |
<fx:Declarations> | |
<s:ArrayCollection id="damages"> | |
<fx:Array> | |
<fx:Object damage="damage1" |
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 JaroWinklerDistance { | |
public static void main(String[] args) { | |
String s1 = "MARTHA"; | |
String s2 = "MARHTA"; | |
// String s1 = "MARTHA"; | |
// String s2 = "MARHTA"; | |
// int range = Math.floor(Math.max(s1.length(),s2.length())/2) - 1 = 2; | |
// int isMatched = (s1.charAt(row) == s2.charAt(col) && Math.abs(row - col) <= range) ? 0 : 1; | |
// 0 1 2 3 4 5 t | |
// M A R H T A |
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 LongestCommonSubstring { | |
public static void main(String[] args) { | |
String str1 = "21232523311324"; | |
String str2 = "312123223445"; | |
String lcs = lcs(str1, str2); | |
System.out.println(lcs); | |
System.out.println(lcs.length()); | |
} |
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 LongestCommonSequence { | |
public static void main(String[] args) { | |
String str1 = "ABCBDAB"; | |
String str2 = "BDCABA"; | |
String lcs = lcs(str1, str2); | |
System.out.println(lcs); | |
System.out.println(lcs.length()); | |
} |
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 Main { | |
public static void main(String[] args) { | |
test("<html*", "<html></html>"); | |
test("12*?", "12345"); | |
test("12*4?", "12345"); | |
} | |
private static void test(String pattern, String input) { | |
Pattern p = Pattern.compile(pattern); | |
System.out.println(pattern + " : " + input + " matches? " |