Skip to content

15th Week of 2022

Computer Science

GNULinux

Basics

  • New: Get command output or default value if emtpy.

    echo | sed 's/^$/default value/'
    

Git

  • New: Modify specific commit message.

    git rebase --interactive '<commit-id>^'
    

    Then replace pick with r and save to modify the commit message.

neovim

  • New: Search for visual selection.

    vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
    
    To use the mapping, visually select the characters that are wanted in the search, then type // to search for the next occurrence of the selected text.

sed

  • New: Use matched pattern.

    echo "foobarbaz" | sed 's/^foo\(.*\)baz$/\1/'
    

    Returns bar.

Programming

basics

JSDoc

  • New: JSDoc @example.

    `javascript /** * Solves equations of the form a * x = b * @example * // returns 2 * globalNS.method1(5, 10); * @example * // returns 3 * globalNS.method(5, 15); * @returns {Number} Returns the value of x for the equation. */ globalNS.method1 = function (a, b) { return b / a; };

  • New: JSDoc @type.

    Reference: Use JSDoc: @type.

Basics

  • New: Check syntax without running.

    Try to compile it:

    python -m py_compile script.py