Tag: Summary

  • 编辑~/.vimrc,用vim新建文件时自动套用模板

    编辑~/.vimrc文件

    vim ~/.vimrc

    添加一行

    autocmd BufNewFile *.py 0r ~/.vim/template/simple.py

    新建simple.py文件

    mkdir -p ~/.vim/template/
    vim ~/.vim/template/simple.py

    加入以下内容

    #!/usr/bin/env python
    #-*- coding:utf-8 -*-
    #author: jpuyy date  jpuyy.com
    #modified by xx at date
    #version:
    #history:
    #relate on:

    这样每次新建 .py 文件的时候,就会自动套用上面的模版

    :)EOT

  • ubuntu vps使用zh_CN.utf8编码

    使用

    locale -a

    发现只有英文编码,使用命令

    bash /usr/share/locales/install-language-pack zh_CN

    install-language-pack脚本内容如下:

    #!/bin/sh -e
    
    if [ -z "$1" ]; then
        echo "Usage: $0 <language code> <class> [<version>]"
        exit 0
    fi
    
    # install locales for base packages (not for gnome/kde)
    # (use "--no-purge" in case PURGE=yes is used in config, which would remove
    #  all other locale files)
    if [ -z "$2" ]; then
        /usr/sbin/locale-gen --no-purge --lang "$1"
    fi
    
    # ensure that .desktop caches are up to date
    dpkg-trigger gmenucache || true

    通过如下命令,使默认编码为 zh_CN.utf8

    echo LANG="zh_CN.utf8" >> /etc/environment

    这样

    echo $LANG显示是
    zh_CN.utf8

    加其他语言编码雷同

    追加:
    使用dpkg-reconfigure来改变语言包更简单

    # dpkg-reconfigure locales

    CentOS7设置 locale

    localectl status # to display locale settings
    localectl set-locale LANG=en_GB.utf8 # to set the Language
    
  • 批处理生成以今天为名的文件夹

     

    @echo on
    if not exist %date:~0,10% (md %date:~0,10%)

    RT

    :)EOT

  • ubuntu下PAC Manager使用

    windows下面经常用Secure CRT来多标签连SSH

    linux下面用PAC Manager也是想当的顺手

    支持rsa加密的key来连接

    下载地址:http://sourceforge.net/projects/pacmanager/

    怎么生成key,看之前的ssh的key的生成

    在PAC Manager使用key的认证会提示说

    @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
    
    Permissions 0440 for '/home/jpuyy/Dropbox/key/xxxxx' are too open.
    It is recommended that your private key files are NOT accessible
    by others.
    This private key will be ignored.

    这样的话它是希望权限规定的越死越好,那么把文件弄成400,即只允许用户的读权限,其它一律不许

    chmod 400 xxx

    这样就可以了

    :)EOT

  • mysql启动失败

    /usr/sbin/mysqld status

    提示

    lc-messages-dir=/usr/share/mysql

    http://www.dotdeb.org/2011/11/01/mysql-5-5-is-finally-here/ 给出了解决方法

    在my.cnf中注释掉就可以了

    "The mysql-common package will be upgraded to version 5.5.17. It’s no
    big deal, it only contains retro-compatible configuration files."
    Wrong. The my.cnf delivered by mysql-common-5.5 contains the
    lc-messages-dir setting, which MySQL Server 5.1 cannot understand
    and will fail to start.To everyone who upgraded mysql-common to 5.5,
    but left mysql-server unchanged: Comment out the lc-messages-dir
    setting in my.cnf OR YOUR MYSQL SERVER WILL FAIL TO START.
    
     Best regards,
     Tobias
  • 不是觉得百来块的书贵么

    买到一包假南京烟

    十一块五浪费了

    不是觉得百来块的书贵么

    抽十来包烟,就能买一本,还觉得贵么?