So you guys may have heard of GitHub copilot. It's
an AI pair programmer that can suggest code and entire
functions in real time. Copilot can also help with comments
and documentation by interpreting what your code is doing. So
here's a random script I wrote in college for machine
learning course. I didn't document it very well because I
was probably rushing trying to submit it by 11:59 PM,
but that's no problem because copilot can help me figure
out what's going on here. This script loads the images
and labels from the training set and creates a TF
record file OK.
And the TF record file contains a serialized example for
each image in the training set.
OK, what is the TF record file? So a TTF
record file?
Is a serialized version of the data set. OK, sweet.
So from this description it's starting to come back to
me. I can gather that we were attempting to read
in some images and labels and serializing them by converting
them to TF records so that they can be read
by Tensorflow while training our machine learning model.
Thanks copilot.
I can never remember how to get the item from
the rack. Now that's not what we want here, but
if we give it a little bit more information like
this, Oh yeah, it's on the body. Whenever I'm working
in react I tend to forget things like how do
I add an inline style to like an H1 tag.
But what you can do is just add a comment
with the control slash here and just say an H1
with inline style. You don't even have to spell it.
Right. And there you go.
And it's super helpful in CSS. I can never remember
how to highlight a list item when a user mouse
is over it, but copilot knows or things like I
can never remember how to get rid of the bullets.
In the list, and again, you don't have to spell
this correctly. Copilot knows and finally the thing that nobody
can remember.
GitHub copilot is really good at doing stuff you probably
don't want to do, like writing regex. Say we want
to match all capital letters in a string. We don't
even have to spell that correctly and it can generate.
You might not trust that this is correct. So to
test this you can use the regex previewer extension and
when you enable that, you get this new test regex
button. And if you click that button, a window will
open up and you can test and see that yes,
it does match all the capital letters as we request
it. And best of all, if you're working along in
a project and you come across some.
Crazy regex and you're like, what does this even do?
Uh, you can ask copilots. You can say what patterns
does this regex match, and then it will tell us
it matches all of these patterns. It will actually enumerate
these as we go down and you can see all
of the different this is a date regex clearly, and
it matches all of these different patterns and it will
just keep on going here and verify this. We can
go ahead and run our test regex and see that
you get a copilot is correct.
You may be aware that GitHub copilot can write code
for you, but did you know that copilot is based
on the Codex AI, which is a descendant of the
GPT 3 AI, which is conversational? So you can actually
ask copilot questions if you put it in the right
format. Use a queue so that copied knows it's a
question and you can ask it pretty much anything does
the developer. You can exploit this to your advantage. For
instance, let's say you start a merge. You want to
cancel a merge, but you don't remember how. Just ask
copilot. It will spit out the command for you.
To abort this merge.
And it knows a lot about Git, so we can
ask it all sorts of things, like for instance, how
do I list out my git remotes?
Or something else. I forget a lot, which is how
do I undo an ad when I've already added files?
I want to undo that. It's a reset, that's right.
And then finally, even things you think it wouldn't know,
like how do I remove files that have added to
the gitignore but there's still in my repository? Boom, there
you go.
So if you're familiar with GitHub copilot, you know that
people use it to assist with writing code, but that
you know it could help you with your relationships too.
Alright, so I can come over here and type in
create function. How to nicely break up with girlfriend gives
me a function. I'm sorry, but I don't think we
should see each other anymore. Now let's say I changed
my mind and I wanted to create a function to
apologize.
I hit tab and it gives me a function to
apologize.
I'm sorry, I was wrong. Please forgive me. That's pretty
good.
Next I want to create a functions to get back
together with girlfriend.
I love you. Let's get back together. For more tips
and tricks, make sure to subscribe.