V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
MarioLuisGarcia
V2EX  ›  问与答

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

  •  
  •   MarioLuisGarcia · 2015-01-12 18:05:19 +08:00 · 3102 次点击
    这是一个创建于 3401 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    所以提了这个问题。

    先抛个砖:

    我主要的偷懒方法集中在各种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 条回复    2015-01-14 03:21:35 +08:00
    ll0xff
        1
    ll0xff  
       2015-01-12 19:00:31 +08:00
    日常命令都alias,包括提交代码和切换目录。

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

    大部分时候用vim
    abelyao
        2
    abelyao  
       2015-01-12 19:12:35 +08:00   ❤️ 5
    楼主用了令人发指这个词真是令人发指。
    markyangd
        3
    markyangd  
       2015-01-12 19:16:01 +08:00
    @abelyao 亮了
    YY
        4
    YY  
       2015-01-12 19:20:18 +08:00
    oxfordlearnersdictionaries.com 这个网站貌似不错,谢lz
    66450146
        5
    66450146  
       2015-01-12 19:55:58 +08:00
    在上班的时候拉屎
    BlueFly
        6
    BlueFly  
       2015-01-12 19:58:20 +08:00
    @66450146 还以为是```在拉屎的时候上班```
    Goooogle
        7
    Goooogle  
       2015-01-12 20:02:56 +08:00
    查字典我是这样的
    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
        8
    MarioLuisGarcia  
    OP
       2015-01-12 20:23:08 +08:00
    @Goooogle 他应该用的插件,之前提过名字,我忘了,我搜搜看
    MarioLuisGarcia
        9
    MarioLuisGarcia  
    OP
       2015-01-12 20:24:30 +08:00
    Goooogle
        10
    Goooogle  
       2015-01-12 20:34:26 +08:00
    @MarioLuisGarcia
    这太宽泛了 0.0
    问下你同事就可以,如果方便的话
    hx1997
        11
    hx1997  
       2015-01-12 20:45:34 +08:00
    在学校电脑装了个国内同步盘同步到家里
    家里再设置个符号链接同步到 Dropbox
    P233
        12
    P233  
       2015-01-12 20:55:01 +08:00
    easonleo
        13
    easonleo  
       2015-01-12 20:58:49 +08:00
    辞职
    iac
        14
    iac  
       2015-01-12 21:22:28 +08:00   ❤️ 1
    带薪蹲坑
    c742435
        15
    c742435  
       2015-01-12 22:19:03 +08:00
    lastpass记住主密码。
    为了安全起见买yubikey,使用硬件记住密码。
    但是每次打开浏览器都要按一下太麻烦了,还是改为直接让lastpass记住主密码。
    gateswong
        16
    gateswong  
       2015-01-14 03:21:35 +08:00
    @iac 笑尿了,你不是一个人
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   6027 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 02:57 · PVG 10:57 · LAX 19:57 · JFK 22:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.