Transcript #304: Build your own text adventure language in Python
Return to episode page view on github00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
00:05 This is episode 304, recorded October 5th, 2022. I'm Michael Kennedy.
00:11 I'm Brian Okken.
00:12 Hey, Brian.
00:14 Hey, you threw me for a wrench with the whole date thing.
00:18 I know. Well, in our notes it has yesterday, but then we had to move it.
00:22 Yeah, because of meetings.
00:23 Some of us have meetings.
00:24 Yeah, that's right. I've moved plenty for me. Plenty of moving.
00:27 Yeah, very cool. Well, great to be back with you. Also, we have a sponsor that sponsored before, but has been a while, a compiler from Red Hat.
00:34 Excellent show. Tell you more about that later.
00:36 For now, Brian, I'm kind of hungry. What can you do for me here?
00:40 I've got tasty ingredients for, let's see, add to stream. Tasty ingredients for a delicious pull request.
00:47 So it's October now. So that means Hacktoberfest for some people, right?
00:53 And actually, I didn't really want to just highlight Hacktoberfest. What I really like about this. So this is an article, 10 tasty ingredients for a delicious pull request.
01:03 It's on the Wagtail blog and from LB on the Wagtail core team member. So thanks, LB.
01:09 But this, it's kind of neat because there's, it's not, yeah, it's kind of clickbaity, but also it's just, it's actually nice information.
01:18 So whether you're starting open source project or starting, want to start helping out with an open source project, or I think these tips are great, or at least majority of them are great.
01:28 Even for people that are used to developing solo and are moving into developing with a team of people or a group of people.
01:37 And there's, I've had questions about that, even from companies of like, yeah, we want to kind of work better as a team.
01:43 How do we do that? So I'm going to run through these quickly. There's, there's 10 of them. First one is, is great. It's read the documentation or read the development instruction.
01:52 So a lot of projects have contributing guidelines. So actually read those and understand them when we're used to it. It's just a, Hey, fork it and go. But that's not trivial for some people.
02:04 So, right. Well, you may have a non-obvious details. Like for example, maybe you just fork the repo, you do your work there and you contribute, but well, you should obviously create a branch in your repo so that if they decide to not take it, then how do you stay in sync? Right. That's one of them.
02:21 Another one is, well, maybe when you do the PR, it doesn't go back to the main branch. It goes to some other like dev branch or something, right? Like you need to know, here's where you put the PR back to you. And just like those kinds of details for, Hey, we're a team.
02:33 Yeah. And then also there's details like, how do you run the tests and are there extra stuff that you have to install or any settings or for a lot of projects, it's just a, you know, do a virtual environment and clone it and go. But there's, there's, there's some that have like extra bits that you have to set up. So good to read the instructions, but then we're going into things like read the issues and comments. So if you want to help out, this is a great way is to read the issues, but don't just jump in and try to solve it right away.
03:02 Read the comments around the issue. Also PRs that are related to the issue. If there's any PRs linked, because there's somebody that might be started on a fix and you want to, you want to help either help them get unstuck or just help out. You don't want to just take over and say, Oh, I could solve this. If somebody else is working on it already.
03:21 But maybe you do. There's, there's different ways, but pay attention to that. So that's good. Create a French branch for your contribution. Like you mentioned it, it isn't always obvious because I'm already forking. What do we need a branch for? But it does help with the, the, the branch model. When it comes back in, it just looks better.
03:40 It's a, it's not necessary until your change is not accepted or you want to make two changes, right?
03:48 Yeah.
03:48 If you ever want to get back in sync with the main repo, you need to do somewhere else.
03:53 And it might be very much a possibility that you want to make several changes. You're really excited about a project and you're making several. And like you said, there, there might be a lot of discussion around some, and some of them are trivial things like fix and read me or something.
04:06 And so yeah, multiple do a branch so that you've got multiple names and that's where we come to the next tip for is keep the change focused.
04:16 So if a project would much rather have several focused pull requests, then a single pull request with like four different changes in it that are completely unrelated.
04:26 So keep them focused. And this is great for personal or, you know, closed source projects too. It just makes the code review easier. And when you, when you get in the habit of doing focused changes, it just, it's not harder. It's just a workflow you got to get used to.
04:44 Next is right unit tests. Definitely for the changes. But one of the comments that I loved in this is a bonus tip is it, there might be some either untested features in the project or under tested and adding tests around those features that you care about is a great way to contribute to, to a code base. So keep that in mind.
05:06 That's a really good point because people often think, well, what can I do to contribute? I'm not an expert. Well, if it's missing tests, that's, that's pretty easy.
05:14 And there could be even like, if you, so there's an idea of like testing is documentation and some tests work well like that. And some tests do not. So a great way also just, just to walk through, make tests around the, the, the onboarding documentation, like the getting starting guide, making sure that those features are tested is a good thing to throw in there.
05:34 Give your pull request name, request a name with context. So naming well is good. And don't be surprised if you're, if your pull request name gets changed by one of the, one of the core contributors. That's not, it's just so that everybody can track what's going on inside better. So just learn from that.
05:54 If mine is associated with an issue, I try to put the issue number as part of the branch.
06:00 Yes.
06:00 That I'm like, you know, it'd be like add such and such. If that add such and such is actually to fix, you know, issue 221, it'd be like the branch should be, you know, add such and such 221 or whatever for the branch name. Just so you're like, where the heck did this come from? Why is it here? Oh yeah, that's right. I can go find it.
06:16 Yep. And reference the issue being fixed or resolved in the pull request. So referencing the issue in a way that, and you kind of got to get used to this with GitHub or GitLab or other things.
06:28 They'll link to the thing. It links things up if you, if you name it correctly. So just play with that. And then some again, and then hopefully there's CI, CI going on and tests. So if your pull request has a break, has a break, the tests fail, address those. This is nothing more frustrating than a fairly decent pull request coming in, but the tests fail or the coverage fails or something.
06:53 And the person that issued the pull request doesn't deal with it. They just leave it for you. And that's, that's not cool. So yeah, I know address those. only a couple more push to the same branch with fixes and do not open a new pull request. So if the CI breaks, just push to the same branch again. it'll work. and then the lastly is be patient. I know that you've worked really hard on, on a change and you want to see it go into the main project right away, but these are volunteer projects mostly. So, it might take a while.
07:23 To, to, to review it and be comfortable with the changes. So.
07:26 Yeah. That's a bit of a balance. yeah.
07:29 It's frustrating when you work on a project, you work, try to enhance some project and then you put something out there and there's not even a response after, you know, like two weeks. You're like, well, yeah, I guess, I don't know. I, I don't know what to do with that, you know? but at the same time, it's absolutely volunteer. So there you go. All right. Let me tell you about something pretty cool for this next one, Brian. I learned about this from Rhett Turnbull. He and I had a chat over on Talk Python and built
07:53 building native Mac apps in Python. recall we talked about TechSniper and he built a Python only equivalent and we actually covered on the show a little bit, but during our conversation there, this is one of the recommendations he had for something really cool. So imagine somebody comes to you and says, Hey, Michael, I have a Raspberry Pi or Arduino thing in my lab.
08:15 And it controls, let's say this is a biology lab, right? It controls experiments and you can, you know, build up something with like a UI or whatever, but if people want to script it, wouldn't it be cool if there's a way to express in like, some form of syntax.
08:30 Here's how somebody who is just a biologist can make it go. It could just be like, fill pipette seven, you know, mix, mix pipette seven and 10, wait 10 minutes, you know, heat to such and such, right? You could, sure. You could come up with a programming language for them. You say, well, here's your language. You know, we're going to give you C++. Good luck.
08:50 You know, more ideally, maybe Python or oftentimes JavaScript, which feels like a real bad example or a choice because it's, it's kind of a complicated syntactical language, even though it's easy to execute, you know, it's like, it's easy to make a mistake and forget a semicolon or something weird.
09:05 Anyway, what if you could come up with the words that I used to like introduce this idea? You just have like lines like fill pipette seven, mix pipette seven and eight or whatever.
09:16 And so this thing I'm talking about here is called text X and text X is a Python library that allows you to build these kinds of grammars and map them Python implementations in a super easy way.
09:28 Wow. Okay.
09:29 So, so, let's see, it's a meta language for building domain specific languages, DSLs in Python. Basically it'll help you build a textual language in an easy way.
09:40 And you can invent your own language, as I said, or build support for an existing format.
09:44 So they have an example here. So they have this grammar and this is about, moving things around and basically drawing something in a language.
09:54 So you come up with a grammar, you'd say, there's a shape command, which is just line two or circle.
10:00 There's a move command, which is a move to or move by. And then you just have these words move.
10:05 And then two that runs the move to command. If the word, the line is move space by, that's the move by command.
10:13 And then you map to the additional information to these classes. So these are all Python classes, right?
10:18 So you just come up, this is what is this? 10 lines, eight lines. and then you create the class, which is a point and other pieces.
10:26 And you just say meta model from string, give it the grammar and the classes involved.
10:30 And then here's the new language we just created. Move space to five comma 10 line to 10 comma 10. How cool is that?
10:38 That's pretty interesting actually.
10:40 Yeah. You just create the model from there and then you can, you can just basically parse it for command in the model.
10:46 Start doing the things. If the commands move to or move by, right? It's already done the parsing. It has the command elements like the vector or the point already parsed and validated.
10:56 And it just executes Python.
10:58 Okay.
10:58 What do you think?
10:59 Well, so how do you use it? So do you call, like, do you, do you put all these commands in a, the, the, somebody that put all these move things in a file and then run?
11:07 Yeah, exactly. So you would, you would implement the code that defines the grammar.
11:11 You would implement the grammar classes. So like point and, and vector and those sorts of things. And then somebody would write the little, the grammar. So move space to five comma 10.
11:22 And then they'd probably have either a CLI or they save it in a file in some location and like you auto discover it or however it runs.
11:28 So basically from a, an external perspective, you now allow people to just program in this simple way. Like another way you could do it is like, you could write a, like a text adventure game, right?
11:39 You could like look around, look at, move, right. Move, move east, west, north, right. Attack creature run. Like you could really easily in Python build like a pretty interesting text adventure game based on this. I would imagine probably it already exists.
11:54 yeah, well, yeah. So the adventures around, so we could probably re-implement it with this. yeah, might be fine.
12:02 Yeah, I'd be fine.
12:03 But the, this, or like a complete, like burn way to burn up a summer. the, this, this looks cool though. There's a whole bunch of cases where DSL is appropriate, especially when you're interacting with non-programmer type people.
12:18 exactly. You want to give them some kind of text ability to interact with what you've created, but you don't want to force them to do full on super precise programming.
12:26 Yeah. Or maybe it is programmers and it's just easier to think about stuff in this manner. So neat.
12:32 Yeah. I just have a real high level way to talk about what you want.
12:35 Yeah.
12:35 Indeed. Cool. Anyway, so text X, people can check it out. Another thing that's pretty awesome. Compiler from Red Hat, our sponsor this week.
12:42 Yeah. Let me tell folks about that before we move on. So this episode, as I said, is sponsored by Compiler. Just like you, Brian and I are fans of podcasts, and I'm happy to share this new, highly respected one from an open source company. I'm sure you know, Compiler, an original red podcast from Red Hat.
12:59 And if you want to stay on top of tech without dedicating tons of time to it, Compiler presents perspectives, topics, and insights from the tech industry free of jargon and judgment.
13:08 They want to discover where technology is headed beyond the headlines and create a place for new IT professionals to learn, grow, and thrive.
13:15 Compiler helps people break through barriers and challenges, turning code into community at all levels of the enterprise.
13:20 One recent interesting episode is their The Great Stack Debate episode. I love, love, love talking to people about how they architect their code, the trade-offs and conventions they chose, and the costs, challenges, and smiles that result.
13:32 This one is like that, The Great Stack Debate episode. Check it out and see if software is more like an onion or more like lasagna, or maybe it's more complicated than food.
13:42 This is actually the first episode in Compiler's Software Stack series, and I think it'll be pretty interesting. So check that one out.
13:50 Learn more about Compiler at pythonbytes.fm/compiler. The link is in your podcast player show notes.
13:55 Yes, I know you can open up your podcast player and just search for Compiler, but please visit pythonbytes.fm/compiler and click on your podcast player's icon.
14:05 That way they know it came from us. Our thanks to Compiler for keeping our podcast going strong.
14:10 Nice. Yeah, very cool.
14:12 Yeah. All right. What's next, Brian?
14:14 Well, I want to talk about locks and semaphores and analogies and stuff.
14:20 Oh my gosh, I've been thinking about them so much lately, actually.
14:24 Have you?
14:24 Yes, I have. Tell me more.
14:26 Well, so this is a blog post by Guido Van Rossum.
14:30 He doesn't blog often, but there's usually some interesting bits when he wants to.
14:35 So this is a post called Reasoning About AsyncIO Semaphore.
14:40 So it starts off with a kind of a story about a restaurant.
14:45 So there's an analogy here about, okay, so you got a restaurant.
14:50 It's a fast food place, but it only has one table and there's a line waiting for it.
14:54 But you don't want to just wait in line.
14:56 So there's a way for you to get a buzzer.
14:59 So somebody hands you a buzzer and you go wait.
15:02 And when the table's open, your buzzer rings and you go get seated and you can eat.
15:07 This sort of analogy, he talks about this as a lock.
15:12 And then so with concurrent programming, so only one person getting it at a time.
15:17 But then if you've got multiple tables, things get a little more interesting.
15:22 So that's where semaphores come in.
15:24 And I love this mind shift of, and this is often difficult for people when they're doing asynchronous programming, to have this lock makes sense.
15:35 You're either a thread or some code is using a resource and it can and nobody else can.
15:41 But then you unlock it and somebody else can grab it.
15:46 But what if there's like three people can at a time?
15:49 Those are some of the different, some a little bit of a mind shift.
15:53 So I love this idea of a three table restaurant as a way to think about this analogy.
15:58 And so he goes through the analogy, but then talks about locks and semaphores.
16:04 And this is apparently to help himself even with the implementation of the semaphore in the new ACIO code.
16:11 So in making sure that things like work correctly and using an analogy to try to figure out how things are supposed to work and like an error.
16:23 So if you've got an exception happening, one of the problems can be it's like somebody gets, but they go, they're waiting and they decide they don't want to wait anymore.
16:33 So they go turn their buzzer in.
16:35 Well, what happens if while they're when they're just as they've decided to turn it in, but it's their turn and they get buzzed and they but they turned it in anyway and they don't want to run.
16:45 So they're never going to call the release code.
16:47 And so with the the common the interaction between cancel and release is difficult.
16:56 So there's there's there's all this stuff.
16:59 And it's so cool to think about this in terms of a restaurant because it's easy to visualize.
17:04 So any great article.
17:05 And then at the end, he actually links to the the the code that he was that he's finished writing.
17:11 So the links it to yeah, current code.
17:14 So that's pretty cool.
17:15 Right on.
17:15 Yeah.
17:16 Semaphores are I would say these are the things that many people don't really didn't really think to grab and use, but they're so incredibly useful.
17:25 Like so one example, like let's imagine your job is to go scan a bunch of URLs and ingest a bunch of data and you're going to run that like 8 a.m.
17:35 Every day or whatever.
17:36 If you've got 10,000 URLs, it would be way, way, way faster to use asyncio and HTTPX to kick off those requests.
17:44 But if you just say for URL in URLs, start a task, got 10,000 pending requests and all that data is coming back into memory and it's going to you're going to have a bad time.
17:53 Right.
17:53 Yeah.
17:54 So one thing you could do is you could create a semaphore and say, you know, I only want to allow 10, 20, 100 in-flight requests at a time.
18:01 And you just create a semaphore of 100 and you just pass it off to every task and they just have to start at the beginning and, you know, acquire it and release it.
18:08 Boom, you're done.
18:08 You've now created like I only I'm going through 10,000 with a straight for loop and I'm doing nothing more than 100 at a time guaranteed.
18:17 Yeah.
18:17 Beautiful.
18:18 Right.
18:18 That's a really good analogy.
18:19 I was trying to think of a good one where because I was actually even looking through the Python code of any cases where they use more than one.
18:28 Like a semaphore with one is just like a lock.
18:32 But if you can allow more than that, then it gets interesting.
18:36 Yeah, absolutely.
18:37 That's a cool thing.
18:38 You can think about similar.
18:38 Yeah, thanks.
18:39 You can think about similar things for like databases if it like really can't handle a ton of requests.
18:43 One thing I know that you point this out, I want to just give a quick shout out to any IO.
18:47 I interviewed Alex.
18:49 I believe it was Alex from there.
18:50 I've worked on it and it's got a really cool idea.
18:53 It's similar to the task groups and stuff that you talked about.
18:57 And it has this thing called a capacity limiter, which is much like a, it's very much like a semaphore, but a little more async native.
19:06 Because you can use it in a async context manager, like a width block, async width.
19:11 So here I could create just a capacity limiter of like my example is 100.
19:14 And you just say async width create a group for all the items, you know, tasks start soon, pass the limiter.
19:20 And all the tasks just do like async width this limiter, do whatever you're going to do.
19:24 And boom, now you only get, you know, N of them running at a time.
19:26 Super easy.
19:27 Very cool.
19:28 Cool.
19:28 Okay.
19:28 That's not actually what I wanted to cover though.
19:30 I want to talk about some annoying stuff that got slightly less annoying.
19:35 Security and preventing people from doing just bad stuff to your, your things online, right?
19:42 Web apps and mostly web apps, you know, think about a forum, people come in there, just like bots come in and start posting junk.
19:50 Like, I don't know why YouTube can't fix it, but I would say about one out of every three shows gets some sort of like disgusting.
19:56 Come see the, come see the ladies over here sort of post with clearly text.
20:01 That was like, why is this still allowed?
20:03 Right.
20:03 And, you know, if you run a website, you're going to run into those kinds of problems.
20:07 So like we had big problems at Talk Python training with a bunch of bots creating free accounts and they're just free.
20:14 You don't get anything by creating an account.
20:16 I don't know why they were doing it, but they, they were.
20:18 And so I, but they were doing it from hundreds or thousands of different IPs.
20:22 It was super annoying.
20:23 So we ended up having to put a recapture on there.
20:25 And every time I go to the site and I've got to sign in, I'm like, oh gosh, here come the crosswalks and the stoplights.
20:32 And that's not a bus.
20:33 There's no buses.
20:34 What do you want me to do?
20:34 You know, like how frustrating is this?
20:36 So Cloudflare, they're doing a bunch of interesting branching out of just being a CDN.
20:40 And they've announced this thing called TurnStyle, a user-friendly privacy preserving alternative to CAPTCHA or recapture.
20:48 Like recapture is owned by Google.
20:50 And like a lot of the stuff that you do there gets sent back over there.
20:53 And it's, it's not ideal.
20:54 So also finding all the crosswalks, not ideal.
20:58 So this thing is something they announced and it's free to use.
21:01 Even if you don't have some kind of other recapture thing, like you're not a customer, you just create an account for free, get an API key for this and use it.
21:10 So here, if you go to the page that I'm linking to, the blog.cloudflare.com, all that happens is you go there and it just spins for a second.
21:17 It does the work and the magic that Cloudflare is already using to verify that you're a human and you're a real machine.
21:24 And, you know, maybe do some sort of like cost.
21:26 Make you run like a tight loop for a second or whatever.
21:28 And then you're verified.
21:30 And if it doesn't work, then you can click a little button and verify you're human, hopefully.
21:33 But yeah, so this is pretty cool.
21:36 You can now replace your recapture with that.
21:39 And it's pretty straightforward.
21:41 Basically, you drop some JavaScript onto the page and a little widget.
21:45 And then you put the widget in your form.
21:46 If somebody submits it, it comes with that validation, like some sort of validation code that was created by Cloudflare.
21:53 On the server side, you want to verify that because its presence isn't enough because anybody could just send like garbage with the right form ID, right?
22:01 So there's a server side API.
22:04 You've got a call to validate that and make sure that, yeah, this is actually, it came from your domain.
22:09 It just was created.
22:10 It is a real one.
22:11 It's a unique one and all those things.
22:13 Oh, cool.
22:13 Yeah.
22:14 So anyway, if people want to use this, it seems pretty awesome.
22:17 Over on Talk Python, I switch the things over to it and we'll see how it goes.
22:21 So for example, if you want to get notified about our mailing list, now you've got to wait about three quarters of a second before typing in your email address.
22:30 Unless you're like some kind of beast and you can top it in, like select the form, type your email address and hit subscribe before like a second is up, right?
22:37 But that's pretty much it.
22:38 You hit submit and then it runs some magic on the server, right?
22:42 But I've been doing this live.
22:45 I'm going to check out PyPI.org.
22:46 If you check out turn style, there's a bunch of stuff up here.
22:49 There's like rate limiting things and other stuff, but nothing about Cloudflare.
22:53 So I created for the moment a GitHub gist that has the server side implementation for anybody who wants to do this in Python, modern Python anyway.
23:01 Nice.
23:02 Cool, right?
23:02 So over here, you just need this one file, this one module you can use here.
23:08 This one's synchronous, but you could just as well use HTTPX and async if you want to do this validation in like an async view.
23:16 So it has Pydantic models, like here's what you got to send over and here's what you'll expect to get back from the API endpoints, little examples.
23:24 And then just has one function called validate, given the thing they submitted in the form and their user IP, just so you have that as like part of your information of what happened.
23:33 They need to know that.
23:34 And that's it.
23:35 And it's kind of a cool example of seeing how to do like request response with Pydantic to APIs as well.
23:40 That's pretty cool.
23:41 Nice.
23:42 Awesome.
23:42 Well, that's a really good stuff.
23:45 So here's the thing.
23:46 Right now, it's not a package.
23:47 I'm not sure I need more open source projects to manage.
23:49 However, let's say if I was curious why you didn't make a package out of that.
23:53 Well, because I only did this like Monday, right?
23:56 So it's only I kind of wanted to stabilize a little.
23:58 If sufficiently many people shoot me a text on Twitter, like a at mention, M. Kennedy, says, hey, please make this a package so I can use it too, more directly, or we could all contribute.
24:08 Enough people do that.
24:09 I'll turn it into a package.
24:10 But I just haven't had the time because I've been playing with other stuff that I'll talk about in a minute.
24:13 You can only have so many projects, you know?
24:15 Yeah.
24:15 Yeah.
24:16 All right.
24:17 Well, that brings us to all of our main items, Brian.
24:20 Yeah.
24:20 So one of the things for extras, I wanted to pop up just briefly.
24:26 I was looking at a, so I was looking at, oh, let's go yours too.
24:32 Do you have any extras?
24:32 I do have some extras.
24:34 Sweet.
24:34 You go first, though.
24:35 I have a ton.
24:36 Okay.
24:36 So I just have a couple.
24:38 So this article says it's from testdriven.io, Heroku alternatives for Python-based applications.
24:46 And to be fair, it's pretty fair to Heroku also.
24:50 So really, it isn't don't use Heroku.
24:53 It is, it's kind of like, what are all the things you can use?
24:57 So it goes through Heroku, of course, but then it also goes through, does the pros and some description and pros and cons for DigitalOcean app platform and render and fly.io.
25:10 And even some that we don't hear too much about, like Engine Yard, Railway.app.
25:18 Railway looks pretty cool.
25:20 Yeah, Railway does look cool.
25:22 So really having one person compare, look at all of these and compare them.
25:26 It's just kind of a nice thing to just hear what somebody has to say about all these different platforms that you might want to try out.
25:32 So yeah.
25:33 Yeah, that's a ton of, that's a lot of reviews.
25:35 Yeah, it's pretty neat.
25:36 And, you know, these are all in the platform as a service equivalent, it looks like.
25:41 Yeah.
25:41 It's not like just, here's where you run VMs.
25:44 Like, well, okay, that's great.
25:45 But that's not what Heroku was helping me with.
25:47 Yeah.
25:47 And so that, and that's actually one of the fair comments.
25:50 It says, like, for instance, Heroku, one of the things that says is the price can go up as you, it's not too bad at the start, but it can go up as you grow.
25:58 And same with all of these really.
26:00 But the, and it's how many times more than running it just directly on AWS.
26:08 But it's a, be careful because that's not a, a platform as a service is not a comparison, fair comparison to just running it all yourself, because then you have to do it all yourself.
26:19 Exactly.
26:20 Kind of paying the service instead of paying somebody to monitor it for you.
26:23 So I think it's reasonable.
26:25 So the other thing I wanted to bring up was we brought it up last time and maybe the time before the pytest course is going well.
26:33 So I'm glad people are getting use, use out of the pytest course.
26:36 But I wanted, I've been kicking around the idea of doing a, a cohort based thing, something like the pytest course, not the exact same content, but similar sort of things.
26:46 Get people up to speed and do it as a cohort.
26:49 And I'd like people to get in touch with me if they think that's a good idea.
26:52 I'm thinking about maybe doing it in December, but I'm not sure, December or January.
26:56 So hit me up on Twitter or you can get to the, my contact form on test and code as well.
27:02 It'll get to me.
27:03 So yeah, let me know.
27:04 Those live events are really nice, right?
27:06 It's, it's, it's a cool experience.
27:07 So hopefully that, that goes off.
27:09 Yeah.
27:10 That'd be neat.
27:10 Indeed.
27:11 All right.
27:12 Would you believe that just last night I was writing some C code?
27:15 No.
27:16 I typically do.
27:17 I'm like, come on, another semi-colon.
27:19 I forgot.
27:19 Are you kidding me?
27:20 Been a while.
27:21 But I actually did a pretty good job without pulling up any references or anything.
27:24 So more on that later, but I just want to give a quick shout out to this project called CPP Front from Herb Sutter.
27:31 It's an experimental compiler for an alternative syntax to C++.
27:36 That would make the language 10 times simpler, safer, and more coolable.
27:40 I think it basically is, as the name would say, like CPP Front is like a slightly different language that compiles to C++.
27:47 So it has an interoperability and whatnot.
27:50 People do a lot of C++, like, you know, for low-level integration with Python and things might find this interesting.
27:56 So you can jump over to the GitHub repo, and they have got some examples in here.
28:00 Let me see if I can find it.
28:01 I think you've got to maybe go check out the tests or something like that.
28:05 They don't have great documentation.
28:08 CP2.
28:09 It's just text.
28:11 Show it to me.
28:12 Oh, wait.
28:12 No, it's not.
28:12 It's 4 megs, but it's okay.
28:14 Anyway, it's got some pretty funky syntax, but it also looks pretty fun.
28:21 People can check that out.
28:22 So if that's interesting, then go for it.
28:24 I don't know where I saw the cool examples or something, but, well, they had some in here.
28:29 What's different about this?
28:31 Yeah, I find them.
28:32 Oh, well.
28:33 You can look through the notes here.
28:34 The language, it hardly looks like C++, but it still has the same kind of thing.
28:39 What do you think about this, Brian?
28:40 You do some C.
28:41 I don't, well, I've been doing it for so long that I don't know if it's that hard to do C++.
28:47 I mean, it's hard to get it right, but there's, I don't know, we have a lot of help now with
28:53 the modern compilers and linters and everything.
28:57 But I always think it's a neat idea if it's really easier.
29:03 That little snippet you showed me didn't look easier, but we'll see.
29:06 Here's an example.
29:08 If you check out this little graphic on the readme called, it says cathello.cpp2.
29:13 Okay.
29:13 It looks a little bit like Python type hints, doesn't it?
29:16 Like the way you specify the return value and stuff.
29:18 Yeah.
29:19 Yeah.
29:19 Anyway, could be fun.
29:21 We'll see if it goes anywhere.
29:22 All right.
29:22 A few other things.
29:23 TypeScript is definitely something that's going somewhere.
29:27 Matt Kramer pointed out that Jeff Glass has been doing a bunch of things with iScript lately.
29:33 So I want to highlight one thing and then I'm going to dive into it more next week.
29:38 I just want to put this on people's radar.
29:40 So PiScript September edition is out with lots of changes on it.
29:46 So probably the easiest way to see that is to click on this blog post they got down there.
29:51 So if you've been doing any PiScript, you kind of want to know about this because it's like super breaking changes.
29:56 So for example, you used to have to say, use this thing Pi ENV for configuring like what libraries you would use and how you execute it.
30:05 That thing's gone.
30:06 Now you've got like a package section of a Pi config and a path section for files.
30:10 A bunch of other things, better logging, multiple runtimes, upgraded Pyodide and whatnot.
30:18 But check that out if you're doing PiScript.
30:20 Nice.
30:21 And they're not even Xerover yet.
30:23 Yeah.
30:23 Well.
30:24 They're Calver.
30:25 We're going to need some kind of like new calendar event or something.
30:29 Yeah.
30:30 Because they're Calver.
30:31 Yeah.
30:31 Cool.
30:32 All right.
30:32 Follow up.
30:33 I talked about NextDNS last time.
30:36 That's like basically like for people to do PiHoles.
30:38 It's like PiHole, but it's on the internet.
30:40 You don't have to manage it.
30:41 I said I didn't really try it out that much last time.
30:45 So I went in and I did an interesting experiment on the family, including myself.
30:49 I went to the router and I just changed it to use this blocking, ad blocking, malware blocking DNS as like for all the network.
30:57 Which is good because like my TV can no longer do bad things that it was doing.
31:02 You know, my kid gets ad blocking without knowing it.
31:06 Even visitors, I suppose.
31:07 Right.
31:07 And I was like, all right, well, let's see what breaks.
31:10 Who goes, Michael, I can't do this anymore.
31:12 Like nothing broke, which is great.
31:13 So I'm super psyched about that.
31:16 And if you create it, actually you can create a free, what I've learned is you get a free account for up to 300,000 DNS for queries a month.
31:25 And what happens after that is it just falls back to like standard DNS with no blocking, which is pretty awesome.
31:30 And there's like $2.
31:31 Yeah.
31:31 There's not an ad for them.
31:32 It's just, I think it's pretty awesome.
31:33 So I went and ran, I went to adblock-tester.com.
31:39 Okay.
31:39 With Vivaldi with its max blocking, no plugins, no extensions for ad blocking, just the built-in one because I don't want to install more extensions.
31:48 But with that turned on and the next DNS, private DNS, I get 96 out of 100 on ad block tester.
31:56 With Brave, I got 100 out of 100, which is pretty awesome.
31:58 But even if I turn all the blocking off on Vivaldi, I still get 80 out of 100 just using that DNS.
32:05 That's pretty awesome, right?
32:06 It's like 80% everything is just killed before it ever gets through the network.
32:10 Oh, I was curious what the number was.
32:12 So it's not 80 get through.
32:14 It's 80 get blocked.
32:15 It's 80 blocked.
32:17 So you can actually scroll through.
32:18 It'll show you like the wild cat Giphy wasn't blocked.
32:22 The static image wasn't blocked, basically.
32:24 But, you know, pretty much everything else was blocked.
32:28 So, yeah, pretty awesome.
32:30 Yeah.
32:30 Yeah.
32:30 And last thing here, one of the things you got to do to make this work, this is like a new extra, but it is like one flows into another.
32:37 One of the things you got to do to make this work is if your IP address changes and you have a crap router,
32:43 I have like an insanely good router that has crap configuration.
32:46 Let's put it that way.
32:47 Where I can't do IP over, sorry, DNS over HTTPS or set up any details.
32:54 I can just say, here's the four numbers for the DNS server.
32:58 Yeah.
32:58 Right.
32:58 Just the IP address.
33:00 Well, if that's the way you do it and you have some account that does blocking, you've got to go into your DNS account and associate your IP address with your account by just like clicking a button or calling an API endpoint.
33:13 But what do you do when your IP address changes?
33:15 How do you remember?
33:16 Like all your ad blocking stops every time, you know, maybe the power goes out and you've got to like your things come back on and they get a new IP address.
33:22 So I was like, well, what could I do?
33:24 I've always wanted to have like a little circuit Python project that would be fun.
33:28 So originally I wanted to get a Raspberry Pi.
33:30 Those are unattainable.
33:31 It turns out.
33:32 Have you tried to get a Raspberry Pi, Brian?
33:33 Not recently, years ago.
33:35 But yeah, I think they're like 35, 40 bucks for a new nice one, but they're all sold out.
33:40 And you can find them on Amazon for like $200.
33:43 People have bought them up and then are scalping them back to you on Amazon, which is super frustrating.
33:47 Lame.
33:48 You can find them for about $100 on eBay, right?
33:52 Anyway, they're hard to get.
33:53 And then if you get them, they're way marked up and it's kind of frustrating.
33:57 Well, what else could I use?
33:58 So check this thing out.
33:59 See, I got on the screen here.
34:00 This Adafruit ESP32-S2 feather is a full-blown circuit Python in Arduino, basically, for $17.50.
34:11 And it's in stock.
34:13 Nice.
34:13 So I got that yesterday.
34:15 And just to give you a sense of how small it is, like if you put it in your hand, it's probably two-thirds the size of your hand.
34:21 And it's a full 240 megahertz computer, four megs of RAM, Wi-Fi, Bluetooth, temperature.
34:29 But the most important thing is Wi-Fi, make no doubt.
34:32 And I see Paul Cutler out there.
34:34 Yes, thank you, Paul.
34:34 I was actually thinking of you last night when I was working on this.
34:37 It took a bit of time to set up and it was a little bit painful, like getting it configured
34:40 from originally it was Arduino, which is C.
34:43 So I was writing.
34:44 I tried to do all this stuff in C, which basically tried to like hold that endpoint and pull out my IP address.
34:49 And everything seemed fine except for nothing I could find supports HTTPS in C.
34:54 All the REST frameworks only supported HTTP unencrypted.
34:59 I'm like, what endpoint is unencrypted these days?
35:01 What is this madness?
35:02 Give me some requests.
35:03 So I got CircuitPython going on it.
35:05 And now it's happily sitting over there in the corner, sending me a little rake reports through like sort of like Morse code through its LED.
35:12 And then, yeah, it's beautiful.
35:13 I just plug it into the power and it just goes constantly, checks my IP address, updates that DNS setting periodically with an API.
35:20 Okay.
35:21 So it's monitoring.
35:22 And if your IP address changes, it uploads it?
35:25 Yeah.
35:26 Basically, it just has to call the API from the network and that'll like go, well, wherever you're coming from, that's where we're going to treat you as being from.
35:33 Okay.
35:34 Nice.
35:34 Yeah.
35:35 You might say, well, why don't you just run that Python code on your computer?
35:37 My computer is running a VPN, which is not the right IP address.
35:41 All my devices, I can't run it on.
35:44 I don't want to run a whole computer for it.
35:46 So like this thing is incredibly small and cheap and it was just a fun project.
35:50 Nice use of that.
35:52 Cool.
35:52 Yeah.
35:52 Yeah.
35:53 So that was a lot of fun.
35:54 A lot of learning, a lot of differences with CircuitPython.
35:57 Like similar, but then wait, why doesn't that work?
36:00 Like, oh, I want to find out, you know, the relative path is, oh, there's no pathlib.
36:03 Sorry.
36:04 Oh, well, let me try again.
36:05 Let me find some other way to answer that question.
36:07 Oh, yeah.
36:07 It was still fun.
36:08 Yep.
36:08 All right.
36:09 Well, those are all my items.
36:10 I know I had a bunch of extras, but there they are.
36:12 That's all right.
36:12 Well, do we have a joke?
36:14 Oh, you know that we do.
36:15 So following on, like one of the things I had last night, I was like, God, why, why can I
36:20 get CircuitPython installed in this?
36:21 And it was, when it came out of the box from Adafruit, maybe I'm missing something, but it
36:26 didn't show up as a drive.
36:28 It only could be communicated with over the serial port, right?
36:32 And the way that you normally install CircuitPython is you drag this bootloader just over the drive
36:37 and it just restarts and off it goes.
36:39 I'm like, well, how do I get this on?
36:41 It just wouldn't work.
36:42 Wouldn't work.
36:42 And I'm like, I'm trying all these things.
36:44 And eventually I figured there's like a sequence of little clicks I got to do on like some of
36:48 the buttons to like put it into a mode.
36:50 Then I could do it.
36:50 I could have used some help.
36:52 Okay.
36:52 So this woman, Annie here, she's got it figured out.
36:56 If I just went on to Stack Overflow or to Reddit or whatever and post that, people are
37:00 just going to ignore it, right?
37:01 They're going to, yeah, whatever.
37:02 Newbie, he doesn't know what he's doing.
37:03 Just go away.
37:04 However, Annie has another idea.
37:06 She says, every time I have a programming question and I really need help, I post it on Reddit and
37:11 then I log in with another account to reply to it with an obscenely incorrect answer.
37:15 People don't care about helping each other, but they love correcting others.
37:19 This works 100% of the time.
37:21 That's pretty funny.
37:23 Yeah.
37:24 I bet it works too.
37:25 Yeah.
37:26 Right.
37:27 If you went in there, like what you need to do is just type dash R, you know, RM dash RF
37:31 on forward slash.
37:32 No, no, no, don't do that.
37:34 Yeah.
37:35 It's a take on a different take on it.
37:37 So I used to do the similar thing of just a post, post a blog post with the wrong answer
37:43 and, and have, or a bad tutorial and leave comments on and, and then let people tell me what,
37:51 how much of an idiot I am and then delete that and write the real post.
37:53 Thank you.
37:54 I incorporated your changes.
37:56 I really appreciate it.
37:57 I tried to give people credit, of course, but.
38:00 Of course.
38:00 Of course.
38:01 Awesome.
38:02 Well, here's a tip.
38:03 If people need help and you just got to have that secondary Reddit account to get in there
38:07 and stir the pot.
38:08 Or a friend.
38:09 So ask.
38:10 Or a friend.
38:11 That's right.
38:11 Hey, could you just come answer this really like with this bad answer?
38:14 Yeah.
38:14 A good idea.
38:16 That's nice.
38:17 All right.
38:18 Well, thanks again for a wonderful episode.
38:20 You bet.
38:20 Lots of fun.
38:21 Thanks for being here.
38:22 See you later, everyone.
38:23 Bye.