预览模式: 普通 | 列表

install apt for cygwin

用过debian的人都感慨其apt的强大,方便,如果cygwin也能有apt那多好啊,已经有人实现了这个梦想
这个apt是用python写的,首先你要有python
然后
cd /bin
wget http://www.lilypond.org/~janneke/software/cyg-apt
chmod a+rx cyg-apt
好像默认的mirror都不好使,我建议改成anl的
修改一下脚本里边的mirror,改成http://mirror.mcs.anl.gov/cygwin
然后最好改个名字cyg-apt太土了,mv cyg-apt apt
apt setup
apt update
然后需要什么就apt install,其他的就看帮助就OK了

查看更多...

分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 50

hook commit with python

 ======================================== pre-commit

#!/usr/bin/python 

 import sys, os, string

 SVNLOOK = '/usr/bin/svnlook'

 def check_commit_message (repos, txn) :

    log_cmd = '%s log -t "%s" "%s"' % (SVNLOOK, txn, repos)

    log_msg = os.popen(log_cmd, 'r').readline().rstrip('\n')

    sys.stderr.write ("\n\nCommand:\n"+log_cmd)

    sys.stderr.write ("\n\nBelow is the fuck message : \n"+log_msg)

    if len(log_msg) < 10 :

        sys.stderr.write ("\n\n------------------------ Error -----------------------\n\n")

        sys.stderr.write ("Please enter the fuck commit message\n")

        sys.stderr.write ("\n------------------------------------------------------\n")           

        sys.exit(1)

    else :

        # waring if there no ticket-no

        sys.exit(0)

 

def check_commit_character ( txn ):

    #log_cmd = '%s changed -t "%s" "%s"' % (SVNLOOK, txnrepos).grep "[^a-zA-Z0-9._/]"

    #log_msg = os.popen(log_cmd, 'r').readline().rstrip('\n')

    sys.exit0 )

 

def main(repos, txn) :

    check_commit_message(repos, txn)

if __name__ == '__main__' :

    if len(sys.argv) < 3 :

        sys.stderr.write("Usage: %s REPOS TXN\n" % (sys.argv[0]))

    else :

        main(sys.argv[1], sys.argv[2])

 

======================================== post-commit

#!/usr/bin/python

import sys, os, string

def main( repos, txn ) :
    pjt_name = repos.split('/')[-1]
    
    if not os.path.exists('/home/repos_4_ci') :
        os.system('cd /home/;mkdir repos_4_ci')
       
    if not os.path.exists('/home/repos_4_ci/'+pjt_name) :
        os.system('cd /home/repos_4_ci/;svn co file:///home/svn/'+pjt_name+' '+pjt_name)
    
    os.system('cd /home/repos_4_ci/'+pjt_name+'/trunk;svn up;ant test;')
    sys.exit(0)


if __name__ == '__main__' :
    #sys.exit( main(sys.argv) )
    sys.exit( main(sys.argv[1], sys.argv[2]) )

分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 82

回忆中考

中考是2天半,

6点多起床,天已大亮。 洗脸刷牙吃饭完毕已经7点半了,骑脚踏车去县里考试, 车龙头双挂一个塑料袋,里面是我的笔和准考证,口袋里装着20块钱。
慢慢骑,怕太累影响考试。 

红红的太阳, 凉爽的风,皮肤有丝丝凉意,山里的清晨的风带着草木味丝丝入鼻。 风从袖口和扣子间进入胸膛 明显感觉到背后的衣服和皮肤分离 

大约1个小时就到了县一中
准备下 差不多就进考场了。
考完试,中午在县里到处晃悠, 当然是没地方睡午觉的啦, 穿着一双破烂的黄拖鞋 土里土气的到处晃, 晃到快考试了, 就慢悠悠的回到一中
进行下午的考试
考试完毕 再次骑上脚踏车踩回镇里。 这就可以肆意妄为了, 上坡采用S型方式拼命的蹬, 下坡放开刹车 耳边呼呼生风 甚是凉爽 如此反复直至奋力到湖田。
大桥仿佛就再望了, 快到家了。 20来里山路在半个小时不到就OVER了。

查看更多...

分类:Life | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 92

Fetch HTML with BeautifulSoup

python is powerful & flexible, i have never get in touch with it before, but i write a small tool for HTML fetch in less than 3 hours.

# ****************************************************************************

#

#

# ****************************************************************************

from BeautifulSoup import BeautifulSoup

import os

import shutil

import sys

import re

import cgi

import httplib

import urllib

import urlparse

import time

from time import gmtime, strftime

 

# 92

MAX_PAGES = 20;

HOST_URL = "http://www.y8.com";

ASSETS_ROOT_PATH = 'uploadgame'

IHAPPYGAME_HOST_URL = "http://www.sshc625.com"

 

def downloadCallback(bytesLoaded, bytesTotal, fileSize) :

    """

    callback function of signal thread downloading

    """

    prec=100.0*bytesLoaded*bytesTotal/fileSize

    if 100 < prec :

        prec = 100

    #sys.stdout.write("%.2f%%"%(prec,)+"    ")

    sys.stdout.write(".")

    sys.stdout.flush()

 

def  getAssetName( url ):

    """

    fetch swf/image name from url

    """

    arr = url.split('?')[0].split("/")

    return arr[-1]

 

 

def getHTMLDocWith (url):

    page = urllib.urlopen( url );

    doc = page.read();

    page.close();

    return doc

 

def getAllHTMLNodesWith (doc, nameValue, attrsValue) :

    soup = BeautifulSoup(doc, fromEncoding="gb2312")

    soup.prettify()

    return soup.findAll(name=nameValue, attrs=attrsValue)

   

def getHTMLNodeWith (doc, nameValue, attrsValue) :

    soup = BeautifulSoup(doc, fromEncoding="gb2312")

    soup.prettify()

    return soup.find(name=nameValue, attrs=attrsValue)

 

def postGameDetails2Server ( parameters ):

    headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}

    conn = httplib.HTTPConnection("sshc625.com:80")

    conn.request("POST", "http://www.sshc625.com/api.php?op=game", parameters, headers)

    conn.close()

 

 

def main(argv) :

    for i in range(1, MAX_PAGES+1) :

        LIST_URL = HOST_URL +"/?page="+str(i)

        print LIST_URL       

        divNodes = getAllHTMLNodesWith( getHTMLDocWith(LIST_URL), "div", {"class" : "thumb"})

        for divNode in divNodes:

            description = ''

            content = ''

            tags = ''

            rating = 0

            doc = getHTMLDocWith(HOST_URL+divNode.a['href'])

           

            # description & control

            tdNodes = getAllHTMLNodesWith(doc, "td", {'class':'show-block half-page'})           

            description = tdNodes[0]

            content = tdNodes[1]

            # tags

            tagNode = getHTMLNodeWith(doc, "div", {'class':'tags-inner'})

            for a in tagNode.fetch('a'):

                tags += a.string+","

            # rating

            spanNode = getHTMLNodeWith(doc, "span", {'id':'voting-statistics-rating'})

            rating = spanNode.string.strip().replace('%', '')

   

            # mkdir

            if os.path.exists( ASSETS_ROOT_PATH ) == False:

                os.mkdir( ASSETS_ROOT_PATH )           

            gmaeFolder = ASSETS_ROOT_PATH+"/"+divNode.a['title']

            if os.path.exists( gmaeFolder ) :

                shutil.rmtree( gmaeFolder )

            os.mkdir(gmaeFolder)

 

            # download

            print "download game start --------------->>"+divNode.a['title']

            urllib.urlretrieve(divNode.img['src'], gmaeFolder+"/"+getAssetName(divNode.img['src']), downloadCallback)

            urllib.urlretrieve(divNode.a['data-url'], gmaeFolder+"/"+getAssetName(divNode.a['data-url']), downloadCallback)

            print "download game ended"

           

            # file size

            fileSize = os.path.getsize( gmaeFolder+"/"+getAssetName(divNode.a['data-url']) )

 

            # insert DB

            parameters = urllib.urlencode({    'title':divNode.a['title'], \

                            'swfurl':IHAPPYGAME_HOST_URL+"/"+gmaeFolder+"/"+getAssetName(divNode.a['data-url']), \

                            'thumb ': IHAPPYGAME_HOST_URL+"/"+gmaeFolder+"/"+getAssetName(divNode.img['src']),\

                            'description':description,\

                            'content':content,\

                            'size':fileSize,\

                            'tag':tags,\

                            'rating':rating

                            })

            #print parameters

            postGameDetails2Server( parameters )

 

 

if __name__ == "__main__" :

    sys.exit(main(sys.argv))

分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 115

神仙打架 凡人绕行

 在“中国发展高层论坛2012”年会上,北京大学光华管理学院原院长、教授张维迎表示,国有企业已成为未来中国成长的最主要的障碍之一。

    张维迎称,未来几年,中国在经济领域上要做三件事情,一是国有企业的私有化;二是土地的私有化;三是金融的自由化。

    谈及国有企业的问题,张维迎说,很难想象在国有企业占到如此大的比重、如此重要的地位的情况下,中国能够进入真正的资产经济,国有企业已经成为未来中国进一步成长的一个主要的障碍之一。

    “这件事情本身并不难。大量国有企业,尤其中央的国有企业都已经上市,他们的股票都有价格,可以通过市场转让这些股份到非国有部门和个人,也可以通过像英国那样半转让、半赠送的办法分给普通的老百姓。我想如果这个步骤采取之后,中国居民的财富就可以得到一个比较大的增长。”

改革,难免要伤害一部分人的既得利益, 西南地区某市领导下位 证明目前还是改革派控制了局势。

神仙打架 凡人绕行

分类:经济 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 108

国家鼓励脚踏实地好

 3月5日下午,国务院副总理张德江参加浙江代表团审议,点名表扬了几名浙商,包括宗庆后、鲁冠球 等,称他们是做实业的行家里手

 
 
宗庆后认为:“民营经济要回归实体经济,毕竟虚拟经济是分配财富的,实体经济是创造财富的。如果大家都不创造财富,都是分配财富,我觉得最后是要出大问题的。当然现在做实体经济,税费比较高一点,感觉到难度比较大一点。但是通过科技创新,提高产品附加值,仍旧能把实体经济搞上去。”
 
作为中国首富,宗庆后的生活并没有大家想象中那么怡然自得,他说:“我没有太多时间去购物,每天早上7点前到公司,晚上11点半才回家。我的幸福感不如娃哈哈的员工。”
 
娃哈哈员工的幸福感很大程度上来自于不错的生活保障和职业上升渠道。“我们向政府申请经济适用房,每平方给予1200元的补贴,现在有1000名员工受益。我们有58个生产基地,已在海宁、成都、重庆的基地内建起廉租房,河北和湖北的准备开始建,面积大概在70-90方,员工就算退休了都可以继续住下去。附近还有生活配套。”宗庆后说。
 
记者注意到,宗庆后本人对首富这个帽子并不是很“感冒”。他身边的工作人员说,太八卦
分类:经济 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 138

How to del .svn nestly

find . -name "*.svn" -type d -print -exec rm -rf {} \;

查看更多...

分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 124

scp without password between cygwin and Linux

1. ssh-keygen -t rsa

2. Below is the message(type 'Enter' 3 times)

3. scp /.ssh/id_rsa.pub root@server/root/.ssh/authorized_keys
 
Done
分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 108

1.       Use RelativeLayout as the root-container.

2.       Add android.widget.RelativeLayout.ALIGN_PARENT_BOTTOM rule for LayoutParameter

 

android.widget.RelativeLayout root = new android.widget.RelativeLayout(this);

// main

main = new LinearLayout(this);

main.setOrientation(LinearLayout.VERTICAL);

this.chageBackground();

// -----------------------------------------------------------------------------------------

//  ad View   

net.youmi.android.AdView youmiAdView = new net.youmi.android.AdView(this);

LayoutParams youmiAdViewLayoutParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);    

main.addView(youmiAdView, youmiAdViewLayoutParams);

// text

// -----------------------------------------------------------------------------------------

textView = new TextView(this); 

textView.setTextColor(0xFF212121);

main.addView(textView); 

root.addView(main);

// ------------------------------------------------------------------------------------------

// refresh item

LinearLayout pageViewLayout = new LinearLayout(this);      

android.widget.RelativeLayout.LayoutParams lp = new android.widget.RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

lp.addRule(android.widget.RelativeLayout.ALIGN_PARENT_BOTTOM);

pageViewLayout.setLayoutParams(lp);

android.widget.ImageView prevPageView = new android.widget.ImageView(this);

prevPageView.setImageResource(R.drawable.prevpage);

prevPageView.setMaxWidth(dm.widthPixels/2);

android.widget.ImageView nextPageView = new android.widget.ImageView(this);

nextPageView.setImageResource(R.drawable.nextpage);

nextPageView.setMaxWidth(dm.widthPixels/2);

pageViewLayout.addView(nextPageView);

root.addView(pageViewLayout);

 

分类:MobileDev | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 108

该杀

 河北一男子散布“保定再现非典”被劳教两年

 

如果传播开来, 将给国家民族造成无可估量的损失

分类:经济 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 125

虽然卑微 心却愿国家强大 万家灯火

 愿国家强大 民族复兴 不要有离人泪 不要有病痛折磨 不要有贫穷困苦 老天保佑我们吧

分类:Life | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 101

檄文

百科名片
檄文是古代用于征召,晓谕的政府公告或声讨、揭发罪行等的文书。现在也指战斗性强的批判,声讨文章。

近几年大幅报道农业 水利 结果4万亿投入农业水利设施
前段时间大幅报道过路费 物流垂死挣扎 结果逐步取消过路费 
前段时间报道铁道部各种问题, 很快铁道部高级领导下课了, 显然带来的是一系列改革。
现在到处报道中石油 中石化, 那么。。。。。。。。。
接下来是谁? 可能是电信
接下来是谁? 可能是煤炭企业

最近报道孩子上学难 户籍制度制约人才发展, 中小城市放开户籍制度, 大城市一部分人才回流到中小城市, 内地中小城市要发展起来

查看更多...

分类:经济 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 97

协调不容易

将一系列性格不同的人组织在一起 协同完成一项工作
是对一个人能力 为人品行的考验
获益颇多

想想以前,我也犯错好多, 做错好多, 让人恼火好多 

还是心要谦虚 不要生气 不要着急 要真诚 认真 用心, 老话说过无数次 都是人生好道理

换位思考, 如果能做到下一步是客人 事情就顺利好多

渐渐明白协调管理确实一项带来大价值的事情。

查看更多...

分类:Life | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 108

经过

好听

分类:Life | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 120

What i am faced with of redmine

1. Un-acceptable slow speed.

2. Associated revisions won't auto update unless visit Repository first.

3. Integrate with hudson

4. No good wiki plug-in

分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 106

startup Quixote on cygwin

Download the lastest Quixote from http://quixote.ca and extract to C:

$ cd c:\Quixote-2.7
$ python setup.py install
$ cd build\lib.cygwin-1.7.9-i686-2.6\quixote
$ python server/simple_server.py

access http://localhost:8080


查看更多...

分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 114

Install hudson on ubuntu

$sudo apt-get update
$sudo apt-get install ant
$sudo apt-get install checkstyle
$sudo apt-get install subversion
$sudo sh -c "echo 'deb http://hudson-ci.org/debian binary/' > /etc/apt/sources.list.d/hudson.list"
$sudo apt-get update
$sudo apt-get install hudson

http://127.0.0.1:8080/

查看更多...

分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 123

how to uninstall redmine plugin

My redmine doesn't work after i installed wiki-extension plugin. 

1. $cd /usr/share/redmine/vendor/plugins
2. $sudo service apache2 stop
3. $sudo -rf -rf plugin-which-you-want-to-uninstall
4. $sudo service apache2 restart

Now, it work properly. LOL

查看更多...

分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 131

my cygwin conf

1. locate specific folder
append cd ./../../cygdrive/e/code-respository/ in C:\cygwin\home\Administrator/.bashrc

 

2. start rxst with cygwin.bat
@echo off
C:
chdir \cygwin\bin
start rxvt -sr -sl 10000 -fg #dbeff9 -bg #35112A -fn fixedsys -fb fixedsys -geometry 165x42+10+10 -tn cygwin -e /bin/bash --login -i

3. syntax conf

点击下载此文件

分类:Linux | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 129

2012是最艰难的一年

电动车行业 节能减排 UP UP UP
其他萧条

查看更多...

分类:经济 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 114