Live data from Hacker News

Using ChatGPT to make Bash palatable

brev.dev

121–130 of 148 posts

Re: Using ChatGPT to make Bash palatable

#121

> But it fucking sucks. Like, it’s truly awful to write I feel like I'm the only person among my peers to think this and I don't understand why.

I think it’s fine with some changes like using iterm with zen/ohmyzsh, but bash is definitely a barrier to entry for a lot of could-be programmers.

Re: Using ChatGPT to make Bash palatable

#122

> But it fucking sucks. Like, it’s truly awful to write I feel like I'm the only person among my peers to think this and I don't understand why.

I had to try PowerShell for a project. It is soooo much better that bash. Passing typed objects instead of only text, Typed functions, and the ability to use C# types/functions inline !

Now we only need it to start up at least 100 times faster than it does currently, and be available out of the box absolutely everywhere.

I have no use for it for these reasons alone.

  $ hyperfine -N 'bash -c ""' 'dash -c ""' 'pwsh -c ""'
  Benchmark 1: bash -c ""
    Time (mean ± σ):       2.2 ms ±   0.1 ms    [User: 1.8 ms, System: 0.4 ms]
    Range (min … max):     2.1 ms …   2.6 ms    1214 runs

  Benchmark 2: dash -c ""
    Time (mean ± σ):       0.6 ms ±   0.0 ms    [User: 0.5 ms, System: 0.1 ms]
    Range (min … max):     0.5 ms …   0.8 ms    4623 runs

  Benchmark 3: pwsh -c ""
    Time (mean ± σ):     278.5 ms ±  10.8 ms    [User: 267.6 ms, System: 64.9 ms]
    Range (min … max):   263.8 ms … 297.0 ms    10 runs

  Summary
    'dash -c ""' ran
      3.80 ± 0.23 times faster than 'bash -c ""'
    470.61 ± 31.00 times faster than 'pwsh -c ""'

Re: Using ChatGPT to make Bash palatable

#123
post #119
post #82

Earlier quoted context omitted.

export YOU_FORGOT='this one' (Hint: it's most similar to your second one)

this has nothing to do with quoting also='another way to pass variables to child scopes' sh -c "echo $also"

Neither of those are passing variables, those are setting environment variables. Bash (probably most shells?) mixes its variables with environment variables, and "export" is how you promote a bash variable to an environment variable. The inline version (GGP's [THE=tell the] version) sets the environment variable only for that one executable, while an exported one persists.

Also I'm guessing you didn't test that, you got the quoting wrong (it prints nothing, the second one should be single quotes) ;)

Re: Using ChatGPT to make Bash palatable

#124
post #8

I don't understand how people can look at this and still claim that it's not doing any "actual reasoning".

Here's a brief reminder of how large language models like GPT-3 work.

First, you train until the cows come home on billions of tokens on the entire web. This is called "pre-training", even though it's basically all of the model's training (i.e. the setting of its parameters, a.k.a. weights).

The trained model is a big, huge table of tokens and their probabilities to occur in a certain position relative to other tokens in the table. It is, in other words, a probability distribution over token collocations in the training set.

Given this trained model, a user can then give a sequence as an input to the model. This input is called a "prompt".

Given the input prompt, the model can be searched (by an outside process that is not part of the model itself) for a token with maximal probability conditioned on the prompt [1]. Semi-formally, that means, given a sequence of tokens t₁, ..., tₙ, finding a token tₙ₊₁ such that the conditional probability of the token, given the sequence, i.e. P(tₙ₊₁|t₁, ..., tₙ), is maximised.

Once a token that maximises that conditional probability is found... the system searches for another token.

And another.

And another.

This process typically stops when the sampling generates an end-of-sequence token (which is a magic marker tautologically saying, essentially, "Here be the end of a ", and is not the same as an end-of-line, end-of-paragraph etc token; it depends on the tokenisation procedure used before training, to massage the training set into something trainable-on) [2].

Once the process stops, the sampling procedure spits out the sequence of tokens starting at tₙ₊₁.

Now, can you say where in all this is the "actual reasoning" you are concerned people are still claiming is not there?

____________

[1] This used to be called "sampling from the model's probability distribution". Nowadays it's called "Magick fairy dust learning with unicorn feelies" or something like that. I forget the exact term but you get the gist.

[2] Btw, this half-answers your question. Language models on their own can't even tell that a sentence is finished. What reasoning?

Re: Using ChatGPT to make Bash palatable

#125
I am very excited to see this being integrated with a lot of productivity tools -- removing the need for manually copy-pasting the ChatGPT output into various other apps like VS Code or Excel :)

"Create a new Python project folder named 'hello-openapi' and initate a git repo. Create a requirements.txt with openai, os and json. Create a starter python file with an openai example code and make the first commit."

Re: Using ChatGPT to make Bash palatable

#126

Just today I used ChatGPT to help me speed up writing somewhat trivial C Code for a project in an embedded systems class. Prompt: "Generate a tiny PID controller with only a Proportional factor written in C. That takes a rotational input from -360 to 360 degrees. The setpoint in degrees. And returns a motor speed in the range of -255 to 255." => Produced a compiling correct result. Later I wanted to know how to commu…

I've just re-created your "PID" controller, and was completely underwhelmed with the response. I just don't find it amazing that something using that much compute power can generate source code that multiplies an input by a constant.

If you can't write that quicker than the ChatGPT prompt you provided, then you probably should pay more attention to your class.

Re: Using ChatGPT to make Bash palatable

#127
post #110
post #84

Earlier quoted context omitted.

In the current state, everything the AI knows is stuff that people have written on the internet. It doesn’t seem to come up with new insights or judgements on its own. If people stop writing, AI won’t learn anything new (unless you turn it into AlphaZero for $DEVTOPIC). ChatGPT certainly saves time, but it becomes useless roughly at the same point where I would remain stuck after exhausting what Google Search turns u…

One avenue that chatGPT has, and I'm not sure if it is being utilized at all yet, would be the ability to feed it the unimaginably huge body of information locked behind copyrighted textbooks, books, academic papers and other pay walled information. Imagine the knowledge that could be accessed by feeding all that information into an ai engine like chat gpt. Presumably, it would not break copyright rules anymore than…

Why would copyright holders let that happen? Also, how is the model trainer getting access to all of this material?

Re: Using ChatGPT to make Bash palatable

#128
post #46

Earlier quoted context omitted.

It happened to me once, it generates a plausible answer when it doesn't know (tried to generate a Nix script with Erlang). But I have used it to generate examples code in Haskell, and it was quite good, probably because Haskell libraries have excellent online documentation. It's much faster than reading the doc of the library.

When it generates bullshit answers just call him out and it will try another way to do it. Tell it specifically what doesn't make sense and it will fix it.

That does assume you can quickly and easily tell when it's bullshitting, which it's not always easy to do. As a way of learning new stuff, I'd strongly disrecommend it (because "when you're learning" is precisely when you're least able to identify the bullshit), although perhaps it's not the worst thing in the world if you're already an expert.

Re: Using ChatGPT to make Bash palatable

#129

Can anyone recommend some more articles about this ? Specifically, using chatgpt to write code? The more in depth, the better.

This isn't an article, but I used ChatGPT to make a Hacker News extension (which I'm now using), that highlights new comments when I navigate to a thread I've already visited: https://github.com/HartS/gpt-hacker-news-extension Each commit here contains my prompt in the commit message, and the changed code was entirely provided by ChatGPT. I also appended its output (including explanations) verbatim to the gpt-output…

Wow man, this is amazing, thank you for responding!
Post reply on HN