Fork me on GitHub
#off-topic
<
2022-08-16
>
Nedeljko Radovanovic01:08:58

Hi people, Does someone maybe use Clojure Extras plugin in IntelliJ and if so, how are you doing inline evaluation, mine doesn't work..

brcosta01:08:27

Hi, could you share more details? Do you get an error?

brcosta01:08:39

I ask because the plugin doesn't add keymaps by default, you have to setup your own, based on the options in the tools menu

Nedeljko Radovanovic10:08:57

Hey No error is showing, I just dont know how to evaluate inline, it always evaluates inside repl Is there a different command for it? @UQTHDKJ8J

Nedeljko Radovanovic10:08:22

I don't know how to set it up 😅

respatialized13:08:45

a botched upgrade to Ubuntu 2022.04 that left my networking capabilities in ruins has me thinking:

😂 3
respatialized13:08:09

the amount of absurd lore you have to know to figure out where the "canonical" location of a symlinked .conf file is depending on the version of your OS and the services you have enabled is the epitome of place-oriented programming

Noah Bogart13:08:51

i ran into similar issues earlier this year trying to upgrade to pop os 22.04

😢 1
respatialized14:08:37

my comfort in knowing it's not just me is outweighed by the sorrow in knowing that others have suffered the same fate

😂 2
vonadz14:08:45

My upgrade from 18.04 to 22.04 a month ago went off without a hitch 🙂 Don't know if that helps or rubs salt into the wound.

vonadz14:08:56

On two different servers too.

respatialized14:08:02

@UEENNMX0T out of curiosity, was it systemd related? I'm wondering if I'm being affected by https://github.com/systemd/systemd/issues/13432, as I seem to be observing similar logs to those described there.

Noah Bogart15:08:15

i had an issue with some graphical driver where two or three times a day, my display would lock up and would be unrecoverable

Noah Bogart15:08:43

had to dig into the bowels of some config file to change something or other to work with my monitor, as it's a 4k monitor

William LaFrance16:08:12

> the amount of absurd lore you have to know to figure out where the “canonical” location of a symlinked .conf file … is the reason why, in 2018, after using Ubuntu since the Warty Warthog, I finally said goodbye to that god-forsaken distro and switched to Arch. In the good old days, every 6 months a dist-upgrade would break my X11. Every time. And I’d have to go find another computer (my “cell phone” didn’t have full internet yet) and get on IRC for “how fix X this time”. I finally ignored everyone who said Arch was only for wizards. Everything is where it should be (where the package vendor intended) on Arch, and the wiki is phenomenal.

andy.fingerhut17:08:40

Or, perhaps, William, this is evidence that you are now a wizard 🙂

William LaFrance17:08:55

Well you know what they say, sufficiently advanced manpage reading is indistinguishable.

😂 3
mjw17:08:37

Pretty much every release I’ve been a part of in the last three years has been problematic due to invalid configuration options we had no way of verifying until we were in production.

vonadz17:08:45

Arch is great. Was my first experience with Linux and I haven't found anything better yet.

didibus17:08:11

I'm a fan of openSuse. Tumbleweed rolling release, never had a single update cause me issues.

Cora (she/her)19:08:26

can confirm that @U03JPRPTSTX is a wizard

Cora (she/her)19:08:55

he even has the hat

William LaFrance19:08:30

Secret’s out.

wizard 6
👀 3
Drew Verlee02:08:59

i'm kinda thinking about arch and/or nix. Im leaning towards Arch. Though, i really feel like there is no way to know without investing a metric shit loads of time and i'm worried in the end ill just have grey hair and different set of issues then i have on ubuntu.

Cora (she/her)03:08:27

you could try manjaro?

Drew Verlee03:08:50

Thanks, yeah. Manjaro is more my speed then arch given what i recall.

William LaFrance15:08:42

woah thanks, i hadn’t seen that before. i’ve only used manjaro on a media laptop for hooking to a projector, never for a serious install, so i didn’t run into any of those issues, but now that i’m aware of them i’m a little more reserved to recommend it over straight arch.

vonadz15:08:18

No problem. I think people overestimate how hard it is to run Arch (unless you don't have a second device that can connect to the internet).

💯 1
Cora (she/her)15:08:26

ooooh arch has an installer now

lilactown23:08:54

Bash question: I want to write a script that accepts input via STDIN, and routes that both to fzf and to the preview command of fzf

lilactown23:08:16

pseudocode:

stdin | fzf --preview "$stdin | other-command --query {q}"

lilactown23:08:38

I've tried to do this by writing to a temporary file, but I'm struggling even with that

Max23:08:39

If what you're taking from stdin is bounded (ie non-infinite) you can usually store it in a variable and just use it where you need it

tomd23:08:02

Have you tried tee ?

souenzzo00:08:21

#!/usr/bin/env sh

TEMP="$(mktemp)"

tee "$TEMP" | fzf --search "[email protected]";

other-command < "$TEMP"

Cora (she/her)03:08:12

can you use a fifo?

Cora (she/her)03:08:11

mkfifo, I mean. you could tee to a fifo and stdout, then in the preview command read from the fifo

Cora (she/her)03:08:03

#!/usr/bin/env bash

set -eux

FIFO_DIR="$(mktemp -d)"
FIFO="$FIFO_DIR/myfifo"
mkfifo "$FIFO"

clean_up() {
  # I don't want rm -r "$FIFO_DIR" because I'm paranoid
  rm "$FIFO"
  rmdir "$FIFO_DIR"
}

trap clean_up EXIT

tee -a "$FIFO" | fzf --preview "cat \"$FIFO\" | other-command --query {q}"

teodorlu06:08:57

You could also read stdin to a string and pass that string to both places you need it. https://dev.to/jeremyckahn/til-reading-stdin-to-a-bash-variable-1kln

adi10:08:52

@U4YGF4NGM sounds like tee is your friend in this case. > a script that accepts input via STDIN, and routes that both to fzf and to the preview command of fzf This translates directly to:

do_the_fzf_thing() {
    tee >(fzf > /tmp/file) | 
    tee >(fzf --preview > /tmp/file2) |
    # maybe more processing?
    other-command
}

echo "input for les fzfs" | do_the_fzf_thing
tee is great, because one can do things like this pipeline that https://www.evalapply.org/posts/shell-aint-a-bad-place-to-fp-part-1-doug-mcilroys-pipeline/#compose-again-semantics-functions-play-grand-new-pipeline:
# I assume you have Bash version 4+.
man bash |
    # pre-process
    flatten_paragraphs |
    tokenise_lowercase |
    drop_stopwords |
    # cache raw pre-processed data, if we need to re-analyse later
    tee /tmp/bash_manpage_raw_tokens.txt |
    # cache various views or compressions of the raw data
    tee >(sort_dictionary | uniq > /tmp/bash_manpage_sorted_as_dictionary.txt) |
    tee >(sort_rhyme | uniq > /tmp/bash_manpage_sorted_as_rhyme.txt) |
    # accumulate various analyses of the OG raw data
    tee >(frequencies > /tmp/bash_manpage_token_freqs.txt) |
    tee >(bigram | frequencies > /tmp/bash_manpage_bigram_freqs.txt) |
    tee >(trigram | frequencies > /tmp/bash_manpage_trigram_freqs.txt) |
    take_n

👀 1
adi10:08:45

And as Cora pointed out, named pipes may help too. The guts of the trigram function that features in the pipeline above, illustrates (maybe too clever and tricksy) but interesting use of named pipes...

trigram() {
     # we need intermediate state, but we can make it stream,
     # instead of accumulating in temp files

     mkfifo trigram_buffer_one trigram_buffer_two

      tee >(tail +2 > trigram_buffer_one) |
         tee >(tail +3 > trigram_buffer_two) |
         paste - trigram_buffer_one trigram_buffer_two |
         # take all but the last 2 entries as they are not trigrams
         butlast_n 2

      rm trigram_buffer_one trigram_buffer_two
}

👀 1
adi07:08:00

@U4YGF4NGM curious: how did you solve it? 🤓

1
lilactown15:08:41

using a temporary file

#!/usr/bin/env bash

tmpf=$(mktemp)

# pipe STDIN to temporary file
exec 3>"$tmpf"
cat >&3

./eql --keys < tmpf | # use temporary file as input to generate suggestions
fzf --print-query --preview "cat $tmpf | ./eql --query {q}" # pipe temporary file as input to the preview to query on

👍 1
adi10:08:23

Ah ok, I completely misunderstood your original question. I think one can eliminate the temp file (and the associated redirect of STDIN), this way:

./eql --keys | # assuming eql accepts its input from STDIN
    while read -r suggestion; do fzf --print-query --preview "$(./eql --query \{${suggestion}\})"; done