Live data from Hacker News

I figured out how to get GitHub Copilot to run in the terminal

github.com

71–80 of 105 posts

Re: I figured out how to get GitHub Copilot to run in the terminal

#71

Earlier quoted context omitted.

Quoted post unavailable.

I was against copilot until I tried it. It’s not always on target, but it’s usually pretty close and the suggestions are good. No, it doesn’t write all of the code for me. But it does rapidly construct even quite complicated if/else statements that I was going to write anyways, just from knowing where I’m typing. Quite a great tool.

I was just revisiting an api call which it turns out needed pagination. I put a note in the docstring before I began and copilot just... rewrote the function to include pagination. Except for a couple of corrections to the json returned by the api (copilot could only guess), it just worked! I'm amazing by copilot and it frequently writes chunks of my code, especially shell scripts and docker files. A little worried that my job might be on the way out at some point!

Re: I figured out how to get GitHub Copilot to run in the terminal

#72
post #63
post #41

Earlier quoted context omitted.

But that is not how /dev/(u)random works and does not give U(255). Generally speaking, it gives some hash of some user/device activity, from these resources: https://linuxhint.com/dev_random_vs_dev_urandom/ https://en.wikipedia.org/wiki//dev/random

> does not give U(255) What do you think each byte from /dev/(u)random is?

[deleted]

Re: I figured out how to get GitHub Copilot to run in the terminal

#73

Earlier quoted context omitted.

It is absolutely amazing for writing boilerplate code that is also context aware. It saves me hours of typing. It's hard to explain if you've never tried it because you're ideologically opposed to it, but stop being close minded and try it out, I promise it's a great tool to assist your programming.

Good codebases don't need boilerplate to do basic stuff: in this sense, copilot is a patch over the real problem, which can be solved with better frameworks and more code reuse. I tried copilot during the beta, and apart from the obvious legal licensing issues, I simply could not find a valid usecase for any of the codebases I usually work with. At my day job, I spend more time thinking of better ways to do X, rather…

I disagree. Some amount of boilerplate is preferred versus abstracting everything. Boilerplate can be frustrating to write, and fiddly boilerplate absolutely should be abstracted, but in general it should makes the flow of logic easier to follow.

> At my day job, I spend more time thinking of better ways to do X, rather than writing boilerplate code :)

Not that you are suggesting otherwise, and I am being somewhat facetious, but oftentimes boilerplate is preferred to boiling the ocean.

Re: I figured out how to get GitHub Copilot to run in the terminal

#74
post #67

Does anyone here use Copilot with less mainstream languages? Curious to hear what your experiences are like...

I use it for Toit (toitlang.org).

It's not perfect, but still incredible useful (and sometimes scary; in a good way).

I particularly like it for writing tests, but it's useful in normal code too.

Re: I figured out how to get GitHub Copilot to run in the terminal

#75
post #41
post #38

Earlier quoted context omitted.

`cat /dev/urandom | od -N 1 -An -i` gives you a uniform random number between 0 and 255. The following mod 10 in the awk command introduces "modulo bias", which you can read about here https://research.kudelskisecurity.com/2020/07/28/the-definit... You can see it quite intuitively if you iterate over all possible numbers between 0 and 255: $ (for i in {0..255}; do; echo $i | awk '{print $1 % 10 + 1}'; done) | sort -n…

But that is not how /dev/(u)random works and does not give U(255). Generally speaking, it gives some hash of some user/device activity, from these resources: https://linuxhint.com/dev_random_vs_dev_urandom/ https://en.wikipedia.org/wiki//dev/random

Just to be clear, cryptographic hashes and other outputs of cryptographic primitives are designed to be uniform random. If you find a detectable bias from uniform on the outputs of /dev/urandom then you should consider the underlying primitive (the ChaCha20 stream cipher, in the case of modern Linux urandom) to be broken.

Re: I figured out how to get GitHub Copilot to run in the terminal

#76
post #44

It’s generally claimed that reading other people’s code is harder than writing your own. I mean, everybody loves writing code on a greenfield project but hates maintenance of legacy code, right? So, why do people like these code generators? The only explanation I can see is that people use them and then don’t read the code . Which would be horrifying. (I stay away for obvious copyright reasons.)

I've found myself needing some snippet of code that has a very targeted function, and whenever I see something online that's close enough, I sometimes paste that in my code and then make the necessary adjustments. This pattern is common enough (at least in my workflow) that if I could just start writing in the editor and it did a decent job figuring out what I was going for (in much the same way as my google query), and then let me dive straight into adjusting it, that's kinda nice.

Re: I figured out how to get GitHub Copilot to run in the terminal

#77

Earlier quoted context omitted.

It is absolutely amazing for writing boilerplate code that is also context aware. It saves me hours of typing. It's hard to explain if you've never tried it because you're ideologically opposed to it, but stop being close minded and try it out, I promise it's a great tool to assist your programming.

Good codebases don't need boilerplate to do basic stuff: in this sense, copilot is a patch over the real problem, which can be solved with better frameworks and more code reuse. I tried copilot during the beta, and apart from the obvious legal licensing issues, I simply could not find a valid usecase for any of the codebases I usually work with. At my day job, I spend more time thinking of better ways to do X, rather…

At your job the boilerplate was probably written already and you can avoid it.

Not all jobs are on mature projects.

I get tired of highly subjective anecdotes being used as concrete truths.

You are not the center of reality as we don’t know there is one. So good on you for having a job where the boring work was already in place. Look how far you have come on your own leveraging past effort. So proud of you.

Re: I figured out how to get GitHub Copilot to run in the terminal

#78
post #44

It’s generally claimed that reading other people’s code is harder than writing your own. I mean, everybody loves writing code on a greenfield project but hates maintenance of legacy code, right? So, why do people like these code generators? The only explanation I can see is that people use them and then don’t read the code . Which would be horrifying. (I stay away for obvious copyright reasons.)

I use them to quickly learn new languages or libraries. E.g., I’ve done only C++ for a few years and got rusty in other things. I used copilot to quickly learn how to create a Python Flask server, how to draw shapes on an HTML canvas with JavaScript, how to write common algorithms like “generate a random number in this range” without having to reach for pen and paper, etc. all without leaving my editor. It’s kind of like a much faster Google search for a StackOverflow result, and keeps you in the flow.

Disclosure: I work at Microsoft, opinion is my own.

Re: I figured out how to get GitHub Copilot to run in the terminal

#79
post #37

Earlier quoted context omitted.

Could someone explain how? I don't grok the command. My best guess is this relates to hexadecimal.

To add to this: (one of) the correct solution(s) is R * 10 / 256 + 1 EDIT: I am wrong, this still has bias.

Yeah, an easy solution to all these things is “find a uniformly random source that outputs in a range larger but close to what you want and then try again if it’s outside your range.

And indeed this is how Python does it

https://github.com/python/cpython/blob/e37ac5fbb6de593521cf2...

https://github.com/python/cpython/blob/e37ac5fbb6de593521cf2...

Re: I figured out how to get GitHub Copilot to run in the terminal

#80

Earlier quoted context omitted.

It is absolutely amazing for writing boilerplate code that is also context aware. It saves me hours of typing. It's hard to explain if you've never tried it because you're ideologically opposed to it, but stop being close minded and try it out, I promise it's a great tool to assist your programming.

Good codebases don't need boilerplate to do basic stuff: in this sense, copilot is a patch over the real problem, which can be solved with better frameworks and more code reuse. I tried copilot during the beta, and apart from the obvious legal licensing issues, I simply could not find a valid usecase for any of the codebases I usually work with. At my day job, I spend more time thinking of better ways to do X, rather…

This way lies hellish amounts of indirection.
Post reply on HN