Earlier quoted context omitted.
Why? Wiki doesn't say anything about it and when I run it, the result looks fine > $ for((i=1;i > rand.txt ; done > $ cat rand.txt | sort | uniq -c 1051 1 932 10 1012 2 1042 3 983 4 1015 5 1042 6 1035 7 992 8 995 9
`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…
I figured out how to get GitHub Copilot to run in the terminal
41–50 of 105 posts
Re: I figured out how to get GitHub Copilot to run in the terminal
#42Earlier 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
Re: I figured out how to get GitHub Copilot to run in the terminal
#43By the way, the example snippet given to "echo a random number between 1 and 10" is incorrect, pedantically speaking. It's random, but not uniformly so. It's biased towards lower numbers (1-6).
Could someone explain how? I don't grok the command. My best guess is this relates to hexadecimal.
Re: I figured out how to get GitHub Copilot to run in the terminal
#44(I stay away for obvious copyright reasons.)
Re: I figured out how to get GitHub Copilot to run in the terminal
#45By the way, the example snippet given to "echo a random number between 1 and 10" is incorrect, pedantically speaking. It's random, but not uniformly so. It's biased towards lower numbers (1-6).
Why? Wiki doesn't say anything about it and when I run it, the result looks fine > $ for((i=1;i > rand.txt ; done > $ cat rand.txt | sort | uniq -c 1051 1 932 10 1012 2 1042 3 983 4 1015 5 1042 6 1035 7 992 8 995 9
Re: I figured out how to get GitHub Copilot to run in the terminal
#46This is really cool! Here's an example of using emacs to do it. Uses tabnine for real time completion, and Copilot/Codex for more advance completions. https://semiosis.github.io/posts/nlsh-plus-tabnine-real-time... It uses NLSH and Cterm. https://semiosis.github.io/nlsh/ https://semiosis.github.io/cterm/
https://mullikine.github.io/posts/ai-terminals/
Also, there is ii, the fully imaginary interpreter
Re: I figured out how to get GitHub Copilot to run in the terminal
#47It’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.)
To cover the lack of good libraries and/or language abstractions.
Re: I figured out how to get GitHub Copilot to run in the terminal
#48It’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.)
But afaik almost everybody uses it as autocomplete on steroids.
So the reasoning behind using it is the exact same as using autocomplete in I.e. Intellij.
It's just slightly more powerful, since it will usually autocomplete the whole line (occasionally a bit more), instead of just the current keyword.
Re: I figured out how to get GitHub Copilot to run in the terminal
#49By the way, the example snippet given to "echo a random number between 1 and 10" is incorrect, pedantically speaking. It's random, but not uniformly so. It's biased towards lower numbers (1-6).
Could someone explain how? I don't grok the command. My best guess is this relates to hexadecimal.
R % 10 + 1
The problem is that 10 does not evenly divide 256, hence for large R, the mapping will be incomplete. Specifically, 250 => 1
251 => 2
252 => 3
253 => 4
254 => 5
255 => 6
with no more random numbers available to yield results 7, 8, 9 and 10.Re: I figured out how to get GitHub Copilot to run in the terminal
#50It’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.)