MarioLuisGarcia
V2EX  ›  问与答

为了偷懒大家都做了哪些令人发指的事情?

  •  
  •   MarioLuisGarcia · Jan 12, 2015 · 4225 views
    This topic created in 4320 days ago, the information mentioned may be changed or developed.

    刚才忽然有个感触: 程序员是世界上最懒的人,他们会不遗余力地去寻找让自己偷懒的方法。

    然后想:你有一个偷懒的方法,我有一个偷懒的方法,我们分享一下不就有两个偷懒的方法了吗?

    所以提了这个问题。

    先抛个砖:

    我主要的偷懒方法集中在各种rc文件的配置里,其中又以alias为主力。

    其中有这么些类型:
    1. 直接切换到常用目录
    alias vf='pushd /my/frequent/visited/direcotry'
    用pushd是因为可以快速用pushd再切回上个目录

    1. 快速连接远程服务器
      alias rmt='ssh [email protected]'

    2. 缩写常用命令
      alias py='python'
      alias ga='git add'

    另外,为了方便地在terminal环境下查英文单词,我做了两个global function,放在bashrc里
    function dee { w3m "http://www.oxfordlearnersdictionaries.com/definition/american_english/$1"; }
    function dec { w3m "http://dict.cn/$1"; }
    export -f dee
    export -f dec
    这样,输入dee ogre,我就能在terminal里直接看到ogre的释义了(需先安装w3m)

    我的同事在vim里配置有自动生成文档和基本结构的快捷键,这样他在写python代码的时候可以节省很多的功夫,可是这个方法我还没学到手。

    你有哪些偷懒的方法呢?

    16 replies  •  2015-01-14 03:21:35 +08:00
    ll0xff
    ll0xff
    Jan 12, 2015
    1
    日常命令都alias,包括提交代码和切换目录。

    重复动作基本上都写Makefile或者shell

    大部分时候用vim
    abelyao
    abelyao
    Jan 12, 2015❤️5
    2
    楼主用了令人发指这个词真是令人发指。
    markyangd
    markyangd
    Jan 12, 2015
    3
    @abelyao 亮了
    YY
    YY
    Jan 12, 2015
    4
    oxfordlearnersdictionaries.com 这个网站貌似不错,谢lz
    66450146
    66450146
    Jan 12, 2015
    5
    在上班的时候拉屎
    BlueFly
    BlueFly
    Jan 12, 2015
    6
    @66450146 还以为是```在拉屎的时候上班```
    Goooogle
    Goooogle
    Jan 12, 2015
    7
    查字典我是这样的
    sudo apt-get install dict-stardic dict-xdict
    然后dict hello查询

    这种方式没有发音,所以写了个Fun
    mydict () {
    # Show usage
    if [ $# = 1 ]; then
    if [[ $1 == -h || $1 == "--help" ]]; then
    echo "Usage: add any numbers of words as parameters"
    echo "Or: just run mydict and input any numbers of words"
    echo " It will translate every words to Chinese and pronounce it"
    echo " You need have dict installed"
    return
    fi
    fi
    # If any parameters, translate them and pronounce them first
    for param in $@; do
    echo "-----------------------------------------------------"
    dict $param
    mplayer http://dict.youdao.com/dictvoice\?audio\=$param > /dev/null 2>&1
    return
    done
    # Translate every word user input which separated by spaces
    while true; do
    echo -n ">>>"
    read words
    for word in $(echo $words); do
    echo "-----------------------------------------------------"
    dict $word
    mplayer http://dict.youdao.com/dictvoice\?audio\=$word > /dev/null 2>&1
    done
    done
    }

    估计格式会乱 http://pastebin.com/JiD5sUWy

    这样直接mydict word1 word2
    或者mydict 然后输入单词 依次翻译,同时发音

    进入常用目录可以用autojump 会记录命令行下常用的文件夹
    j foo会直接进入常用的包含有foo的文件夹
    如j dow一般就进入~/Download了
    进入上个文件夹用cd -



    其他的基本都是常用的alias fun也很多,都放在.zshrc中了
    比如apt-get和dpkg,vim .zshrc/.vimrc等等
    https://github.com/wu-nerd/dotfile
    或者http://alias.sh/


    求你同事的Vim配置
    MarioLuisGarcia
    MarioLuisGarcia
    OP
    Jan 12, 2015
    8
    @Goooogle 他应该用的插件,之前提过名字,我忘了,我搜搜看
    Goooogle
    Goooogle
    Jan 12, 2015
    10
    @MarioLuisGarcia
    这太宽泛了 0.0
    问下你同事就可以,如果方便的话
    hx1997
    hx1997
    Jan 12, 2015
    11
    在学校电脑装了个国内同步盘同步到家里
    家里再设置个符号链接同步到 Dropbox
    P233
    P233
    Jan 12, 2015
    12
    easonleo
    easonleo
    Jan 12, 2015
    13
    辞职
    iac
    iac
    Jan 12, 2015❤️1
    14
    带薪蹲坑
    c742435
    c742435
    Jan 12, 2015
    15
    lastpass记住主密码。
    为了安全起见买yubikey,使用硬件记住密码。
    但是每次打开浏览器都要按一下太麻烦了,还是改为直接让lastpass记住主密码。
    gateswong
    gateswong
    Jan 14, 2015
    16
    @iac 笑尿了,你不是一个人
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4645 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 295ms · UTC 06:30 · PVG 14:30 · LAX 22:30 · JFK 01:30
    ♥ Do have faith in what you're doing.