Skip to content

Instantly share code, notes, and snippets.

View jollychang's full-sized avatar
🎼
Focusing

William Zhang jollychang

🎼
Focusing
View GitHub Profile
@jollychang
jollychang / sync_hg_svn.py
Created August 17, 2011 10:10
sync hg to svn by python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import os, sys
pwd = os.path.dirname(os.path.realpath(__file__))
BASE_PATH = pwd + '/'
#BASE_PATH = '/Users/jollychang/Works/'
HG_FOLDER = 'hg_webtests'
SVN_FOLDER = 'svn_webtests'
:⌉
=⌉
¦-) as opposed to |
⍥ om nom nom
@jollychang
jollychang / leech_from_urllib3.py
Created September 7, 2011 14:20
leech_from_urllib3
import os, urllib3
from BeautifulSoup import BeautifulSoup
def get_data(host, url, fields):
http_pool = urllib3.connection_from_url(host)
r = http_pool.post_url('/index.php', fields)
return r.data
def get_form(data):
@jollychang
jollychang / add torrents by transmission-remote.sh
Created September 8, 2011 08:18
add torrents by transmission-remote
find /home/jollychang/torrent/ -name "*.torrent" -exec transmission-remote -a {} \;
rm /home/jollychang/torrent/*.torrent
@jollychang
jollychang / env
Created September 14, 2011 10:01
Jenkins daemontools run config
head /service/jenkins/env/*
==> /service/jenkins/env/HOME <==
/home/jenkins/
==> /service/jenkins/env/JENKINS_HOME <==
/home/jenkins/
==> /service/jenkins/env/USER <==
jenkins
@jollychang
jollychang / server.xml
Created October 18, 2011 07:09
tomcat config for jenkins
sudo head -1000 /usr/local/apache-tomcat-7.0.22/conf/server.xml
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
@jollychang
jollychang / check_tickets.py
Created November 16, 2011 03:51
check chncpa tickets
# -*- coding: utf-8 -*-
#! /usr/bin/python
import urllib2
import requests
import os
import time
from BeautifulSoup import BeautifulSoup
from pync import Notifier
import sys
reload(sys)
@jollychang
jollychang / TestingUploadSe2Sauce.java
Created February 1, 2012 07:03 — forked from santiycr/TestingUploadSe2Sauce.java
Remote File Upload using Selenium 2's FileDetectors
import junit.framework.Assert;
import junit.framework.TestCase;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.*;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class TestingUploadSe2Sauce extends TestCase {
private RemoteWebDriver driver;
@jollychang
jollychang / TestingUploadSe2Sauce.java
Created February 1, 2012 07:03 — forked from santiycr/TestingUploadSe2Sauce.java
Remote File Upload using Selenium 2's FileDetectors
import junit.framework.Assert;
import junit.framework.TestCase;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.*;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class TestingUploadSe2Sauce extends TestCase {
private RemoteWebDriver driver;
@jollychang
jollychang / jenkins_svn_diff_for_pybot_tags.sh
Created March 13, 2012 07:55
svn diff files for selecting robotframework-seleniumlibrary tags
echo $SVN_REVISION
svn_last_successful_build_revision=`curl $JOB_URL'lastSuccessfulBuild/api/json' | python -c 'import json,sys;obj=json.loads(sys.stdin.read());print obj["'"changeSet"'"]["'"revisions"'"][0]["'"revision"'"]'`
diff=`svn di -r$SVN_REVISION:$svn_last_successful_build_revision --summarize`
files=`echo $diff | awk '{print $2}'`
tag=""
for tag in music book movie ;do if echo "$files" | grep -q $tag; then tags=$tags" -i "$tag; fi; done
echo $tags