2017年12月15日星期五

tkinter和matplotlib在mac下的一个问题

http://blog.csdn.net/vincent2610/article/details/68062034
在mac python中,将matplotlib嵌入Tkinter时出现错误

解决方法
import matplotlib
matplotlib.use("TkAgg")
 
import matplotlib紧接着的下一行写上matplotlib.use("TkAgg") 

注意是紧接着的下一行,
并且保证这两句写在import matplotlib.pyplot as plt的前面 
 
 

2017年11月19日星期日

2017年10月23日星期一

使用cmake源代码安装libnfc

  •   http://tiehichi.me/2017/07/04/archives/nfc_0/
    源码安装
    其实源码安装也很简单粗暴,在Raspbian上也没有遇到什么莫名其妙的问题。
    首先安装CMake,如果已经安装了请忽略这一步:
    sudo apt-get install cmake
    然后cd到libnfc的源码目录中,建立一个build文件夹,在build文件夹中进行编译安装:
    mkdir build
    cd build
    cmake ..
    make
    sudo make install
    sudo ldconfig
    至此libnfc安装完成。

2017年9月15日星期五

常用的EPSG

 http://spatialreference.org/ref/epsg/2385/

EPSG:2385
Xian 1980 / 3-degree Gauss-Kruger CM 120E

EPSG:2384
Xian 1980 / 3-degree Gauss-Kruger CM 117E

EPSG:4326
WGS 84

EPSG:4548
CGCS2000 / 3-degree Gauss-Kruger CM 117E


EPSG:4547
CGCS2000 / 3-degree Gauss-Kruger CM 114E


gdal中文出错

在C#中使用GDAL库时读取中文路径的问题

http://lists.osgeo.org/pipermail/gdal-dev/2014-January/037829.html

https://lists.osgeo.org/pipermail/gdal-dev/2011-March/028068.html

程序假定文件名的编码是utf8,所以在windows中会出问题,
解决方法:在设置环境变量,例如在命令窗口中临时设置
set GDAL_FILENAME_IS_UTF8=NO


2017年8月11日星期五

ds415play

sudo     /bin/mount /dev/vg1/volume_2      /mnt/disk2

2017年8月8日星期二

vim 相关知识

1、简短的教程
 http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html

2、 _vimrc 基本配置
set fileencodings=utf-8,utf-16,gbk,big5,gb18030,latin1 "自动猜测文件编码
syntax on " 自动语法高亮
set number " 显示行号

filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab

"Open command prompt by running :Cp
command Dos :!start cmd /k cd %:p:h<CR>

"Open windows explorer by running :We
command We :!start Explorer /select,%:p<CR>
3、技巧
4、http://vim.wikia.com/wiki/Highlight_all_search_pattern_matches

2017年8月4日星期五

Python3 unicode_escape


 在python3中

In [1]:      url = r"\u8fd9\u4e2a\u7cfb\u5217\u5fc5\u987b\u8f6c2"
In [2]:      url.encode().decode('unicode_escape')
Out [3]:   '这个系列必须转2'






In [4]:      c = '国家'
In [5]:      c.encode('unicode_escape')
Out [6]:   b'\\u56fd\\u5bb6'

2017年8月1日星期二

conda创建的虚拟环境,pyqt出错

conda创建的虚拟环境,复制到其它计算机后,执行pyqt程序时,出错。
解决方法:
https://github.com/ContinuumIO/anaconda-issues/issues/1270
COPY the
Continuum\Anaconda3\Library\plugins\platforms
folder to
Continuum\Anaconda3

2017年6月25日星期日

输电线路平断面图中杆塔上三条线分别代表什么

 三条线



粗红线表示导线
紫线代表跨越线,定位时这条线必须高于被跨越的其他线路。
蓝线代表切地线,定位时这条线必须高于地面。

另外,这3条线都表示的是最大弧垂气象条件下的位置,最大弧垂气象条件有可能是最高气温,也有可能是最大覆冰时,这个在定位之前就要判别。

2017年6月8日星期四

2017年6月6日星期二

Python: add in memory files to a tar file

tarfile can't add in memory files

import io, tarfile

with tarfile.open("foo.tar", mode="w") as tar:
    b = "hello world!".encode("utf-8")

    t = tarfile.TarInfo("helloworld.txt")
    t.size = len(b) # this is crucial
    tar.addfile(t, io.BytesIO(b))

2017年6月4日星期日

pip install 出现 空间不足 的错误

搬瓦工主机上使用pip安装scipy,出现以下错误:
OSError: [Errno 28] No space left on device
找到以下的问题:
https://stackoverflow.com/questions/28590344/ioerror-no-space-left-on-device-which-device
可能是tmp目录的空间不够。
又找到
https://stackoverflow.com/questions/10617198/pip-creates-build-directories
使用 pip install -b 选项,指定目录,解决了问题。

debian 编译安装 Python3

http://drupaland.eu/article/debian-8-python35-and-pip35

上面的链接中,应使用  make altinstall

https://unix.stackexchange.com/questions/332641/how-to-install-python-3-6 

 上面的链接中,make -j8 会出现编译错误,直接使用make能通过。

2017年5月30日星期二

查看IE浏览器保存的密码

IE PassView v1.40
Copyright (c) 2006 - 2016 Nir Sofer
Web site: http://www.nirsoft.net
http://www.nirsoft.net/utils/internet_explorer_password.html

2017年5月27日星期六

将dwg文件放到Google Map的思路

1 使用AutoCad将dwg文件另存为dxf;
2 将dxf导入ArcGis,赋上坐标系,导出为shape文件;
3 使用ogr2ogr将shape文件转换为json格式;
          ogr2ogr -t_srs EPSG:4326 -f "GeoJSON" ttt.json  2.shp
4 使用Python的geojson,获取json格式文件里的坐标点,转为国内地图使用的火星坐标系 ,并输出为json格式。
5 使用ogr2ogr,将json格式转换为kml格式。
     ogr2ogr  -f "KML" yxl.kml  yongxinglu_huoxing.json
6 将kml文件导入Google Map。(在google drive中)

更新:将北京54 120度带的dxf文件转换为kml文件

 ogr2ogr -t_srs EPSG:4326 -f "KML" -s_srs EPSG:2437  2.kml    lhk.dxf 
-t_srs  输出文件重新投影或者转换
-f        输出文件的格式
-s_srs  指定输入文件的坐标系 
最后一个参数是输入文件,倒数第二个参数是输出文件的文件名。

2017年4月2日星期日

Check what Debian version you are running on your Linux system

Check what Debian version you are running on your Linux system


# apt-get install lsb-release
 
# lsb_release -da
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.7 (wheezy)
Release: 7.7
Codename: wheezy 

2017年3月30日星期四

转: 在命令行临时指定pip的源

经常在使用Python的时候需要安装各种模块,而pip是很强大的模块安装工具,但是由于国外官方pypi经常被墙,导致不可用,所以我们最好是将自己使用的pip源更换一下,这样就能解决被墙导致的装不上库的烦恼。
网上有很多可用的源,例如豆瓣:http://pypi.douban.com/simple/
                                          清华:https://pypi.tuna.tsinghua.edu.cn/simple
最近使用得比较多并且比较顺手的是清华大学的pip源,它是官网pypi的镜像,每隔5分钟同步一次,地址为 https://pypi.tuna.tsinghua.edu.cn/simple
 
临时使用:
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent,这样就会从清华这边的镜像去安装gevent库。
 
永久修改,一劳永逸:
Linux下,修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:
 [global]
 index-url = https://pypi.tuna.tsinghua.edu.cn/simple
 
windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下
 
 [global]
 index-url = https://pypi.tuna.tsinghua.edu.cn/simple

2017年3月28日星期二

IronPython clr.AddReferenceToFile Error

 问题:在脚本中可以执行,但在交互解释器中出错。

 IronPython Tutorial
clr.AddReferenceToFile adds reference to the assembly specified by its file name. This function will load the assembly from the file regardless of the assembly version. As a result, it doesn't guarantee that the correct assembly version is being loaded. To guarantee that correct assembly version is being loaded, use clr.AddReferenceByName. Moreover, AddReferenceToFile requires that the assembly be located in a directory listed in sys.path.

how-to-use-a-c-sharp-dll-in-ironpython

import sys
import os

sys.path.insert(0, os.getcwd())


将脚本编译为可执行文件:
ipyc.exe /main:ymmj.py ymmj.py /platform:x64 /target:exe /standalone

miniupnp端口映射

$ upnpc
upnpc : miniupnpc library test client. (c) 2005-2014 Thomas Bernard
Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
Usage :    upnpc [options] -a ip port external_port protocol [duration]
        Add port redirection
           upnpc [options] -d external_port protocol [port2 protocol2] [...]
        Delete port redirection
           upnpc [options] -s
        Get Connection status
           upnpc [options] -l
        List redirections
           upnpc [options] -L
        List redirections (using GetListOfPortMappings (for IGD:2 only)
           upnpc [options] -n ip port external_port protocol [duration]
        Add (any) port redirection allowing IGD to use alternative external_port (for IGD:2 only)
           upnpc [options] -N external_port_start external_port_end protocol [manage]
        Delete range of port redirections (for IGD:2 only)
           upnpc [options] -r port1 protocol1 [port2 protocol2] [...]
        Add all redirections to the current host
           upnpc [options] -A remote_ip remote_port internal_ip internal_port protocol lease_time
        Add Pinhole (for IGD:2 only)
           upnpc [options] -U uniqueID new_lease_time
        Update Pinhole (for IGD:2 only)
           upnpc [options] -C uniqueID
        Check if Pinhole is Working (for IGD:2 only)
           upnpc [options] -K uniqueID
        Get Number of packets going through the rule (for IGD:2 only)
           upnpc [options] -D uniqueID
        Delete Pinhole (for IGD:2 only)
           upnpc [options] -S
        Get Firewall status (for IGD:2 only)
           upnpc [options] -G remote_ip remote_port internal_ip internal_port protocol
        Get Outbound Pinhole Timeout (for IGD:2 only)
           upnpc [options] -P
        Get Presentation url

protocol is UDP or TCP
Options:
  -e description : set description for port mapping.
  -6 : use ip v6 instead of ip v4.
  -u url : bypass discovery process by providing the XML root description url.
  -m address/interface : provide ip address (ip v4) or interface name (ip v4 or v6) to use for sending SSDP multicast packets.
  -p path : use this path for MiniSSDPd socket.

2017年3月25日星期六

How to install the latest Python version on Debian separately or upgrade?

How to install the latest Python version on Debian separately or upgrade?


Fixing an AVI index with mencoder

 Fixing an AVI index with mencoder

Fixing an AVI index with mencoder
This is more a “note to self”, but I’m sure others find it useful as well.

Quite often I run across AVI files with a broken index. That index is used in media players to seek rapidly in the movie file. Without an index or with a corrupt index, seeking either does not work at all or takes a long time.

mencoder, which is available on almost any platform, allows you to massage AVI files besides tons of other operations on a never-ending list of video formats.

Here’s the command to repair a broken AVI index (I used the mplayer/mencoder version that comes with the FreeBSD ports collection):

$ mencoder -idx in.avi -ovc copy -oac copy -o out.avi

2017年3月12日星期日

知呼:OS X 系统自带的截图快捷键

OS X 系统自带的截图快捷键

作者:陈浩
链接:https://www.zhihu.com/question/19550327/answer/12222576
来源:知乎
著作权归作者所有,转载请联系作者获得授权。

Cmd+Shift+3:全屏截图;截取整个屏幕,保存截图至桌面文件夹。
Cmd+Shift+4:区域截图;鼠标光标变成带坐标的小十字,通过拖拽截取特定区域,保存截图至桌面文件夹。
Cmd+Shift+4 - 单击空格键 - 鼠标单击指定窗口:窗口截图;出现小十字光标后对指定窗口按空格键,鼠标光标变成照相机,鼠标单击截取指定窗口,保存截图至桌面文件夹。
  • 进阶快捷键

  • Cmd+Shift+4 - 按住空格键拖动鼠标:区域截图;选取区域范围后,按住空格键并拖到鼠标可移动选取范围,释放按键后保存截图至桌面文件夹。
    Cmd+Shift+4 - 按住Shift - 上下/左右移动鼠标:区域截图;选取区域范围后,按住 Shift 并上下/左右移动鼠标即可固定选取范围宽度/高度改变高度/宽度,释放按键后保存截图至桌面文件夹。
    Cmd+Shift+4 - 按住Shift和Option: 区域截图;选取区域范围后,按住 Shift 和 Option 键在上一快捷键功能的基础上自由切换高度宽度,释放按键后保存截图至桌面文件夹。
    Cmd+Shift+4 - 按住Option: 区域截图;选取区域范围后,按住 Option 键可按比例缩放选取范围,释放按键后保存截图至桌面文件夹。
    PS:以上介绍的快捷键配合按住 Control 键即可将截图文件保存在剪切板,以供调用。

    2017年3月7日星期二

    使用mailx发送qq邮件

    本文出自 “宁静致远” 博客,
    请务必保留此出处http://irow10.blog.51cto.com/2425361/1812638

    mailx安装我就不介绍了,很简单!我先介绍下系统的版本和mailx的版本

    [root@localhost ~]# mailx -V
    12.4 7/29/08
    [root@localhost ~]# cat /etc/issue
    CentOS release 6.8 (Final)
    Kernel \r on an \m

    mailx的配置文件在/etc/mail.rc(我是rpm安装的)

    在配置文件中添加下面的代码(passwd写开通smtp客户端给的授权码)
       
    set from=usernam@163.com
    set smtp=smtp.163.com
    set smtp-auth-user=username@163.com
    set smtp-auth-password=passwd
    set smtp-auth=login

    测试下是否可以使用
       
    cat /opt/tesh |mailx -v -s 'hello' '*****@163.com'

    测试发现有时能发送,有时会退信并报以下错误:
       
    554 DT:SPM 163 smtp3,DdGowACX1p2fRn9X_lIIAA--.2018S2 1467958944,please see http://mail.163.com/help/help_spam_16.htm?ip=*.*.*.*&hostid=smtp3&time=1467958944
    smtp-server: 554 DT:SPM 163 smtp3,DdGowACX1p2fRn9X_lIIAA--.2018S2 1467958944,please see http://mail.163.com/help/help_spam_16.htm?ip=*.*.*.*&hostid=smtp3&time=1467958944
    "/root/dead.letter" 0/0
    . . . message not sent.

    554 DT:SPM 发送的邮件内容包含了未被许可的信息,或被系统识别为垃圾邮件。请检查是否有用户发送病毒或者垃圾邮件

    查了下原因,因为163反垃圾邮件设置的原因,所有我采用了qq邮箱及hostmail

    qq邮箱

       
    set from=224******53@qq.com
    set smtp=smtp.qq.com
    set smtp-auth-user=224******53@qq.com
    set smtp-auth-password=euia********chb   #授权码
    set smtp-auth=login

    错误提示:

    530 Error: A secure connection is requiered(such as ssl). More information at http://service.mail.qq.com/cgi-bin/help?id=28

    smtp-server: 530 Error: A secure connection is requiered(such as ssl). More information at http://service.mail.qq.com/cgi-bin/help?id=28

    "/root/dead.letter" 19/438

    . . . message not sent

    于是我改了下配置文件添加了几个参数

       
    set from=224******53@qq.com
    set smtp=smtp.qq.com
    set smtp-auth-user=224******53@qq.com
    set smtp-auth-password=euia********chb
    set smtp-auth=login
    set smtp-use-starttls
    set ssl-verify=ignore
    set nss-config-dir=/etc/pki/nssdb/

    邮件发送成功,在/etc/pki/nssdb/有证书文件

    当然还有两个方式可以获取证书文件

       
    mkdir -p /root/.certs/
    echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt
    certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
    certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
    certutil -L -d /root/.certs

    然后mail.rc的配置文件改成
       
    set from=224******53@qq.com
    set smtp=smtp.qq.com
    set smtp-auth-user=224******53@qq.com
    set smtp-auth-password=euia********chb
    set smtp-auth=login
    set smtp-use-starttls
    set ssl-verify=ignore
    set nss-config-dir=/root/.certs

    有些邮箱无法通过上述方式获取证书,我们可以在装有火狐浏览器的服务器中把证书拷贝过来

       
    [root@localhost test]# cd /home/test/.mozilla/firefox/twmiqm5n.default/
    [root@localhost twmiqm5n.default]# ll *db
    -rw-------. 1 test test 65536 Jul  7 16:29 cert8.db
    -rw-------. 1 test test 16384 Jul  7 16:29 key3.db
    -rw-------. 1 test test 16384 May 28 20:38 secmod.db

    把这个三个文件拷贝到指定文件下。比如:/root/.certs1

       
    set from=224******53@qq.com
    set smtp=smtp.qq.com
    set smtp-auth-user=224******53@qq.com
    set smtp-auth-password=euia********chb
    set smtp-auth=login
    set smtp-use-starttls
    set ssl-verify=ignore
    set nss-config-dir=/root/.certs1

    mailx的操作还是蛮简单的,就是一直报一个错误

    Error in certificate: Peer's certificate issuer is not recognized.

    证书没有获得认可

    解决方法:找个存放证书的目录

       
    [root@localhost .certs]# pwd
    /root/.certs
    [root@localhost .certs]# ll
    total 80
    -rw-------. 1 root root 65536 Jul  8 15:13 cert8.db
    -rw-r--r--. 1 root root  2293 Jul  7 16:25 qq.crt
    -rw-------. 1 root root 16384 Jul  8 15:13 key3.db
    -rw-------. 1 root root 16384 Jul  7 16:24 secmod.db
    [root@localhost .certs]# certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu"  -d ./ -i qq.crt
    Notice: Trust flag u is set automatically if the private key is present.

    这样就不会报错了。

       
    Resolving host smtp.qq.com . . . done.
    Connecting to *.*.*.* . . . connected.
    220 smtp.qq.com Esmtp QQ Mail Server
    >>> EHLO localhost
    250-smtp.qq.com
    250-PIPELINING
    250-SIZE 73400320
    250-STARTTLS
    250-AUTH LOGIN PLAIN
    250-AUTH=LOGIN
    250-MAILCOMPRESS
    250 8BITMIME
    >>> STARTTLS
    220 Ready to start TLS
    Comparing DNS name: "mx2.qq.com"
    ................................
    Comparing DNS name: "smtp.qq.com"
    SSL parameters: cipher=AES-256, keysize=256, secretkeysize=256,
    issuer=CN=GeoTrust SSL CA - G3,O=GeoTrust Inc.,C=US
    subject=CN=pop.qq.com,OU=R&D,O=Shenzhen Tencent Computer Systems Company Limited,L=Shenzhen,ST=Guangdong,C=CN
    >>> EHLO localhost
    250-smtp.qq.com
    250-PIPELINING
    250-SIZE 73400320
    250-AUTH LOGIN PLAIN
    250-AUTH=LOGIN
    250-MAILCOMPRESS
    250 8BITMIME
    >>> AUTH LOGIN
    334 VXNlcm5hbWU6
    >>> MjI0Njk0NTU1M0BxcS5jb20=
    334 UGFzc3dvcmQ6
    >>> ZXVpYXl1a3JrZ3JoZWNoYg==
    235 Authentication successful
    >>> MAIL FROM:<22******53@qq.com>
    250 Ok
    >>> RCPT TO:<username@163.com>
    250 Ok
    >>> DATA
    354 End data with <CR><LF>.<CR><LF>
    >>> .
    250 Ok: queued as
    >>> QUIT
    221 Bye

    sendEmail

    下面来介绍sendEmail的使用
       
    wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz
    tar -zxvf sendEmail-v1.56.tar.gz
    cd sendEmail-v1.56
    mv sendEmail /usr/local/bin/
    yum -y install perl-IO-Socket-SSL openssl-perl openssl-devel

    sendEmail就可以使用了。应为sendEmail没有配置文件,所以在发送邮件的时候需要填上发件人的账户密码,没有mailx方便.

    这是我们需要脚本辅助

       
    #!/bash/sh
    from_email='username@hotmail.com'
    smtp='smtp-mail.outlook.com:587'
    title='标题'
    to_email=`username@qq.com`
    passwd='passwd'
    body=`cat test`
    /usr/sbin/sendEmail -o tls=yes -f "$from_email"  -s "$smtp"  -u "$title"  -o message-content-type=text  -o message-charset=utf8 -t "$to_email" -xu "$from_email"  -xp "$passwd"  -m "$body"

    以上是个简单的脚本,当然标题和内容以及发件人你都可以传参进来。这样的话就不会再命令行中暴露密码。

    2017年3月6日星期一

    使用openssl发送邮件

    openssl s_client -connect smtp.qq.com:465 -crlf -ign_eof
    EHLO localhost
    AUTH LOGIN
    xxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxx

    MAIL FROM:<xxxx@qq.com>
    RCPT TO:<xxxx@163.com>
    DATA
    From: Test <xxxx@qq.com>
    To: Me <xxxx@163.com>
    Subject: Testing email from telnet
    This is the body
    .
    QUIT

    -------------------------------------------------------------------------------------
    # openssl s_client -connect smtp.qq.com:465 -crlf -ign_eof
    CONNECTED(00000003)
    depth=1 C = US, O = GeoTrust Inc., CN = GeoTrust SSL CA - G3
    verify error:num=20:unable to get local issuer certificate
    ---
    Certificate chain
     0 s:/C=CN/ST=Guangdong/L=Shenzhen/O=Shenzhen Tencent Computer Systems Company Limited/OU=R&D/CN=pop.qq.com
       i:/C=US/O=GeoTrust Inc./CN=GeoTrust SSL CA - G3
     1 s:/C=US/O=GeoTrust Inc./CN=GeoTrust SSL CA - G3
       i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
    ---
    Server certificate
    -----BEGIN CERTIFICATE-----
    MIIHrTCCBpWgAwIBAgIQStxVhUEPlKCJNmsoaRVQVjANBgkqhkiG9w0BAQsFADBE
    MQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMU
    R2VvVHJ1c3QgU1NMIENBIC0gRzMwHhcNMTYwOTA3MDAwMDAwWhcNMTgxMjA3MjM1
    OTU5WjCBkzELMAkGA1UEBhMCQ04xEjAQBgNVBAgMCUd1YW5nZG9uZzERMA8GA1UE
    BwwIU2hlbnpoZW4xOjA4BgNVBAoMMVNoZW56aGVuIFRlbmNlbnQgQ29tcHV0ZXIg
    U3lzdGVtcyBDb21wYW55IExpbWl0ZWQxDDAKBgNVBAsMA1ImRDETMBEGA1UEAwwK
    cG9wLnFxLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALeSY7Vb
    60Cvv7P2O+zhaZnqlz/KFs//DH4It3xmyMPFOPUFopzN1h8n3/4FPqGBtqEEuWBE
    /o7soZT30E8bw30Tl07VOcYm/fPKi1pyro3hNEdLi5Wlta9fKxDAvw0U3clSq39R
    qihYIDAA3QrDuqI54gULa5IZnqM16A9VBULPfIDaXbdgaAIJ5Ak92nC13YcdQYuv
    egL6jOWSKzCRTqeRAg+6dWkfce1+gAOCuCUDgAso2EJ+k9nFe/LAMMGdGbe4KI9H
    CwpDCMo+2k2u4SQtXOmuYke7nNmRnpJeL3qZnGWsqT7l3N0mYCc/+3zcMfAcmyuo
    H90stoWF/G2T2rcCAwEAAaOCBEkwggRFMIIBPwYDVR0RBIIBNjCCATKCEnVwbG9h
    ZC5tYWlsLnFxLmNvbYIUaHdzbXRwLmV4bWFpbC5xcS5jb22CFGh3aW1hcC5leG1h
    aWwucXEuY29tgg5jbG91ZG14LnFxLmNvbYISaW1hcC5leG1haWwucXEuY29tghNo
    d3BvcC5leG1haWwucXEuY29tggtzbXRwLnFxLmNvbYIKbXgzLnFxLmNvbYIRcnR4
    LmV4bWFpbC5xcS5jb22CCmRhdi5xcS5jb22CCm14MS5xcS5jb22CDW14Yml6MS5x
    cS5jb22CCWV4LnFxLmNvbYILaW1hcC5xcS5jb22CEXBvcC5leG1haWwucXEuY29t
    gg1teGJpejIucXEuY29tggpteDIucXEuY29tghJzbXRwLmV4bWFpbC5xcS5jb22C
    CnBvcC5xcS5jb20wCQYDVR0TBAIwADAOBgNVHQ8BAf8EBAMCBaAwKwYDVR0fBCQw
    IjAgoB6gHIYaaHR0cDovL2duLnN5bWNiLmNvbS9nbi5jcmwwgZ0GA1UdIASBlTCB
    kjCBjwYGZ4EMAQICMIGEMD8GCCsGAQUFBwIBFjNodHRwczovL3d3dy5nZW90cnVz
    dC5jb20vcmVzb3VyY2VzL3JlcG9zaXRvcnkvbGVnYWwwQQYIKwYBBQUHAgIwNQwz
    aHR0cHM6Ly93d3cuZ2VvdHJ1c3QuY29tL3Jlc291cmNlcy9yZXBvc2l0b3J5L2xl
    Z2FsMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAfBgNVHSMEGDAWgBTS
    b/eW9IU/cjwwfSPahXibo3xafDBXBggrBgEFBQcBAQRLMEkwHwYIKwYBBQUHMAGG
    E2h0dHA6Ly9nbi5zeW1jZC5jb20wJgYIKwYBBQUHMAKGGmh0dHA6Ly9nbi5zeW1j
    Yi5jb20vZ24uY3J0MIIBfQYKKwYBBAHWeQIEAgSCAW0EggFpAWcAdgDd6x0reg1P
    piCLga2BaHB+Lo6dAdVciI09EcTNtuy+zAAAAVcCsiY3AAAEAwBHMEUCIBZMjuD9
    LRps0VXtC5F0Dn5FXD8gM0iySH7lLJak/k/vAiEAiLxBze2hKotXAjrolqeYpTy2
    LE5B8/mm6HDRnTO5NpwAdQCkuQmQtBhYFIe7E6LMZ3AKPDWYBPkb37jjd80OyA3c
    EAAAAVcCsidpAAAEAwBGMEQCIBFWt7QviHZxdzT4N1eU+97X00f/iiYTKBnqcKAa
    ls/jAiBCer4UAZrSJ64TjbXhbARmSe+rKtoNEh3FbszBe0TSTAB2AGj2mPgfZIK+
    OozuuSgdTPxxUV1nk9RE0QpnrLtPT/vEAAABVwKyJ4sAAAQDAEcwRQIgCJlZbkC8
    uTXLwyyQPLWRMqLlVJ9bbVsEceP35AMq1V0CIQCgcwNrkcte+84dURDiteDnoco5
    NKLuVwk6+eMt0y3GtjANBgkqhkiG9w0BAQsFAAOCAQEAQDICKJnfn2hc/AzAfc1+
    v6PpIyDTLeT8mOd7qsO/PbTD7H38mdT1hk9M7lTqxYG/DcFmsPWhluGxHeVNq6St
    gw360UE241C3KTl+jQtN8BRSMJpmAL636mVuRU3euAJNmI21fuiz/vauWM85qsWj
    E6N91WTqbOijYU2p/HmwMjd7HEfQQUZtxzmJLlkPoFMy0P9fv2Q+01XTtrx4wpGQ
    VttfWsRh0388L56i3oyK3o50ZrT2twQuK59pUEgL1n7GBXIAe8L/YhYeW349UbYT
    jtFwjo+fYreSQaQe+1bKWRO+ZzUschK/QZ877zAZDe1gN0tqB9kqTLp4pAABkQ7s
    1A==
    -----END CERTIFICATE-----
    subject=/C=CN/ST=Guangdong/L=Shenzhen/O=Shenzhen Tencent Computer Systems Company Limited/OU=R&D/CN=pop.qq.com
    issuer=/C=US/O=GeoTrust Inc./CN=GeoTrust SSL CA - G3
    ---
    No client certificate CA names sent
    ---
    SSL handshake has read 3432 bytes and written 675 bytes
    ---
    Server public key is 2048 bit
    Secure Renegotiation IS supported
    Compression: NONE
    Expansion: NONE
    No ALPN negotiated
    SSL-Session:
        Protocol  : TLSv1.2
        Cipher    : AES128-SHA256
        Session-ID: A14F67315BF1542D3CD45B3B49A1FE6DEBA95A883B802728B6FCE4549CFD851D
        Session-ID-ctx:
        Master-Key: A8FDCD1EB692E305CB6D6BFEA985E4E7468908780DAE63173139892A4D97C7455A4F5E2D4FC08F573985F4D1EAC09BE9
        Key-Arg   : None
        PSK identity: None
        PSK identity hint: None
        SRP username: None
        TLS session ticket lifetime hint: 1200 (seconds)
        TLS session ticket:
        0000 - 67 30 86 a2 f7 69 8a cc-78 8e 26 48 d6 08 63 68   g0...i..x.&H..ch
        0010 - a5 11 d1 e4 09 f4 70 3f-e9 13 0b 46 63 bb 56 93   ......p?...Fc.V.
        0020 - d6 6d 94 ba 27 b0 a4 ef-ad b4 92 8b 05 83 aa 5e   .m..'..........^
        0030 - 84 00 46 74 ae c3 b5 55-d9 a7 74 e5 36 10 17 9e   ..Ft...U..t.6...
        0040 - 34 71 e9 bb de cd c1 ed-c6 15 04 73 b2 c9 54 4f   4q.........s..TO
        0050 - d5 14 ad d8 88 b7 fd 73-16 e4 8d a4 b1 09 22 52   .......s......"R
        0060 - df 75 5c 8c 35 72 33 c1-2f c5 f6 8b fe f8 1e d4   .u\.5r3./.......
        TLS session ticket:
        0000 - 67 30 86 a2 f7 69 8a cc-78 8e 26 48 d6 08 63 68   g0...i..x.&H..ch
        0010 - a5 11 d1 e4 09 f4 70 3f-e9 13 0b 46 63 bb 56 93   ......p?...Fc.V.
        0020 - d6 6d 94 ba 27 b0 a4 ef-ad b4 92 8b 05 83 aa 5e   .m..'..........^
        0030 - 84 00 46 74 ae c3 b5 55-d9 a7 74 e5 36 10 17 9e   ..Ft...U..t.6...
        0040 - 34 71 e9 bb de cd c1 ed-c6 15 04 73 b2 c9 54 4f   4q.........s..TO
        0050 - d5 14 ad d8 88 b7 fd 73-16 e4 8d a4 b1 09 22 52   .......s......"R
        0060 - df 75 5c 8c 35 72 33 c1-2f c5 f6 8b fe f8 1e d4   .u\.5r3./.......
        0070 - 8e bf 60 1b 19 57 5c 76-5e dd 97 83 a5 ec 4d ef   ..`..W\v^.....M.
        0080 - 8e 6d 26 b7 f5 3e f4 cc-ea 4b 5f 5f 25 99 2f f1   .m&..>...K__%./.
        0090 - 55 13 2b 12 02 42 69 39-5e ae 12 7d 47 0b 36 25   U.+..Bi9^..}G.6%

        Start Time: 1488852592
        Timeout   : 300 (sec)
        Verify return code: 20 (unable to get local issuer certificate)
    ---
    220 smtp.qq.com Esmtp QQ Mail Server
    ehlo [127.0.1.1]
    250-smtp.qq.com
    250-PIPELINING
    250-SIZE 73400320
    250-AUTH LOGIN PLAIN
    250-AUTH=LOGIN
    250-MAILCOMPRESS
    250 8BITMIME
    AUTH PLAIN xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    235 Authentication successful
    mail FROM:<xxxx@qq.com> size=78
    250 Ok
    rcpt TO:<xxxx@163.com>
    250 Ok
    data
    354 End data with <CR><LF>.<CR><LF>
    From: Test <xxxx@qq.com>
    To: Me <xxxx@163.com>
    Subject: Testing email from telnet
    This is the body
    .
    250 Ok: queued as
    quit
    221 Bye
    closed

    Python one-line HTTP server

    python -m SimpleHTTPServer 8000

    will serve the contents of the current working directory over HTTP on port 8000.

    If you use Python 3, you should instead write

    python3 -m http.server 8000

    See the SimpleHTTPServer module docs for 2.x and the http.server docs for 3.x.

    By the way, in both cases the port parameter is optional.

    2017年3月5日星期日

    FFmpeg实用命令:音频、视频格式转换和其它操作

    FFmpeg实用命令:音频、视频格式转换和其它操作

    下面命令从mp4文件中提取出MP3音频:

    ffmpeg -i yourvideo.mp4 -vn -ab 128k outputaudio.mp3

    -vn用来提取声音,-ab指定存储为128Kbps mp3格式,可以指定256K或其他码率。


    Cutting small sections

    To extract only a small segment in the middle of a movie, it can be used in combination with -t which specifies the duration, like -ss 60 -t 10 to capture from second 60 to 70. Or you can use the -to option to specify an out point, like -ss 60 -to 70 to capture from second 60 to 70. -t and -to are mutually exclusive. If you use both, -t will be used.
    Note that if you specify -ss before -i only, the timestamps will be reset to zero, so -t and -to have not the same effect. If you want to keep the original timestamps, add the -copytsoption.
    The first command will cut from 00:01:00 to 00:03:00 (in the original), using the faster seek.
    The second command will cut from 00:01:00 to 00:02:00, as intended, using the slower seek.
    The third command will cut from 00:01:00 to 00:02:00, as intended, using the faster seek.
    ffmpeg -ss 00:01:00 -i video.mp4 -to 00:02:00 -c copy cut.mp4
    ffmpeg -i video.mp4 -ss 00:01:00 -to 00:02:00 -c copy cut.mp4
    ffmpeg -ss 00:01:00 -i video.mp4 -to 00:02:00 -c copy -copyts cut.mp4
    
    If you cut with stream copy (-c copy) you need to use the -avoid_negative_ts 1 option if you want to use that segment with the concat demuxer .
    Example:
    ffmpeg -ss 00:03:00 -i video.mp4 -t 60 -c copy -avoid_negative_ts 1 cut.mp4
    

    Time unit syntax

    Note that you can use two different time unit formats: sexagesimal (HOURS:MM:SS.MICROSECONDS, as in 01:23:45.678), or in seconds. If a fraction is used, such as 02:30.05, this is interpreted as "5 100ths of a second", not as frame 5. For instance, 02:30.5 would be 2 minutes, 30 seconds, and a half a second, which would be the same as using 150.5 in seconds.

    2017年2月22日星期三

    What are AcDbCurve/Curve Parameters? ObjectARX/.NET

    What are AcDbCurve/Curve Parameters? ObjectARX/.NET

    By Philippe Leefsma
    Please can you explain what Parameters are?
    In simple terms, the parameter of a curve defines a 0-n floating point value indicating point positions on a curve.
    Lets use a polyline as an example of what to expect from a parameter value.
    If we have a polyline which has 5 points, and each of the 4 lines are different in length. If we call AcDbCurve::getStartParam() we will be returned a value of 0, if we call AcDbCurve::getEndParam() we will get a value of 4, if we extract the 2nd polyline point and call AcDbCurve::getParamAt() we will be returned a parameter value of 1. So you can see that in the case of a polyline, the parameter values directly represent each of the start and end points of the Polyline.
    Parameters are very powerful, for instance, I can extract the halfway point between p1 and p2 by calling AcDbCurve::getPointAtParam(0.5) or the third of a distance between p3 and p4 by calling AcDbCurve::getPointAtParam(2.33333).
    Another point to mention is that parameter values, although define a 0-n floating point value indicating point positions on a curve, are designed to best fit the needs of the curve being implemented. For example, the polyline example above uses parameter values as start and end point positions, this is a very efficient way to use parameters for a polyline and indeed makes logical sense, but for a circle the parameter values correspond to a radian increment around the circle. So, for a polyline the parameter value is non-uniform whereas the circle uses a uniform parameter value.

    2017年1月14日星期六

    ogr2ogr kml

     将kml文件转换为dxf文件

    ogr2ogr -t_srs EPSG:2385 -f DXF lhk_fbd.dxf doc.kml

    更新:以上方法会出错,不知道原因
    01 未解决
    02 多出的字段是因为libkml
    03 OGR_SKIP

    ogrinfo -al --config OGR_SKIP LIBKML  qyl.kml

    ogr2ogr   --config OGR_SKIP LIBKML  -t_srs EPSG:2436 -f DXF qyl.dxf qyl.kml


    2017年1月12日星期四

    msys2 cgal

     $ pacman -Qe

    mingw-w64-x86_64-cgal 4.9-1
    mingw-w64-x86_64-cmake 3.7.0-1
    mingw-w64-x86_64-freeglut 3.0.0-4
    mingw-w64-x86_64-gcc 6.2.0-2
    mingw-w64-x86_64-make 4.1.2351.a80a8b8-1
    mingw-w64-x86_64-mesa 13.0.2-1
    mingw-w64-x86_64-qt-creator 4.1.0-1
    mingw-w64-x86_64-qt5 5.6.2-4


    cmake -G "MinGW Makefiles"   -DCMAKE_MAKE_PROGRAM=mingw32-make  .

     "C:\msys64\home\li\examples\Core\CMakeFiles\delaunay.dir\flags.make"
    CXX_DEFINES = -DCGAL_Core_EXPORTS -DCGAL_USE_GMP -DCGAL_USE_MPFR 

    2017年1月1日星期日

    brew with a socks5 proxy

    brew with a socks5 proxy

    set a socks proxy with git for the http transport
    git config --global http.proxy 'socks5://127.0.0.1:1081'
    
    set a socks proxy for curl: just add proxy=socks5://127.0.0.1:1081 to ~/.curlrc.

    virtualenv-tutorial

    virtualenv-tutorial