TortoiseGit中使用PuTTY或者OpenSSH的配置

鼠标右键选择TortoiseGit——Settings——Network——SSH
如果是PuTTY模式,则在SSH客户端输入框填写:
C:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe
该模式是使用puttygen生成sshkey的。
如果是OpenSSH模式,则填写:
C:\Program Files (x86)\Git\bin\ssh.exe
SSH模式,需要手动生成sshkey,可使用以下命令行:

ssh-keygen -t ed25519

$ ssh-keygen -t rsa -C “abc@admin.com”,此命令会在个人帐号下生成.ssh目录,在该目录下,有两个文件id_rsa和id_rsa.pub,把.pub文件的内容拷贝到gitlab的配置中,即可。
$ cat ~/.ssh/id_rsa.pub
在拉取代码或提交代码时,如果提示:Agent admitted failure to sign using the key错语,则需调用:ssh-add解决。

github上创建可提交的克隆
git clone https://account:password@github.com/xxx/yyy.git aixuefo

git clone git@github.com:kxtry/yyy.git aixuefo
后者相比前者是使用SSH方式,更安全。
如果不想提交,则
git clone https://github.com/xxx/yyy.git aixuefo
创建分支
$ git branch test
切换分支
$ git checkout test
提交创建远程分支并同步当前内容到该远程分支
$ git push origin test
删除本地分支
$ git branch -d xxxxx

Android开发SDK下载地址

国内的一些Android的镜像收集地址,非常实用。
http://www.androiddevtools.cn/
环境搭建过程参照:
http://doc.qt.io/qt-5/gettingstarted.html

GDB调试的补丁,是用于替换NDK内自带的GDB.
http://download.qt.io/official_releases/gdb/

只需下载SDK Tools包,因为启动它后,可以自由下载所有其它依赖的包。
格式:android-sdk_r24.3.4-windows.zip
http://dl.google.com/android/android-sdk_r24.3.4-windows.zip

————————————————————–

相关资源包下载,参照如下:

sudo vi /etc/hosts

添加

74.125.206.93 dl-ssl.google.com

2014.7

ADT Bundle
http://dl.google.com/android/adt/adt-bundle-windows-x86-20140702.zip
http://dl.google.com/android/adt/adt-bundle-windows-x86_64-20140702.zip
http://dl.google.com/android/adt/adt-bundle-mac-x86_64-20140702.zip
http://dl.google.com/android/adt/adt-bundle-linux-x86-20140702.zip
http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20140702.zip

SDK Tools Only
http://dl.google.com/android/android-sdk_r23.0.2-windows.zip
http://dl.google.com/android/installer_r23.0.2-windows.exe
http://dl.google.com/android/android-sdk_r23.0.2-macosx.zip
http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz

Android Studio
http://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-windows.exe
http://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-mac.dmg
http://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-linux.tgz

Android NDK
http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r10-cxx-stl-libs-with-debug-info.zip

2014.6

Android Studio 0.8

http://dl.google.com/android/studio/install/0.8.0/android-studio-bundle-135.1245622-windows.exe
http://dl.google.com/android/studio/install/0.8.0/android-studio-bundle-135.1245622-mac.dmg
http://dl.google.com/android/studio/install/0.8.0/android-studio-bundle-135.1245622-linux.tgz

Android SDK only r23

http://dl.google.com/android/android-sdk_r23-windows.zip
http://dl.google.com/android/installer_r23-windows.exe
http://dl.google.com/android/android-sdk_r23-macosx.zip
http://dl.google.com/android/android-sdk_r23-linux.tgz

ADT Bundle r23

http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20140624.zip
http://dl.google.com/android/adt/adt-bundle-linux-x86-20140624.zip
http://dl.google.com/android/adt/adt-bundle-windows-x86-20140624.zip
http://dl.google.com/android/adt/adt-bundle-windows-x86-20140624.zip
http://dl.google.com/android/adt/adt-bundle-mac-x86_64-20140624.zip

Android NDK r9d

http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r9d-cxx-stl-libs-with-debug-info.zip

Android NDK r6b

Windows

http://dl.google.com/android/ndk/android-ndk-r6b-windows.zip

Mac OS X(intel)

http://dl.google.com/android/ndk/android-ndk-r6b-darwin-x86.tar.bz2

Linux

http://dl.google.com/android/ndk/android-ndk-r6b-linux-x86.tar.bz2

Android SDK 3.2

Windows

http://dl.google.com/android/android-sdk_r12-windows.zip

http://dl.google.com/android/installer_r12-windows.exe

Mac OS X (intel)

http://dl.google.com/android/android-sdk_r12-mac_x86.zip

Linux(i386)

http://dl.google.com/android/android-sdk_r12-linux_x86.tgz

Android NDK r6

Windows

http://dl.google.com/android/ndk/android-ndk-r6-windows.zip

Mac OS X(intel)

http://dl.google.com/android/ndk/android-ndk-r6-darwin-x86.tar.bz2

Linux 32/64-bit (x86)

http://dl.google.com/android/ndk/android-ndk-r6-linux-x86.tar.bz2

Android SDK 3.1

Windows

http://dl.google.com/android/android-sdk_r11-windows.zip

http://dl.google.com/android/installer_r11-windows.exe

Mac OS X(intel)

http://dl.google.com/android/android-sdk_r11-mac_x86.zip

Linux(i386)

http://dl.google.com/android/android-sdk_r11-linux_x86.tgz

Android NDK r5b

Windows

http://dl.google.com/android/ndk/android-ndk-r5b-windows.zip

Mac OS X(intel)

http://dl.google.com/android/ndk/android-ndk-r5b-darwin-x86.tar.bz2

Linux

http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2

Android SDK 3.0

Windows

http://dl.google.com/android/installer_r10-windows.exe

http://dl.google.com/android/android-sdk_r10-windows.zip

Mac OS X(intel)

http://dl.google.com/android/android-sdk_r10-mac_x86.zip

Linux(i386)

http://dl.google.com/android/android-sdk_r10-linux_x86.tgz

Android SDK 2.3

Windows

http://dl.google.com/android/android-sdk_r08-windows.zip

http://dl.google.com/android/installer_r08-windows.exe

Linux (i386)

http://dl.google.com/android/android-sdk_r08-linux_86.tgz

MAC OS X (intel)

http://dl.google.com/android/android-sdk_r08-mac_86.zip

Android NDK r5

Windows

http://dl.google.com/android/ndk/android-ndk-r5-windows.zip

Mac OS X (intel) r5

http://dl.google.com/android/ndk/android-ndk-r5-darwin-x86.tar.bz2

Linux 32/64-bit (x86) r5

http://dl.google.com/android/ndk/android-ndk-r5-linux-x86.tar.bz2

mysql默认值

如果一个字段中没有指定DEFAULT修饰符,MySQL会依据这个字段是NULL还是NOT NULL自动设置默认值。如果指定字段可以为NULL,则MySQL为其设置默认值为NULL。如果是NOT NULL字段,MySQL对于数值类型插入0,字符串类型插入空字符串,时间戳类型插入当前日期和时间,ENUM类型插入枚举组的第一条。

mysql优化记录

两组结果一样,写法相近的mysql语句,但性能相差接近100倍,是何缘故。
EXPLAIN SELECT * FROM wareprice_01 wp WHERE id=(SELECT MAX(id) FROM wareprice_01 p WHERE p.wareid IN (44166981760,43770830980,43770832630,44976304870,43994294220,38585515990,45140073950) AND wp.wareid = p.wareid);

id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY wp ALL \N \N \N \N 90770 Using where
2 DEPENDENT SUBQUERY p ref wareidp wareidp 8 tmware.wp.wareid 1 Using where

EXPLAIN SELECT * FROM wareprice_01 wp WHERE id=(SELECT MAX(id) FROM wareprice_01 p WHERE wp.wareid = p.wareid) AND wp.wareid IN (44166981760,43770830980,43770832630,44976304870,43994294220,38585515990,45140073950);

id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY wp range wareidp wareidp 8 \N 8 Using where
2 DEPENDENT SUBQUERY p ref wareidp wareidp 8 tmware.wp.wareid 1

代理:唯快不破

网上免费代理失效率很高,其原因不外乎以下几种:
1.大量代理代理服务器,主要是由肉鸡主机构成,有些是用户机被木马了,也有一些是VPS,其中也有一些高质量的肉鸡服务器,但这种高质量的代理一般不会免费提供给用户。
2.网上太多人在玩爬虫类或群发类的开发,对这种免费代理的需求较高,这么多人在使用这些质量较差的代理,极有可能导致代理处理不过来而宕机
3.网管发现了,关闭了代理。
4.修复了漏洞。

所以说要想抢得更好的代理资源,需要如下:
1.新代理刚发现,就马上测试并使用,不要考虑存放太久,否则被别人使用过多了,它就更容易失效。
2.在进行代理可行性测试时,避免不必要的浪费测试。
3.测试的代理的连通性,必须选择高质量地址,首先CDN资源如query.min.js,再到一些大站如qq首页等。

可获取公网IP的网址

由于代理检验需要,现在小站经受不住大流量测试,于是多收集了一些。
http://1111.ip138.com/ic.asp,
http://ip.360.cn/IPShare/info,
http://www.ip508.com/ip,
http://myip.com.tw/,
http://ip.xianhua.com.cn/,
http://www.ip.cn/,
http://www.123cha.com/ip,
http://www.ip38.com/,
http://ip.chinaz.com,
http://www.cz88.net/ip/index.aspx,
——————————————-
以下是淘宝的,量大,再加上它天猫和淘宝都需要使用,应该能扛得住大流量,直得一试。
http://www.taobao.com/help/getip.php,

IP位置定位参考库

当前有两大IP参考库,记录如下:
http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest,这是APNIC亚太地区的IP分配地址表,全球有五大IP分配机构,其它是AfriNIC非洲地区、ARIN美洲地区、LACNIC拉丁美洲和加勒比海、RIPE欧洲地区。
ftp://ftp.arin.net/pub/stats/arin/delegated-arin-latest,
ftp://ftp.ripe.net/ripe/stats/delegated-ripencc-latest,
ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-latest,
ftp://ftp.apnic.net/pub/stats/apnic/delegated-apnic-latest,
ftp://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-latest ,
http://www.cz88.net/,这是国内有名的纯真库。
python中的ip和int转换算法:

def ip_to_int(iptxt):
ipf = lambda x:sum([256**j*int(i) for j,i in enumerate(x.split(‘.’)[::-1])])
return ipf(iptxt)

def int_to_ip(ip):
ipf = lambda x: ‘.’.join([str(x/(256**i)%256) for i in range(3,-1,-1)])
return ipf(ip)

前端播放器资源

http://www.52player.com/
以上网站收集了当前各种流行的前端播放器,很值得收藏。
以下是本人下载并测试的播放器:
http://pan.baidu.com/s/1mg7n8yk,该功能相对简单,一般情况够用。
http://pan.baidu.com/s/1dD2IgFZ,该功能丰富,提供多种形式的播放器:如列表模式,JS交互模式,经典模式等,真是包括各种情况。官方主页为http://www.alsacreations.fr/dewplayer.html,教程也相当丰富。
http://www.spencer-tech.com/,开源的播放器,可以自由修改(http://pan.baidu.com/s/1sjkcOFV),有三种模式,MINI模式、列表模式、列表专辑模式,皮肤和大小可自由调整,是目前最好的音乐控件。

scrapy所依赖的环境各版本

目前稳定使用scrapy的依赖环境如下:
pip install Twisted==14.0.2 w3lib==1.11.0 queuelib==1.2.2 lxml==3.3.0 pyOpenSSL==0.12 cssselect==0.9.1 six==1.9.0 scrapy==0.24.4 pycurl==7.19.5.1 django==1.4.18 mysql-python==1.2.5 service_identity==14.0.0 selenium==2.44.0 simplejson==3.6.5
pip install Twisted==14.0.2 https://pypi.python.org/packages/source/T/Twisted/Twisted-14.0.2.tar.bz2
pip install w3lib==1.11.0
pip install queuelib==1.2.2
pip install lxml==3.3.0
pip install pyOpenSSL==0.12
pip install cssselect==0.9.1
pip install six==1.9.0
pip install scrapy==0.24.4
pip install pycurl==7.19.5.1
pip install django==1.4.18
pip install mysql-python==1.2.5
pip install service_identity==14.0.0
pip install selenium==2.44.0
pip install simplejson==3.6.5
【目前列出的版本为在Centos5.8上运行的版本,现移植到6.6后,仍保持一致,按如下版本安装,可解决SSL或HTTPS的崩溃BUG,2015年8月14日备注
characteristic (14.3.0)
cssselect (0.9.1)
Django (1.4.18)
lxml (3.3.0)
MySQL-python (1.2.5)
pip (1.5.6)
pyasn1 (0.1.7)
pyasn1-modules (0.0.5)
pycurl (7.19.5.1)
pyOpenSSL (0.12)
pypm (1.4.3)
queuelib (1.2.2)
Scrapy (0.24.4)
selenium (2.44.0)
service-identity (14.0.0)
setuptools (5.2)
simplejson (3.6.5)
six (1.9.0)
Twisted (14.0.2)
w3lib (1.11.0)
wsgiref (0.1.2)
zope.interface (4.1.2)

scrapy _getEndpoint() takes exactly 4 arguments (2 given)

Twisted 15.0 appears to have changed the signature of the _getEndpoint method on twisted.web.client.Agent. This causes the http11 handler to throw exceptions like so:
Traceback (most recent call last):
File “/usr/share/python/spotify-prelude2-directed-crawlers/local/lib/python2.7/site-packages/scrapy/core/downloader/middleware.py”, line 38, in process_request
return download_func(request=request, spider=spider)
File “/usr/share/python/spotify-prelude2-directed-crawlers/local/lib/python2.7/site-packages/scrapy/core/downloader/__init__.py”, line 123, in _enqueue_request
self._process_queue(spider, slot)
File “/usr/share/python/spotify-prelude2-directed-crawlers/local/lib/python2.7/site-packages/scrapy/core/downloader/__init__.py”, line 143, in _process_queue
dfd = self._download(slot, request, spider)
File “/usr/share/python/spotify-prelude2-directed-crawlers/local/lib/python2.7/site-packages/scrapy/core/downloader/__init__.py”, line 154, in _download
dfd = mustbe_deferred(self.handlers.download_request, request, spider)

File “/usr/share/python/spotify-prelude2-directed-crawlers/local/lib/python2.7/site-packages/scrapy/utils/defer.py”, line 39, in mustbe_deferred
result = f(*args, **kw)
File “/usr/share/python/spotify-prelude2-directed-crawlers/local/lib/python2.7/site-packages/scrapy/core/downloader/handlers/__init__.py”, line 40, in download_request
return handler(request, spider)
File “/usr/share/python/spotify-prelude2-directed-crawlers/local/lib/python2.7/site-packages/scrapy/core/downloader/handlers/http11.py”, line 36, in download_request
return agent.download_request(request)
File “/usr/share/python/spotify-prelude2-directed-crawlers/local/lib/python2.7/site-packages/scrapy/core/downloader/handlers/http11.py”, line 174, in download_request
d = agent.request(method, url, headers, bodyproducer)
File “/usr/share/python/spotify-prelude2-directed-crawlers/local/lib/python2.7/site-packages/twisted/web/client.py”, line 1560, in request
endpoint = self._getEndpoint(parsedURI)
exceptions.TypeError: _getEndpoint() takes exactly 4 arguments (2 given)

That method’s signature in Twisted 15.0.0 is def _getEndpoint(self, uri): while in version 14.0.2 it isdef _getEndpoint(self, scheme, host, port):