Skip to content

Instantly share code, notes, and snippets.

@hackfisher
hackfisher / ArrayIntersect.java
Created May 15, 2012 02:26
intersect two int arrays
private static int[] intersect_int_array(int[] array1, int[] array2) {
java.util.Arrays.sort(array1);
java.util.Arrays.sort(array2);
IntList res = new IntList();
for(int index2 = 0, index1 = 0; index2 < array2.length && index1 < array1.length; ) {
if (array1[index1] > array2[index2]) {
index2 ++;
} else if (array2[index2] > array1[index1]) {
index1 ++;
@hackfisher
hackfisher / gist_tag.rb
Created March 31, 2012 01:21 — forked from BinaryMuse/gist_tag.rb
A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
require 'cgi'
require 'digest/md5'
require 'net/https'
require 'uri'
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, token)
super
@text = text
@hackfisher
hackfisher / ftpdownload.txt
Created December 27, 2011 03:08
FTP Download
open 192.168.100.98
Anonymous
bin
prompt
cd code\CN
pwd
get xxx.jar
get yyy.jar
@hackfisher
hackfisher / svn_commit.bat
Created December 27, 2011 03:06
svn commit
echo %PATH%
@echo off
@echo ========================================================
@echo 从ftp上下载最新code jar包,并上传到svn
@echo ========================================================
set DOWNLOAD_HOME=.\
set ENV_HOME=C:\apache-tomcat-5.5.23\webapps\TestCase
if exist DOWNLOAD_HOME goto :update else goto :fail
@hackfisher
hackfisher / restart_service.bat
Created December 27, 2011 03:05
重启Windows服务
@echo off
net stop "Tomcat5"
ping 127.0.0.1 -n 5
net start "Tomcat5"
@echo "Tomcat restart..."
@hackfisher
hackfisher / post-commit-hook-hudson.vbs
Created December 27, 2011 02:58
post-commit-hook-hudson
repos = WScript.Arguments.Item(0)
rev = WScript.Arguments.Item(1)
svnlook = WScript.Arguments.Item(2)
hudson = WScript.Arguments.Item(3)
Set shell = WScript.CreateObject("WScript.Shell")
Set uuidExec = shell.Exec(svnlook & " uuid " & repos)
Do Until uuidExec.StdOut.AtEndOfStream
uuid = uuidExec.StdOut.ReadLine()
@hackfisher
hackfisher / post-commit.bat
Created December 27, 2011 02:57
svn post-commit bat
SET REPOS=%1
SET REV=%2
SET CSCRIPT=C:\WINDOWS\system32\cscript.exe
SET VBSCRIPT=E:\Document\hooks\post-commit-hook-hudson.vbs
SET SVNLOOK=E:\opt\Subversion\bin\svnlook.exe
SET HUDSON=http://xxx.x.x.xxx/hudson/job/code%E6%9E%84%E5%BB%BA%E5%92%8C%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95/
"%CSCRIPT%" "%VBSCRIPT%" "%REPOS%" %REV% "%SVNLOOK%" "%HUDSON%"