Skip to content

Instantly share code, notes, and snippets.

View jollychang's full-sized avatar
🎼
Focusing

William Zhang jollychang

🎼
Focusing
View GitHub Profile
#!/bin/sh
#kill firefox pid
pidlist=`ps -ef|grep firefox | grep -v "grep"|awk '{print $2}'`
#ps -u $USER|grep "java"|grep -v "grep"
echo "firefox Id list :$pidlist"
if [ "$pidlist" = "" ]
then
echo "no firefox pid alive"
else
for pid in ${pidlist}
@jollychang
jollychang / login-douban-by-curl.sh
Created May 5, 2011 07:13
Login Douban by Curl
#登陆豆瓣
#基于协议利用Curl测试页面
#change EMAIL and PASSWORD
curl --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" –L -c cookie -d 'form_email=EMAIL&form_password=PASSWORD&user_login=登录' https://www.douban.com/accounts/login >login.html
#获取我的豆瓣的页面
curl -L -b cookie http://www.douban.com/mine >my.html
#获取某人的友邻列表
curl -L -b cookie http://www.douban.com/contacts/listfriends
#利用其他的东西,获得所有的友邻 #给这个友邻发个豆邮问候一下 cul -d ‘......' http://www.douban.com/
@jollychang
jollychang / filter_and_split_by_select_date.bas
Created May 7, 2011 12:27
filter_and_split_by_select_date
Attribute VB_Name = "split_by_date"
Function split_by_date(start_date)
'
' For My Darling Lotusblue :)
Sheets(1).Select
Cells.Select
Selection.AutoFilter
Public BlockMatchRow(100, 100) As Integer
Public WhoMax(100, 100) As Integer
Public cell_index(2) As Integer
Sub Run()
sheets_number = 3
tv_number = 5 'counter
start_sheet = 2
SetArray sheets_number, start_sheet, tv_number
@jollychang
jollychang / ad_monitor_counter.bas
Created May 25, 2011 15:43
ad_monitor_counter.bas
Dim s_number As Integer
Sub main()
s_number = Sheets.Count
ad_counter "宝马汽车"
ad_counter "节目预告(宝马汽车)"
End Sub
@jollychang
jollychang / gist:1048635
Created June 27, 2011 10:24
selenium and xvfb services @ gentoo
$ head -1000 /etc/conf.d/xvfb* /etc/init.d/{xvfb,selenium-daemon}
==> /etc/conf.d/xvfb <==
XVFB=/usr/bin/Xvfb
XVFBARGS=":90 -auth /etc/conf.d/xvfb.cfg -nolisten tcp"
PIDFILE=/var/run/xvfb.pid
==> /etc/conf.d/xvfb.cfg <==
localhost
==> /etc/init.d/xvfb <==
@jollychang
jollychang / rm_pyc.sh
Created June 29, 2011 03:05
rm all pyc in a project
find . -name "*.pyc" -exec rm -rf {} \;
@jollychang
jollychang / gist:1058032
Created July 1, 2011 07:18
Selenium Grid config script
>>>hub machine (ip=192.168.1.208)<<<
# /etc/init.d/selenium-grid-hub
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
PIDFILE=/var/run/selenium-hub.pid
DISPLAY=:90
#JAVA=/usr/lib/jvm/icedtea6-bin/bin/java
JAVA=/usr/lib/jvm/sun-jdk-1.6/bin/java
@jollychang
jollychang / leech.py
Created July 20, 2011 02:43
automation leech and downlaod with webdriver
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time, os, string
from selenium import webdriver
def downloader(link, host='http://shimory.com/'):
file = open('/Users/jollychang/Downloads/firebug-1.7.3.xpi')
fp = webdriver.FirefoxProfile()
fp.add_extension(file)
b = webdriver.Firefox(fp)

Selenium with Python

Author: Baiju Muthukadan
Email:baiju.m.mail AT gmail.com
Version: 0.4.0