News for hackers. Stuff that matters.
Re:Ask HN: Can I see your scripts? by falcolas on Monday August 15, 2022 @10:03AM (#32469820)
For local documentation of libraries (and languages):

    #! /bin/bash

    remote_file_path=$1

    wget --recursive --level=5 --convert-links --page-requisites --wait=1 --random-wait --timestamping --no-parent ${remote_file_path}
And a couple of zshrc functions which make jumping around my filesystem quite snappy. `jump` is aliased to `j`, and `mark` to `m`

    MARKPATH=~/.marks
    function jump {
        cd -P ${MARKPATH}/$1 2> /dev/null || (echo "No such mark: $1" && marks)
    }
    function mark {
        mkdir -p ${MARKPATH}; ln -s $(pwd) $MARKPATH/$1
    }
    function unmark {
        rm -i ${MARKPATH}/$1
    }
    function marks {
        ls -l ${MARKPATH} | sed 's/  / /g' | cut -d' ' -f9- && echo
    }
    _jump()
    {
        local cur=${COMP_WORDS[COMP_CWORD]}
        COMPREPLY=( $(compgen -W "$( ls $MARKPATH )" -- $cur) )
    }
    complete -F _jump jump
(Totally stolen, and fixed up to work in ZSH)
Re:Ask HN: Can I see your scripts? by firesloth on Monday August 15, 2022 @11:00AM (#32470527)
I did something similar in bash using cd instead of jump.

  export CDPATH=.:~/.marks/
  function mark {
    ln -sv "$(pwd)" ~/.marks/"$1"
  }
I prefix all the "marks" with a symbol (eg "@") then if I do

  $ cd @
then press tab it will list all the marks, or autocomplete if I type more.
Re:Ask HN: Can I see your scripts? by blueblob on Monday August 15, 2022 @10:43AM (#32470311)
I also stole jump script, but instead of aliasing, I just renamed the function to j instead of jump. I still kept mark as is because I don't use it anywhere near as often as j.