[-] owsei@programming.dev 4 points 1 week ago* (last edited 1 week ago)

I made this one to find binaries in NixOs and other systems

get_bin_path() {
        paths=${2:-$PATH}
        for dr in $(echo $paths | tr ':' '\n') ; do
                if [ -f "$dr/$1" ] ; then
                        echo "$dr/$1"
                        return 0
                fi
        done
        return 1
}

Then I made this one to, if I have a shell o opened inside neovim it will tell the neovim process running the shell to open a file on it, instead of starting a new process

_nvim_con() {
        abs_path=$(readlink --canonicalize "$@" | sed s'| |\\ |'g)
        $(get_bin_path nvim) --server $NVIM --remote-send "<ESC>:edit $abs_path<CR>"
        exit
}

# start host and open file
_nvim_srv() {
        $(get_bin_path nvim) --listen $HOME/.cache/nvim/$$-server.pipe $@
}

if [ -n "$NVIM" ] ; then
        export EDITOR="_nvim_con"
else
        export EDITOR="_nvim_srv"
fi

Lastly this bit: which if it detects a file and a line number split by a : it will open the file and jump to the line

_open() {
        path_parts=$(readlink --canonicalize "$@" | sed s'| |\\ |'g | sed 's/:/\t/' )
        file=$(echo "$path_parts" | awk ' { print $1 }' )
        line=$(echo "$path_parts" | awk ' { print $2 }' )

        if [ -n "$line" ] ; then
                # has line number
                if [ -n "$NVIM" ] ; then
                        $(get_bin_path nvim) --server $NVIM --remote-send "<ESC>:edit $file<CR>:+$line<CR>"
                        exit
                else
                        $(get_bin_path nvim) --listen $HOME/.cache/nvim/$$-server.pipe $file "+:$line"
                fi
        else
                $EDITOR $file
        fi
}

alias nvim="_open"

all of my bash config is here

[-] owsei@programming.dev 4 points 2 weeks ago

Oh yeah, 100%

No, that's the entire curriculum [...]

I was asking about what country has US meddling as a considerable fraction of the curriculum

[-] owsei@programming.dev 4 points 2 weeks ago

Which country?

In Brazil there have been several pretty important meddlings, but at most the schools say that there where "several parties involved"

Like our dictatorship, where I'd only learnt "other countries incentivized the coup"

[-] owsei@programming.dev 4 points 4 months ago

Ubuntu is based on Debian, so Pop_OS! still uses .deb

[-] owsei@programming.dev 4 points 6 months ago

Randy Feltface

[-] owsei@programming.dev 4 points 6 months ago

For me The Rust Book was useful for discovering features of the language, not to discover how to code with Rust

[-] owsei@programming.dev 4 points 8 months ago

I've re-read the last paragraph. I'm quite slow, it's 100% sarcasm.

[-] owsei@programming.dev 4 points 9 months ago

Yeah it is. Check out this thread

[-] owsei@programming.dev 4 points 10 months ago

Damm, I legit didn't knew there bcrypt had a length limit! Thank you for another reason not to use bcrypt

[-] owsei@programming.dev 3 points 10 months ago

Oh, I already hated windows, that was just the last straw

[-] owsei@programming.dev 3 points 1 year ago

Yeah!

it's basically a noop, I use it as a placeholder when I'm writing a script, since bash doesn't accept code blocks with no commands

[-] owsei@programming.dev 3 points 1 year ago

There's also the QBE backend

view more: ‹ prev next ›

owsei

joined 2 years ago