使用python自动生成docker nginx反向代理配置
由于在测试环境上用docker部署了多个应用,而且他们的端口有的相同,有的又不相同,数量也比较多,在使用jenkins发版本的时候,不好配置,于是想要写一个脚本,能在docker 容器创建、停止的时候,自动生成nginx反向代理,然后reload nginx 我的原则是尽量简单,轻量,内存占用少 目标很明确,只要能监听到docker的容器启动/停止事件,即可 网上查了一下可以用docker...
View ArticleLearn How to Use the Python Virtual Environment
Whether you are an experienced python developer, or you are just getting started, learning how to setup a virtual environment is essential for any Python project. Join me as I cover everything you need...
View ArticleRotate images (correctly) with OpenCV and Python
Let me tell you an embarrassing story of how I wasted three weeks of research time during graduate school sixyears ago. It was the end of my second semester of coursework. I had taken all of my exams...
View ArticlePhilip Semanchuk: How Best to Coerce Python Objects to Integers?
Summary In my opinion, the best way in python to safely coerce things to integers requires use of a ‘naked’ except, which is a construct I almost never want to use. Read on to see how I arrived at this...
View Article2016回顾和2017展望
再过几天,2016年就过去了,在作总结前先看看去年的展望在今年到底实现了多少。 1、做一款个人 APP 并上架 在10月底的时候,总算把Beats 初稿完成,并在 Github 上开源,断断续续的花了4个月时间。整个应用尽量遵循了 Google 的 Material Design ,并第一次使用 MVP + Rxjava...
View ArticleJulien Danjou: Packaging Python software with pbr
Packaging python has been a painful experience for long. The history of the various distribution that Python offered along the years is really bumpy, and both the user and developer experience has been...
View ArticleMastering Python Design Patterns
Patterns mean “I have run out of language.” - Rich Hickey...
View ArticlePython Anywhere: Building a simple Telegram bot using PythonAnywhere
There's an explosion of chat apps and bots at the moment, and it's easy to see why. They're a useful new way of interacting with computer systems, they're interesting to code, and they're actually...
View ArticleIntroducing transmute-core: quickly create documented, input validating APIs...
A majority of my career has been spent on building web services in python. Specifically, internal ones that have minimal or no UIs, and speak REST (or at least are rest-ish). With each new service, I...
View ArticlePython 重复造轮子/找案例,你都应该熟读该文
Chardet,字符编码探测器,可以自动检测文本、网页、xml的编码。 colorama,主要用来给文本添加各种颜色,并且非常简单易用。 Prettytable,主要用于在终端或浏览器端构建格式化的输出。 difflib,[python]标准库,计算文本差异 Levenshtein,快速计算字符串相似度。 fuzzywuzzy,字符串模糊匹配。 esmre,正则表达式的加速器。...
View Article我的开源 GitBook: Python 之旅
在学习和使用 python 的过程中,我作了不少笔记,并对一些笔记进行了加工和完善,发表在博客上。随着笔记的增加,我就萌生了写一本书的想法,希望能比较系统地总结相关知识,巩固自己的知识体系,而不是停留在『感觉好像懂了』的状态中。 有了想法之后,接下来就要开始写了。当然,从产生想法到付诸实践还是纠结了一段时间,毕竟,作笔记和写书很不一样啊。思想斗争过后,我下定决心要把它写出来。...
View ArticleImage Mosaics With Python
I'm sure you've seen an image mosaic before. Each pixel in the original image has been replaced with an entire image. The tiled, jagged result usually resembles the original image at a distance and,...
View ArticleTalk Python to Me: #93 Spreading Python through the sciences with Software...
Episode #93: Spreading python through the sciences with Software Carpentry Published Tues, Jan 3, 2017, recorded Tues, Dec 6, 2016. ( embed this episode via SoundCloud ) You often hear that we need to...
View Article基于 Python编写的Shodan IP信息采集脚本
from shodan import Shodan from shodan.helpers import open_file, write_banner from shodan.cli.helpers import get_api_key from sys import argv, exit # Input validation if len(argv) != 3: print('Usage: {}...
View Article用django创建一个项目
首先你得安装好python和django,然后配置好环境变量,安装python就不说了,从配置环境变量开始 1.配置环境变量 在我的电脑处点击右键,或者打开控制面板\系统和安全\系统 -> 左边导航栏的“高级系统设置”->环境变量 -->然后你会看到下面这个界面 -> 点击这个path,然后点编辑 然后找到C:\Python27文件夹,将这个文件夹添加进去。...
View ArticleThe "Build Script" Idea
In compiled languages, the build script or makefile is pretty important. Java has maven (and gradle and ant) for this job. python doesn't really have much for this. Mostly because it's needless....
View ArticlePyTennessee: PyTN Profiles: Adrienne Lowe and Meeple Mountain
Speaker Profile: Adrienne Lowe ( @adriennefriend ) Adrienne Lowe is a former personal chef from Atlanta who documents her experience learning python & teaching others to cook atCoding With Knives...
View ArticleIntroducing ical-archiver to split out old iCalendar entries
Do you have a large iCalendar file with lots of old entries, and would like to archive them to save space and resources? At least those of us using KOrganizer know that turning on and off an event set...
View ArticlePython格式化字符串漏洞(Django为例)
在C语言里有一类特别有趣的漏洞,格式化字符串漏洞。轻则破坏内存,重则读写任意地址内容,二进制的内容我就不说了,说也不懂,分享个链接 https://github.com/shiyanlou/seedlab/blob/master/formatstring.md python中的格式化字符串 Python中也有格式化字符串的方法,在Python2老版本中使用如下方法格式化字符串: "My name...
View Article