Skip to content

Instantly share code, notes, and snippets.

View imom0's full-sized avatar
💭
I may be slow to respond.

iMom0 imom0

💭
I may be slow to respond.
View GitHub Profile
@imom0
imom0 / python_infrastructure.md
Created October 12, 2012 09:11 — forked from onlytiancai/python_infrastructure.md
python 基础设施讨论贴

python项目通用组件和基础服务

很多公司都大量使用了python,其中有一些开发规范,code guidline, 通用组件,基础框架是可以共用的。

每个公司都自己搞一套, 太浪费人力,我想开一帖和大家讨论一下这些python基础设施的搭建。

原则是我们尽量不重新发明轮子,但开源组件这么多,也要有个挑选的过程和组合使用的过程,在这里讨论一下。

另一方面,有些开源组件虽然强大,但我们不能完全的驾驭它,或只使用其中很少的一部分,我们就可以考虑用python实现一个简单的轮子,可控性更强,最好不要超过300行代码。

@imom0
imom0 / pip.conf
Created October 9, 2012 08:58
use pypi mirror for china
; ~/.pip/pip.conf
[global]
use-mirrors=true
mirrors=http://e.pypi.python.org
index-url=http://e.pypi.python.org/simple
@imom0
imom0 / gist:3844464
Created October 6, 2012 09:18
prime generator
def prime_generator():
_primes = [2]
current = 3
while True:
if all(current % prime != 0 for prime in _primes):
_primes.append(current)
yield current
current += 1
@imom0
imom0 / myopt.py
Created September 10, 2012 15:29
simple gists: argparse vs docopt
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""Test docopt example.
Usage:
myopt.py run (update|watch)
myopt.py -h | --help
myopt.py --version
@imom0
imom0 / ellipsis1.py
Created August 27, 2012 09:23
Ellipsis in python
class MyClass(object):
"""Example of a doctest Ellipsis
>>> thing = MyClass()
>>> # Match <class '__main__.MyClass'> and <class '%(module).MyClass'>
>>> type(thing) # doctest:+ELLIPSIS
<class '....MyClass'>
"""
pass
@imom0
imom0 / firefox-addon-download.log
Created June 24, 2012 18:19
firefox addon wget download log
wget https://addons.mozilla.org/firefox/downloads/latest/287139/addon-287139-latest.xpi
--2012-06-25 02:17:38-- https://addons.mozilla.org/firefox/downloads/latest/287139/addon-287139-latest.xpi
Resolving addons.mozilla.org... 2620:101:8008:5::2:2, 63.245.217.112
Connecting to addons.mozilla.org|2620:101:8008:5::2:2|:443... connected.
HTTP request sent, awaiting response... 301 MOVED PERMANENTLY
Location: https://addons.mozilla.org/firefox/downloads/latest/instantfox/addon-instantfox-latest.xpi [following]
--2012-06-25 02:17:39-- https://addons.mozilla.org/firefox/downloads/latest/instantfox/addon-instantfox-latest.xpi
Reusing existing connection to addons.mozilla.org:443.
HTTP request sent, awaiting response... 302 FOUND
Location: https://addons.mozilla.org/firefox/downloads/file/148122/instantfox_quick_search-2.7.1-fx.xpi [following]
发信人: sujunwei (su_junwei), 信区: linux
标 题: 跪求一段bash命令脚本
发信站: 兵马俑BBS (Wed May 23 11:02:29 2012), 本站(bbs.xjtu.edu.cn)
如题
我想改一个文件夹里面里面的文件,文件名字知道,路径需要查找,然后将对应的文件名修
改一个名字
比如需要将当前文件夹或者子文件夹中的 file1、 file2、files3 ...改为_file1、
@imom0
imom0 / rename.sh
Created May 7, 2012 08:14
rename png files
#!/bin/bash
count="1"
for i in *.png; do
mv "$i" "${count}".png;
count=`expr $count + 1`;
done
@imom0
imom0 / build.sh
Created February 2, 2012 08:01 — forked from jonah-williams/build.sh
Command line iOS project builds and over-the-air distribution
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
:+1:
just test emoji