自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(269)
  • 收藏
  • 关注

转载 [python]socket.listen(backlog)中的backlog含义

http://www.nosa.me/2015/09/16/socket-listenbacklog-%E4%B8%AD-backlog-%E6%8C%87%E7%9A%84%E6%98%AF%E4%BB%80%E4%B9%88/backlog 代表着有多少个已经建立的但是没有被 accept 取走的连接数量。另外,有个内核参数net.core.somaxconn 定义了...

2018-02-08 12:02:00 343

转载 ubuntu开机启动

/rc.local (ran as root)https://unix.stackexchange.com/questions/210939/what-user-runs-the-commands-defined-in-etc-rc-localcrontab -e (ran as login user)https://askubuntu.com/questions/8...

2017-11-07 09:04:00 254

转载 mac上制作ubuntu引导盘

https://help.ubuntu.com/community/How%20to%20install%20Ubuntu%20on%20MacBook%20using%20USB%20Stickhttps://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-macos#6ps: 服务器有特定的...

2017-11-06 12:28:00 312

转载 ubuntu 14.04升级python2

http://blog.csdn.net/zahuopuboss/article/details/50927432转载于:https://www.cnblogs.com/Tommy-Yu/p/7279260.html

2017-08-03 13:36:00 154

转载 brew 源 & pip 源

brew源:https://www.zhihu.com/question/31360766摘要1. 替换formula 索引的镜像(即 brew update 时所更新内容)cd "$(brew --repo)"git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/br...

2017-08-03 09:10:00 137

转载 谷歌云主机登陆

踩过几个坑- 不需要另外开防火墙规则- 用 ssh -v root@host 没办法追出来问题出在哪- 通过其命令行登陆后,手工添加pub key 到 ~/.ssh/authorized_keys 然后设定正确的访问权限。仍然没有p用。回头用ssh -v调试仍然看不出来所以然。- 额外新增用户,然后远端登陆也无法登陆。默认禁用了账号密码登陆, 而且到处都开不了。- 在...

2017-07-15 20:16:00 220

转载 python __get__ & __set__

目的:  提供类似java中的getter/setter的东西。  (getter/setter的目的: 将属性方法化,使得属性的引用变得简单---尤其将来属性的读取/赋值有比较复杂的逻辑)官方简明文档:  https://docs.python.org/2/howto/descriptor.html英文比较好介绍(来龙去脉细节):  http://ma...

2017-06-25 15:36:00 127

转载 python爬虫

1 简单方案(广度优先遍历):https://fossbytes.com/how-to-build-a-basic-web-crawler-in-python/import sys, thread, Queue, re, urllib, urlparse, time, os, sysdupcheck = set() q = Queue.Queue(100) q.pu...

2017-02-18 09:14:00 122

转载 postgresql免密码登录

https://www.postgresql.org/docs/8.3/static/libpq-pgpass.htmlvi~/.pgpass输入以下内容hostname:port:database:username:passwordchmod 0600 ~/.pgpass然后psql指令 psql -U user -h host 可以不用密码转载于...

2017-02-17 18:38:00 2944

转载 postgresql修改数据库编码

update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = 'your_database';先用\encoding 指令看看编码是否预期的编码,如果不是则修改之。如果连进去还是乱码,可能是客户端默认编码或者数据库服务器的语言支持问题了,详细看:http://ww...

2017-02-17 13:46:00 1704

转载 java httpclient post xml demo

jar archive:http://archive.apache.org/dist/httpcomponents/基于httpclient 2.0 final的demo(for jdk1.5/1.6):http://alvinalexander.com/java/jwarehouse/commons-httpclient-2.0/src/examples/Pos...

2017-02-15 18:31:00 160

转载 rabbitmq - java client lib一二事

由于不可抗因素, 需要给对接方撸一个client的demo。基于比较老的jdk。所幸找到了这里:http://www.rabbitmq.com/releases/rabbitmq-java-client干脆拿第一版1.4.0开撸,以下demo:import java.io.IOException;import com.rabbitmq.client.Connectio...

2017-02-15 18:05:00 116

转载 定频数据收集方案

场景:  每隔一定时间, 从其他系统(可能是异构网络)获取相关数据。1. 消息队列方案rabbitMQ考虑点:1. 消息保证稳定可靠被处理(因此队列需要声明为可持久化的, 生产者push消息的时候delivery_mode为2)2. 消息被处理后, 确认后, 及时从内存和硬盘中删除。可能会影响写入的并发性能。  参考: https://groups.go...

2017-02-10 17:48:00 128

转载 ubuntu 14.04 安装python包psycopg2

http://stackoverflow.com/questions/28253681/you-need-to-install-postgresql-server-dev-x-y-for-building-a-server-side-extensisudo apt-get install postgresqlsudo apt-get install python-psycop...

2017-02-09 17:20:00 162

转载 vmare 往 virtualbox迁移

vmare实在太卡了。抓狂。于是想迁移到virtualbox观察下。谷歌了下方案,发现众说纷纭。有操作超级复杂的,比如:http://stackoverflow.com/questions/6944154/migrating-from-vmware-to-virtualbox鉴于对stackoverflow的一贯信任,于是照着做了,没想到不知道啥原因无法下载VMare C...

2017-02-09 16:30:00 120

转载 docker-compose & docker 镜像/加速

docker-compose: http://sanwen.net/a/nuwruoo.htmldocker加速: http://guide.daocloud.io/dcs/daocloud-9153151.html https://c.163.com/wiki/index.php?title=DockerHub%E9%95%9C%E5%83%8F...

2017-02-08 17:08:00 250

转载 nodejs & npm & gulp 安装和配置

熟悉 Hellolily的过程中,了解了这个。环境:  ubuntu 14.04 LTS 64bit源码安装方式: 下载最新源码:如果被和谐请自行想办法。  解压并编译安装:cd node-xxxsudo ./configuresudo makesudo make install 这样弄完, node和npm都装上...

2017-02-08 16:33:00 146

转载 airflow 优化

1. 页面默认加载数据过多,加载慢。 修改 .../python2.7/site-packages/airflow/www/views.py文件, 1823行, page_size参数, 比如改成18 。重启webserver。 然后速度嗖嗖的。class AirflowModelView(ModelView): list_template = 'airfl...

2017-01-04 17:11:00 5304

转载 airflow 部署

环境 :ubuntu 14.04 LTSpython 2.7script:设置环境变量:export AIRFLOW_HOME=~/airflow安装相关依赖包:sudo apt-get install python-devsudo apt-get install python-numpysudo pip install airflo...

2016-12-28 18:29:00 172

转载 windows 上vmare超卡的问题解决方案

http://www.cnblogs.com/jlwen/p/3553722.html转载于:https://www.cnblogs.com/Tommy-Yu/p/6207588.html

2016-12-21 14:28:00 111

转载 django tag

官方文档:https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/#simple-tagsstackoverflow demo:http://stackoverflow.com/questions/6451304/django-simple-custom-template-tag-example我的dem...

2016-12-21 11:51:00 124

转载 django test

django的单元测试官方文档:https://docs.djangoproject.com/en/dev/topics/testing/相对于自己封装urllib/urllib2/request做测试类有以下特点:1. 独立的测试数据库(与生产库分离,因此更利于测试人员做测试而不影响正式数据)  代价就是,测试数据要自己再通过代码造一遍。 运行完了清理数据。删...

2016-12-13 15:52:00 153

转载 django 强制登录最佳实践

参考:https://python-programming.courses/recipes/django-require-authentication-pages/即通过中间件来做AOP拦截。不用每个函数每个类加修饰器/MixIn。1. 在某个处理用户相关的模块中添加middleware.py, 内容如下:from django.http import HttpRes...

2016-12-12 10:48:00 196

转载 python --enable-shared

https://github.com/docker-library/python/issues/21例如编译安装python3.5.2,脚本如下:wget https://s3.cn-north-1.amazonaws.com.cn/zeusis/packages/Python-3.5.2.tgztar -xf Python-3.5.2.tgzcd Python-3....

2016-12-08 12:56:00 1225

转载 mysql load data 乱码

解决方案:  http://stackoverflow.com/questions/26256421/sql-load-data-infile-utf8-issue即:load data local infile '/path/to/sqlfile' into table xxx character set utf8fields terminated by ','...

2016-12-05 13:59:00 252

转载 js 对象合并

//条件var obj1 = { food: 'pizza', car: 'ford' }var obj2 = { animal: 'dog' }//需求如下obj1.merge(obj2);解决obj1.merge=function(obj){ for(var attr in obj){ this[attr]=obj[at...

2016-12-02 10:47:00 90

转载 python3 TypeError: 'str' does not support the buffer interface in python

http://stackoverflow.com/questions/38714936/typeerror-str-does-not-support-the-buffer-interface-in-python下面这样会报错:b=b'{"m":1}'import urllib.parseurllib.parse.unquote(b)修正方案:b=b.d...

2016-12-01 17:48:00 109

转载 django rest framework 再撸体验

曾经了解过。放在一边,嫌麻烦。如今身为leader,站在团队沟通的角度看看,还不错。有几个优点:  1. api一览表  2. api web预览界面(类似.net的webservice预览界面),可以直接在上面(类似postman的方式)模拟和服务器的通讯。  3. api的配置化,通用性的查增删改无脑解决方案。复杂的api可能还是要自己写。  4. 测试也...

2016-11-28 11:44:00 185

转载 linux shell输入重定向

经常用(隔很久)经常忘。备忘下:http://blog.csdn.net/ithomer/article/details/9288353转载于:https://www.cnblogs.com/Tommy-Yu/p/6101605.html

2016-11-25 14:53:00 79

转载 httpie 取代 curl

接口测试有人喜欢postman(for windows or mac)如果长期用linux工作,可能更喜欢命令的方式,比如curl最近深入了解了下django-rest-framwork,他们推荐了一个工具:httpie安装:python2.xpip install httpiepython3.xpython -m pip install htt...

2016-11-24 11:17:00 132

转载 wget 断点续传 & nginx文件服务器

nginx默认支持断点续传:测试方法:wget -S http://httpd.apache.org/images/httpd_logo_wide_new.png 2>&1 | grep ‘Accept-Ranges’ Accept-Ranges: bytes#输出结果 Accept-Ranges: bytes ,说明服务器支持按字节下载。...

2016-11-24 09:50:00 306

转载 select2 demo

https://select2.github.io/examples.html一大堆的坑:1. 不同版本之间貌似不兼容,对应版本看对应的文档。2. 4.0.3版本: 1)。 自定义渲染的option无法选中。谷歌了下,似乎返回的对象必需有 id和text属性, 另外可以加一个属性,指向对象本身。即:  ajax的processResults回调中:pro...

2016-11-23 19:24:00 149

转载 vmare centos 6.8 minimal 无法上网

主机:win7工具:vmare 11.0.0系统:http://mirrors.163.com/centos/6.8/isos/x86_64/CentOS-6.8-x86_64-minimal.iso原因比较简单: 默认的etho0没有启用,启用即可。vi /etc/sysconfig/network-script/ifcfg-eth0将 ONBO...

2016-11-23 12:57:00 188

转载 protocol http not supported or disabled in libcurl apt-get

ubuntu 14.04碰到了这个莫名其妙的问题。谷歌了一把,解决方案如下:http://askubuntu.com/questions/683857/curl-1-protocol-https-not-supported-or-disabled-in-libcurl即重新编译安装curl包(lib curl)。wget https://curl.haxx.se/down...

2016-11-15 12:56:00 348

转载 python3 -pip

https://docs.python.org/3/installing/=====pip is the preferred installer program. Starting with Python 3.4, it is included by default with the Python binary installers.python -m pip...

2016-11-14 10:16:00 111

转载 ubuntu 搞坏了sudoers文件之修复方案

pkexec visudoaskubuntu原回答摘抄如下On a modern Ubuntu system (and many other GNU/Linux distributions), fixing a corrupted sudoers file is actually quite easy, and doesn't require rebooting...

2016-11-11 14:31:00 285

转载 epoll & socket 连接数突破

http://shenfeng.me/how-far-epoll-can-push-concurrent-socket-connection.html转载于:https://www.cnblogs.com/Tommy-Yu/p/5997734.html

2016-10-25 18:13:00 126

转载 mysql 最大连接数 & 连接池

MySQL最大连接数关于最大连接数:http://mg123.lofter.com/post/1a5f3e_996f838可以通过修改配置文件(默认/etc/my.cnf)中的"mysqld"段的max_connections 参数来支持更多的连接(默认100)。猜测mysql利用了linux的select/poll/epoll中的一种技术(即IO多路复用),由于连接数(文件...

2016-10-24 17:46:00 452

转载 xmind portable

portable : http://dl2.xmind.cn/xmind-7.5-update1-portable.zip转载于:https://www.cnblogs.com/Tommy-Yu/p/5969197.html

2016-10-17 11:38:00 166

转载 celery 原理理解

这里有一篇写的不错的:http://www.jianshu.com/p/1840035cb510自己的“格式化”后的内容备忘下:  我们总在说c10k的问题, 也做了不少优化, 然后优化总是不够的。  其中的一个瓶颈就是一些耗时的操作(网络请求/文件操作--含耗时的数据库操作)。  如果我们不关心他们的返回值,则可以将其做成异步任务,保证执行成功即可。   ...

2016-10-13 09:51:00 206

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除