[-] sebastiancarlos 1 points 5 days ago

I fear M4. The boomers programmed too greedily and too deep, they almost unleashed computational hell upon us.

150
126
submitted 3 weeks ago* (last edited 3 weeks ago) by sebastiancarlos to c/linux@lemmy.ml

Either self-hosted or cloud, I assume many of you keep a server around for personal things. And I'm curious about the cool stuff you've got running on your personal servers.

What services do you host? Any unique stuff? Do you interact with it through ssh, termux, web server?

327
submitted 1 month ago by sebastiancarlos to c/programmerhumor@lemmy.ml
29
submitted 2 months ago* (last edited 2 months ago) by sebastiancarlos to c/linux@lemmy.ml

Hey,

As an avid CLI user, I always aimed to master non-interactive tools to perform most of my work, given that they are easy to use, create, extend, and connect.

However, I found myself dealing with software projects with many files (mostly under the yoke of corporate oppression; an ordeal which I endure to sustain myself, as most of those reading me do, and therefore I will not go further into this topic) and started to hit the limits of non-interactive tools to find and edit files. Indeed, I could go faster if I followed the temptation of monstrous IDEs, as I did in my innocent past.

I did not despair, as naturally I heard of the usefulness of interactive fuzzy finders such as fzf. After spending an afternoon evaluating the tool, I concluded that it indeed increases the complexity of my workflow. Still, this complexity is managed in a sensible way that follows the UNIX tradition.

I now ask you two general questions:

  • Did you reach similar conclusions to me and decide to use interactive fuzzy finders to solve working on software projects with many files?
  • If you use fzf or similar tools, what can you tell me about your workflow? Any other third-party tools? Do you integrate it into your scripts? Any advice that you can give me out of a long time of experience using the tool that is not easily conveyed by the documentation?

I also ask this very specific question:

  • The one part of fzf which I found missing was a way to interact with the results of grep, and to automatically place the selected file(s) in the prompt or an editor. For that, I created the following two commands. Do you have a similar workflow when you want to bring the speed of fuzzy finding to grep?
#! /usr/bin/env bash

# gf: grep + fzf
# basically a wrapper for 'grep <ARGS> | fzf | cut -f 1 -d:'

# print usage on -h/--help
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
    echo "Usage: gf <grep-args>"
    echo
    echo "~~~ that feel when no 'gf' ~~~"
    echo
    echo "- Basically a wrapper for 'grep <ARGS> | fzf | cut -f 1 -d:'"
    echo "- Opens fzf with grep results, and prints the selected filename(s)"
    echo "- Note: As this is meant to search files, it already adds the -r flag"
    echo
    echo "Example:"
    echo "  $ nvim \`gf foobar\`"
    echo "  $ gf foobar | xargs nvim"
    exit 0
fi

# run grep with arguments, pipe to fzf, and print the filename(s) selected
custom_grep () {
    grep -E --color=always --binary-files=without-match --recursive "$@"
}
remove_color () {
    sed -E 's/\x1b\[[0-9;]*[mK]//g'
}
custom_fzf () {
    fzf --ansi --height ~98%
}
grep_output=$(custom_grep "$@")
if [[ "$?" -ne 0 ]]; then
    exit 1
else
    echo "$grep_output" | custom_fzf | remove_color | cut -f 1 -d:
fi
#! /usr/bin/env bash

# ge: grep + fzf + editor
# basically a wrapper for 'grep <ARGS> | fzf | cut -f 1 -d: | $EDITOR'

# print usage on -h/--help
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
    echo "Usage: ge <grep-args>"
    echo
    echo "- Basically a wrapper for 'grep <ARGS> | fzf | cut -f 1 -d: | \$EDITOR'"
    echo "- Opens fzf with grep results, and edits the selected file(s)"
    echo "- Note: As this is meant to search files, it already adds the -r flag"
    echo "- Note: Internally, it uses the 'gf' command"
    echo
    echo "Example:"
    echo "  $ ge foobar"
    exit 0
fi

# takes output from 'gf' and opens it in $EDITOR
grep_fzf_output=$(gf "$@")
if [[ -n "$grep_fzf_output" ]]; then
  $EDITOR "$grep_fzf_output"
fi

Have a wonderful day, you CLI cowboys.

88
submitted 2 months ago by sebastiancarlos to c/linux@lemmy.ml
21
submitted 2 months ago by sebastiancarlos to c/linux@lemmy.ml
[-] sebastiancarlos 13 points 3 months ago* (last edited 3 months ago)

Tbh these scripts are for my personal use, written in the way that makes sense for me. I only open sourced it as a joke an as an example of how reinventing your own wheel is not that hard sometimes, and comes with the benefit of doing just what you need it to do.

Actually I was thinking of adding a sysget fallback, as I might need to do some debian/fedora hacking soon.

40
submitted 3 months ago by sebastiancarlos to c/linux@lemmy.ml
27
submitted 6 months ago by sebastiancarlos to c/linux@lemmy.ml
70
submitted 7 months ago by sebastiancarlos to c/linux@lemmy.ml
4
submitted 8 months ago by sebastiancarlos to c/linux@lemmy.ml
11
submitted 8 months ago by sebastiancarlos to c/programmerhumor@lemmy.ml
2
submitted 8 months ago by sebastiancarlos to c/linux@lemmy.ml
[-] sebastiancarlos 12 points 9 months ago

Just curious, what would be a correct translation?

[-] sebastiancarlos 65 points 9 months ago

The joke is that it's hard to tell if this is a joke because the lines between good intentions, corporate jargon, and feasibility have been blurred beyond recognition both here and in the real world.

It's also funny that after all these years, i18n is still a mess. Moreover, even if translations are standard in GUIs and documentation, for some reason, everyone is okay with defaulting to English for the oldest form of computer interaction.

Also, the joke is whatever you want it to be. Follow your dreams.

[-] sebastiancarlos 8 points 10 months ago
[-] sebastiancarlos 25 points 11 months ago

It's also traditional to eat raw meat, but we discovered fire at some point.

[-] sebastiancarlos 30 points 11 months ago* (last edited 11 months ago)

You also don’t need the dash for the short options.

True, but I refuse to entertain such a non-standard option format. It's already enough to tolerate find's.

[-] sebastiancarlos 14 points 11 months ago
[-] sebastiancarlos 15 points 11 months ago

it's surely one of the CSS lines of all time

[-] sebastiancarlos 37 points 11 months ago
[-] sebastiancarlos 9 points 1 year ago

I beg you pardon?

[-] sebastiancarlos 22 points 1 year ago

It's a parody of the hype around AI, particularly the "AI discovers faster sorting algorithm" news from last week. Full (satirical) source.

view more: next ›

sebastiancarlos

joined 1 year ago