Blog

  • python查看已经安装的模块

    方法一:

    
    >>> help('modules')
    
    Please wait a moment while I gather a list of all available modules...
    
    ....
    
    Enter any module name to get more help.  Or, type "modules spam" to search
    
    for modules whose descriptions contain the word "spam".
    

    方法二:

    >>> import sys
    
    >>> sys.modules
    
  • vim插入当前日期

    在normal模式下,直接执行

    !!date

    如果要显示YYYY-MM-DD,需要跟%F,%需要用\转义

    !!date +\%F

    也可以使用:r!读取date命令

    :r! date "+\%Y-\%m-\%d \%H:\%M:\%S"

    区别是!!date会将当前行替换成当前日期,:r!date会新建一行并插入当前日期。

  • mac linux usb console线连交换机

    一般usb转console线的参数如下

     波特率 9600
     数据位 8
     奇偶校验None
     停止位 1

    osx自带screen命令,usb console线插在mac上之后,在/dev/下会认到这个线的编号。

    /dev/cu.usbserial-xxxxxx
    /dev/tty.usbserial-xxxxxx

    接下来执行下面的命令即可,9600是波特率

    screen /dev/tty.usbserial-A4006Jvo 9600

    补充:

    linux 下使用 screen 连接 console

    通过 lsusb 查看插上去的线能被识别到,然后默认到 com1 口连接,如 /etc/ttyS0 ,使用如下命令接到交换机。

    screen /dev/ttyS0
  • mysql内置ip转换函数

    将十进制数转换为ipv4地址

    MariaDB [(none)]> select inet_aton('192.168.1.23');
    +---------------------------+
    | inet_aton('192.168.1.23') |
    +---------------------------+
    |                3232235799 |
    +---------------------------+
    1 row in set (0.00 sec)
    

    将ipv4地址转换为十进制数

    MariaDB [(none)]> select inet_ntoa(3232235799);
    +-----------------------+
    | inet_ntoa(3232235799) |
    +-----------------------+
    | 192.168.1.23          |
    +-----------------------+
    1 row in set (0.00 sec)
    

    自己常用的几个值

    10.0.0.0 167772160
    10.255.255.255 184549375
    192.168.0.0 3232235520
    192.168.255.255 3232301055

  • nc netcat使用

    接收方开端口3389,将接收文件保存为jdk-7u40-linux-x64.gz

    nc -l  3389 > jdk-7u40-linux-x64.gz

    发送方写上接收方的外网ip,端口号与接收方保持一致,最后接要发送的文件

    nc 101.6.25.22 3389 < /Volumes/PENDRIVE/jdk-7u40-linux-x64.gz

     

    http://blog.csdn.net/michael493439861/article/details/7445454

    查看一台机器端口开放情况

    nc -z 192.168.1.1 80
  • 这才叫电脑-macbookair13

    一直以来都有人说苹果是硬件和软件的结合,用了以后果然名不虚传。

    jpuyy macbook air 13

    一直很想用mac,用过windows,ubuntu始终达不到想要的效率,决定要买mac之后一天也不想多等,于是在网上找二手,在v2ex上发了一个求购,还真有回复,联系之后,约在麦当劳见面,检验了一下都没有问题,是2012年款的8G版,保持的还很新,5000块支付宝当面付了。买回来系统都没有重装,把他的账号改了个名字就开始使用。

    mac新到,装的软件

    dropbox
    qq
    sublime
    chrome
    Microsoft Remote Desktop
    shadowsocks
    git
    screen
    redis
    mysql