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 | |
# download video by providing video url and cookie. | |
# saved file name will be from Content-Disposition | |
function download() { | |
local url=$1 | |
local cookies=$2 | |
local filename=$(curl -I -L -s --cookie "$cookies" "$url" | grep Content-Disposition | python -c "import sys, urllib as ul; print ul.unquote(sys.stdin.read());" | awk -F\" '{print $2}') | |
echo "start to download $filename" |
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
// http://en.wikipedia.org/wiki/Variance | |
// http://upload.wikimedia.org/math/a/3/3/a336557f138eb90bafc9e6ebc00e926d.png | |
var data = [{x: 1, p: 0.1}, {x: 2, p: 0.3}, {x: 8, p: 0.6}]; //{x:probability} | |
var mu = 0, sigma = 0; | |
for (i in data) { | |
mu += i.p * i.x; | |
sigma += i.p * i.x * i.x; |
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
deb http://ubuntu.v2ex.com/ubuntu/ quantal main restricted universe multiverse | |
deb-src http://ubuntu.v2ex.com/ubuntu/ quantal main restricted universe multiverse | |
deb http://ubuntu.v2ex.com/ubuntu/ quantal-updates main restricted universe multiverse | |
deb-src http://ubuntu.v2ex.com/ubuntu/ quantal-updates main restricted universe multiverse | |
deb http://ubuntu.v2ex.com/ubuntu/ quantal-backports main restricted universe multiverse | |
deb-src http://ubuntu.v2ex.com/ubuntu/ quantal-backports main restricted universe multiverse | |
deb http://ubuntu.v2ex.com/ubuntu/ quantal-security main restricted universe multiverse | |
deb-src http://ubuntu.v2ex.com/ubuntu/ quantal-security main restricted universe multiverse | |
deb http://extras.ubuntu.com/ubuntu quantal main | |
deb-src http://extras.ubuntu.com/ubuntu quantal main |
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
@Test | |
public String readMailTest() throws Exception { | |
Properties props = new Properties(); | |
props.put("mail.imap.host", "imap.sina.cn"); | |
Session session = Session.getDefaultInstance(props); | |
IMAPStore store = (IMAPStore) session.getStore("imap"); | |
store.connect("sgmall_test_001", "sgmall_test_001"); | |
Folder emailFolder = store.getFolder("INBOX"); |
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 com.surdoc.enterprisecloud.web; | |
import java.io.IOException; | |
import java.net.URLDecoder; | |
import java.net.URLEncoder; | |
import javax.servlet.Filter; | |
import javax.servlet.FilterChain; | |
import javax.servlet.FilterConfig; | |
import javax.servlet.ServletException; |
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
@ECHO OFF | |
doskey ls=dir /b $* | |
rem Java | |
set JAVA_HOME=C:\opt\jdk1.6.0_25 | |
set Path=%JAVA_HOME%\bin;%Path% | |
rem Maven | |
set MVN_HOME=C:\opt\apache-maven-3.0.4 |
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
# tcpdump ldap traffic to a file, then can be analyzed by wireshark | |
sudo tcpdump -vv -w /tmp/ldapdump -i lo port 389 | |
#sniff http traffic | |
sudo ngrep -q -d eth0 -W byline host example.com and port 8180 | |
#Search recursively to find a word or phrase in certain file types, such as C code | |
find . -name "*.[ch]" -exec grep -i -H "search pharse" {} \; | column -t -s ":" | |
#search empty folder |
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 | |
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_25 | |
export CATALINA_HOME=/usr/lib/apache-tomcat-7.0.26 | |
export CATALINA_BASE=/srv/hudson-ci | |
export HUDSON_HOME=/srv/hudson-ci/hudson-home | |
export PATH=$JAVA_HOME/bin:$PATH | |
# see http://stackoverflow.com/questions/76327/how-can-i-prevent-java-from-creating-hsperfdata-files | |
# to disable it , use "-XX:-UsePerfData" , |
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
//pure-CSS drop down menus | |
div.menu-bar ul ul { | |
display: none; | |
} | |
div.menu-bar li:hover > ul { | |
display: block; | |
} | |
//image pre-loader | |
function preloadImages() { |
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
description "blog-app server" | |
author "Jay" | |
start on startup | |
stop on shutdown | |
script | |
#Your scripts | |
cd /home/jay/works/blog-app | |
OlderNewer