Skip to content
NoviceLivePublic

About

One configuration conquers them all. (Hopefully.)

Resources

Stars

30 stars

Watchers

5 watching

Forks

Repository files navigation

Unish - One Configuration To Rule Them All

Hopefully it will eventually come true in ten years. :)

Current State: Primitive.

Documentation

Some might not be related with Unish, but with Linux or in general with POSIX or UNIX.

Some One-Liners That May Fade From Memory

  • tilsuc: Unattended download of videos over unstable connection.

    Note: There is a shell script now, at commands/tilsuc.sh.

    It seems more appropriate to add a sleep in the while loop, when the main command doesn't support immediate re-entrance.

    tilsuc() { while true; do "${@}"; if [[ $? -eq 0 ]]; then break; fi; sleep 1; done; }; tilsuc youtube-dl --proxy 'socks5://127.0.0.1:1080' 'http://www.pbs.org/newshour/episode/pbs-newshour-full-episode-feb-24-2017/'
    
  • If you have many Git repositories, this one-liner might come in handy.

    Note that all my repositories are named in this format, '<name>.<vcs>'. For instance, unish.git, unish.hg and unish.svn.

    find -maxdepth 1 -name '*.git' -exec sh -c 'cd {} && git status' \;
    
  • Clean up compiled Python files before packaging or distributing.

    find -name '*.pyc' -delete && find -name '__pycache__' -delete
    
  • I tend to use this pylint recently.

    E.g, 1000, to which pylint defaults, is not a good candidate for maximum line count, whereas 999 or 9999 is.

    Guess what?

    I refuse to pay the space of a single character, len('1000') - len('999'), for a single line, 1000 - 999, when my editors always have line numbers on.

    pylint --reports n --output-format colorized --disable=missing-docstring,too-few-public-methods,too-many-ancestors,broad-except,invalid-name,too-many-locals,too-many-arguments,too-many-instance-attributes,too-many-public-methods,too-many-lines,too-many-branches,too-many-statements,duplicate-code
    

Warning

Unish may work only in Zsh 5.2 & Bash 4.3. You have been warned.

Still Warning

You are not recommended to use Unish directly. (It sucks :(.) Instead, absorbing or extracting and adapting some bits or pieces that fit in your needs.

But it's not abandoned and will be updated regularly as I experiment on various fancy stuffs.

Features

  • Intentional command-not-found handler

    Work in progress, prototype available.

    For more details, see py/found.py, py/fdb.py, as well as the command-not-found handling functions.

Update

py/found.py and related code now reside in UrlMark.

Show Cases

$ # Search in Google or Bing, and many others.
$ @google Who is the president of US
$ @bing Who is the president of US

$ # Open a website.
$ @github

$ # Search in dictionaries.
$ @oxford pulchritude
$ @urban '<3'
  • Smart Commands (Growing)

    Commands with knowledge of their invocation environment and behave accordingly.

    See the dedicated section below.

  • Logging Layer (Primitive)

    I'm addicted to logs, and dream of writting fantastic ones, which give me a feeling that my code is more of myself, a human being, rather than some strange pieces run inside a cold machine.

    Because it's me that wrote it!

  • Built-in Help Layer (Primitive)

    Created by a previous Bash user who missed that handy help builtin and appreciated the fantastic run-help in Zsh world.

  • Documentation generator (Ongoing)

    I hate documentation that isn't generated from code.

    Known exceptions: readme, changelog as well as commit messages.

  • Plugin Layer (Planned)

Installation