Skip to content

Instantly share code, notes, and snippets.

View tawateer's full-sized avatar
Focusing

wateer tawateer

Focusing
  • Tencent
  • Beijing
View GitHub Profile
@tawateer
tawateer / argparse_example.py
Last active August 15, 2022 19:14
python argparse example
#!/bin/env python
""" argparse example.
url: https://mkaz.com/2014/07/26/python-argparse-cookbook/
"""
import argparse
#!/bin/env python
#-*- coding: utf-8 -*-
""" 发布特定分支的 Nginx conf, 这里发布以 autodeploy 开头的分支.
此脚本跑在 Jenkins 任务下, 此任务通过 Jenkins 的 Gerrit Trigger
插件监控 Nginx conf (Gerrit 项目) 的 Ref Updated 和 Change Merged 事件,
而且分支要匹配 **/autodeploy*, 满足条件触发此任务.
1. 先计算出最近一次修改的以 autodeploy 开头的分支,
@tawateer
tawateer / server_info.py
Last active August 29, 2015 14:21
机器信息获取
#/usr/bin/python
#-*- coding: utf-8 -*-
import re
import os
import subprocess
def shell(cmd):
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens