主页

控制python函数运行时间

yield #!/usr/bin/python # -*- coding: UTF-8 -*- def fab(max): n, a, b = 0, 0, 1 while n < max: yield b # 使用 yield # print b a, b = b, a + b n = n + 1 for n in fab(5): print n 简单地讲,yield 的作用就是把一个函数变成一个 generator,带有 yield 的函数不再是一个普通函数,Python 解释器会将其视为一个 generator, 调用 fab(5) 不会执行 fab 函数,...

阅读更多

PHP

main.php – style JQuery AJAX <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <link rel="icon" href="cat3.png" /> <link rel="stylesheet" type="text/css" href="./styles.css"> <title>Job Manager</title> <!-- JQuery --> <link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.1...

阅读更多

Install Scrapy

Install Scrapy #!/bin/bash yum install -y python3 || yum install -y platform-python || yum install -y python2 if [ ! -e /usr/bin/python ];then if [ -e "/usr/bin/python3" ];then ln -s /usr/bin/python3 /usr/bin/python elif [ -e "/usr/libexec/platform-python" ];then ln -s /usr/libexec/platform-p...

阅读更多

Install Apache+PHP+MySql

Installa Apache #!/bin/bash yum install -y httpd export username=liliang export groupname=liliang # add apache user,group groupadd liliang useradd liliang -g liliang sed -i "s/User apache/User ${username}/" /etc/httpd/conf/httpd.conf sed -i "s/User apache/User ${groupname}/" /etc/httpd/conf/httpd.conf echo ">>>start copy web files"...

阅读更多

Gitlab API

install pip install python-gitlab Documentation API # 通过UMB里面的stream找到project: "stream": "rhel8" # 创建gitlab对象 gl=gitlab.Gitlab('https://gitlab.com/', private_token='dsfd') gl.auth() # 创建工程对象 project = gl.projects.get(project_id) 通过UMB得到mr_id # 得到merge request对象 mr = project.mergerequests.get(mr_id) # 获取mr的changes changes = mr.chan...

阅读更多

Bugzilla API

install pip install python-bugzilla github API # api address BZ = 'https://bugzilla.xxx.com' BZ_API = 'https://bugzilla.xxx.com/xmlrpc.cgi' # create bugzilla bzapi = bugzilla.Bugzilla(BZ_API,user=user,password=pwd) #bzapi.login(user,pwd) # query bug query = bzapi.build_query(bug_id=bugs) query['include_fields'] = ['id', 'status', 'qa_contac...

阅读更多

Execute Script On Boot

Steps 1, create your srcipt under /usr/local/bin [root@dhcp-128-17 ~]# cat /usr/local/bin/start_job_scheduler.sh #!/bin/bash klogin liali 123456 pgrep watchdog.sh || { cd /var/www/html/job_scheduler; ./watchdog.sh & } pgrep ci-manager.sh || { cd /var/www/html/job_scheduler/ci; ./ci-manager.sh &} 2, call your script in /etc/rc.d/rc.loca...

阅读更多