Ruiking Mobile

Python Requests: HTTP for Humans

很多时候你会需要一个类似RESTClient这样的工具来方便的向一个URL发送试探数据,当然你可以用curl,这里记录一下Python的Requests库,Requests号称 “HTTP for humans”,自然有他自己的特色,Python里面可以做这个事儿的还有urllib2,当然还有urllib,如果你用过这俩库,就会跟我一样,感觉总有些改进的地方,但又懒得去贡献脑细胞一一找出并改正之,有了Requests,不用再纠结了。

上例子:

r = requests.get('https://github.com/timeline.json')

r = requests.post("http://httpbin.org/post")

r = requests.put("http://httpbin.org/put")

r = requests.delete("http://httpbin.org/delete")

r = requests.head("http://httpbin.org/get")

r = requests.options("http://httpbin.org/get")

加payload:

payload = {'parameter1':'1111', 'parameter2':'2222'}

r = requests.post('http://xxxx.com/post', payload)

这才像说人话,requests对得起自己的slogan!

eselect profile切换问题[Gentoo]

碰到提示说推荐切换到 default/linux/amd64/13.0 ,结果切过去整个emerge不工作了提示:

!!! Unable to parse profile: '/etc/make.profile'

!!! ParseError: Profile contains unsupported EAPI '5': '/usr/portage/profiles/eapi-5-files/eapi'

!!! Your current profile is invalid. If you have just changed your profile

!!! configuration, you should revert back to the previous configuration.

!!! Allowed actions are limited to --help, --info, --search, --sync, and

!!! --version.

emerge --sync 不行, 如下解决:

eselect profile set 0

emerge -u portage

eselect profile set 1

用Fabric自动部署Django应用, supervisord+uwsgi+virtualenv

~/liulianweb/fabfile.py.html

 1 # ---- coding:utf-8 ----
 2 
 3 from fabric.api import *
 4 
 5 env.hosts = ['xxx.xxx.xxx.xxx']
 6 env.user = 'username'
 7 
 8 def update_xxx_project():
 9     with cd('/var/www/xxx_project'):
10         run('git pull origin deployment')
11 
12 def restart_uwsgi():
13    
continue.

两个很养眼的Trac主题

找到两个很养眼的Trac主题,默认主题用了太久,早就疲劳了:

第一个

第二个

私家车出行决策辅助

哪儿堵(九州联宇)/路况电台(创新工场)/微信路况(薛蛮子),老牌的导航犬/掌城路况通。查路况帮助私家车主出行决策,直接收费就省省吧,走后装?看不懂

一淘火眼们

最早接触到的扫条码,比价格是我查查,有个朋友关注推荐的。后来还真用了很长时间,不过应用场景可能跟他们PM设想的有所出入,有什么礼品之类的东西,拿来扫一下看看价格,仅此而已。

一淘火眼,3块内容,比价跟我查查还不一样是线下跟线上比;淘宝天下做导购杂志(线下线上都有);抓蝴蝶,向iButterfly/Breeze Living看齐,比价资源无人能敌、杂志背后有浙报、抓蝴蝶搞活动轻车熟路,都是不性感但接地气的活儿。

一淘火眼

Python穷举排列

import itertools

print list(itertools.permutations(['k','y','z']))

[('k', 'y', 'z'), ('k', 'z', 'y'), ('y', 'k', 'z'), ('y', 'z', 'k'), ('z', 'k', 'y'), ('z', 'y', 'k')]

公交App

熊猫公交,关于这块个人YY的打法应该是:实时公交+公交查询+O2O+SNS,权重依次降低,从工具入手,利诱,聚集数据和用户以后上SNS。熊猫公交目前仅提供大连一地的实时公交信息,估计数据不好搞。UE不评价,类似的有巴士在线、坐网等

linux下查找当前目录下搜有文件中包含的XXX字符

find . -type f -name "*.py" | xargs grep "XXX"

MongoDB on Mac

Previous »