Skip to main content
738

March 4th, 2024 × #automation#ai#productivity

Little Scripts: Coding for your Co-workers

Discussion on writing small scripts to help coworkers and improve workflows using tools like FFmpeg, AI, and automation

or
Topic 0 00:00

Transcript

Scott Tolinski

Welcome to Syntax. In this Monday, hasty treat, we're gonna be talking about using our coding powers for fun. In our own little scripts, coding for your coworkers, the types of things that you can take your abilities to simplify other people's lives or processes or whatever just because you have the superpower of writing code. My name is Scott Tolinski. I'm a developer from Denver, and with me JS always is Wes. Bob. Hey. Yeah. So we were

Wes Bos

we have a editor now, Randy, and he is doing all the producing and exporting of the video and and editing it all together and and writing all the show notes and stuff. And, he's got lots of of processes. Right? And some of those parts Yarn, like, he hit little issues or things can be sped up in a certain way. So we've been writing little scripts here and there, to Scott help him out, and I thought, like, this is kind of an interesting show because, like, even as, like, a video editor, no matter how good you are at your tools, you can certainly improve either the speed at which you do things or the accuracy at which you do things when you can TypeScript and and process improvements into that flow. So I thought we would just kinda talk about a couple examples of things that you can do, and talk about how do you actually write these things and hand them off to people who who need to do them? Yeah. And, you know, they can even help you out. They could be a good introduction

Topic 1 00:36

Randy hitting issues exporting videos; writing scripts to help

Scott Tolinski

to getting into programming in a more practical way if you're the type of person who's just trying to break in. Maybe you're working, a job right now that isn't a programming job.

Scott Tolinski

Potentially, it's a cool use to get to practice your programming skills while accomplishing tasks you need to do for work to potentially dive into some of this stuff as a, you know, a life hack to both gain experience, but also speed up your your workflow so you can spend time doing, you know, things you wanna be doing instead of the mundane tasks of your life.

Topic 2 02:12

Sentry tracks down bugs in sites

Scott Tolinski

But let's talk about mundane tasks like solving bugs.

Scott Tolinski

I have to solve quite a bit of bugs in my life because I create quite a bit of bugs, and, I like to solve them using a tool called Sentry. This podcast is presented by Sentry. And you know what? Sentry does such a good job of finding any kind of little little issue you might have in the site. It presents it in a way that you can find it, fix it, know what's going on, and then, track, make sure it doesn't happen again.

Scott Tolinski

And recently, I've been noticing, Wes, the issues on Century that have existed for a long time just kinda show up in GitHub.

Scott Tolinski

And that's pretty neat. Right? You can attach errors directly to a GitHub issue, track it there, assign it to other people, Yarn it as solved, and move on. So if you wanna check out Century, head on over to century.ioforward/ syntax, and you'll get 2 months for free.

Wes Bos

Alright. Let's talk about, the first one, which is we'll say the problem that Randy had. So we are doing a podcast now that is both video and in audio. So the process is that Randy edits the whole video podcast, and then he puts the chapter markers into the video and and exports that JS, MP 4.

Topic 3 03:04

Script to export video chapters to MP3 chapters

Wes Bos

And the way that chapter markers work in, his DaVinci Resolve is that it just embeds them into the actual file. If you there's a really handy tool called f f probe. It's part of FFmpeg.

Wes Bos

Mhmm. And if you ever just type f f probe and and give it a, a file, it will tell you all the information about that specific video file. And, in fact, when when Randy came over here, we were testing out, I think, about 5 different recording softwares to see, like, what what are the bit rates, what are the frame rates, like, all of that information of, like, who's actually giving us the best quality video out the other end at the end of the day. So I was just I just do f f pro, and it dumps all the info. He's like, man, like, amazing that you can just you could just do this this kind of stuff, which is really cool.

Wes Bos

So he does that with with video, but then when we converted it, we export as a m p 3 from Resolve.

Wes Bos

It was stripping the the markers. There's no way to export a m p 3 with embedded chapters, which JS, of course, all the podcast apps need that to to give a audio chapter. So I was just like, alright. Well, let me see what we can Node. And I just FFmpeg.

Wes Bos

The knuckles.

Wes Bos

Yeah. And it kicked out the chapters in, like, 2 seconds, and I was like, oh, damn. Like, that was really handy. So we just put together a little script that would do that JS well as one thing we're working on is also just scaffold out all the chapters into the markdown file because he has to write the show notes as Wes.

Wes Bos

And just like that kind of stuff. Like, even if it takes them 15 minutes, like, that's 15 minutes that you can spend on doing something else. So FFmpeg is just like we might even do a whole different show on FFmpeg, but it's it's amazing, that tool, of everything that it possibly does. And it always it always just works. Yeah. I was I I was getting deep into

Topic 4 04:58

Scripts can validate markdown format for show notes

Scott Tolinski

writing my own video capture, service, and I was using actual raw frames, which are massive. And it's amazing how you could pipe in like a stream into FFmpeg and as long as you can navigate the kind of stuff you're doing, the FFmpeg isn't the problem. It it can chug through anything and spit out a video. So I I was so impressed once I started getting into deeper into FFmpeg land. I've almost always just used it via a UI, drop in a video to re Node it or any of that stuff. But, man, it's it's totally inaccessible project. And if one thing's made FFmpeg more accessible than anything else, it's chat GPT because you can ask all sorts of questions about it. So

Wes Bos

It it's true. Like, I Randy was, like, googling for little commands to run it. Like, he's like, oh, like, let me try compress the MP 3 a little bit much. We don't need the bit rate for just for just, spoken word. Yeah. And I was like, yeah. Just use chat gpt, and it'll kick out the you just tell it what you want it to do, and it'll kick out the actual, crazy long FFmpeg command for you. And it's amazing. It almost works every single time. Yeah. Amazing.

Topic 5 06:35

Using AI like ChatGPT to help with complex tasks like FFmpeg

Scott Tolinski

Let's talk about some other cool stuff. So one one thing that, you know, we really needed to do was to make sure that our shows, which are authored in markdown, fit a very specific format because markdown is definitely a developer's tool. Right? And oftentimes, we ask Node developers to work in markdown, and that's not always a great thing. But one thing that we needed to do is to be able to essentially validate that markdown. Now granted, we threw this in a GitHub action. The GitHub action's essentially running JavaScript to check a number of things with the markdown. But to be able to essentially take it in a file input and verify that, one of the things that it does is it checks every link to make sure that the links are resolved. Therefore, we won't get any broken links. It already found a video or a podcast file that, it was it was set to, like, you know, make public on public. It wasn't publicly available. Yeah. It was set to private. Therefore, the script was failing. And I was like, oh, I I messed up part of the script. No. The script was finding the broken link just fine. It worked. Yeah. It worked. I was like, okay. Why is this link broken? It shouldn't be broken. It exists. No. The link was actually broken. And so, you can use these types of things to to do any of your tasks, any of your bidding. Right? You have a very specific format or very specific thing you have anybody in your life needing to edit or work in. You can write code to validate that.

Topic 6 08:04

Scripts can add validation to processes requiring strict steps

Wes Bos

Yeah. Anytime you have a process where the steps must be done perfectly and you Yeah. Hopefully shouldn't miss something that like, many times in the past, we've we've not broken the site, but, like, we have a broken build because there's a a missing dash somewhere or, like, on the old website, we put in couldn't put colons into the the show titles because the show title was in front matter and, like, so many of these little things that, like, you shouldn't have to rely on a human catching every single thing. Right? You should be able to write some sort of script that will put those safeguards in place that will sort of catch them for you. Because I thought it was hilarious because on the show, in the past, we've said, don't give your clients markdown. You know? Yeah. Like, my blogs are markdown, but I don't think I would ever hand off markdown to to an actual client. And, Wes we gave it to Randy, and they'll say, hey. You gotta learn And, like, there's there's so many things that could could potentially go wrong when you're writing markdown, so it's nice to have all those validation steps in place now.

Scott Tolinski

Yeah. Welcome to the developer podcast where we make you author the show notes in Markdown.

Wes Bos

One one kinda interesting idea I'm gonna I'm just gonna pitch it this to you, Scott. And That's it. It it's also probably worth talking to Randy about to see if this would be handy as well is our process right now for the transcript and the AI show notes on the podcast is the editor edits the thing. The editor writes our own show notes, and then publishes it. And and once it's public, we run that. We get a whole we get a transcript for it, and we get a whole bunch of AI show notes for it. Meaning that we ask it to summarize the major talking points.

Topic 7 09:59

AI can generate initial show notes to help editor

Wes Bos

And they're they're really good. Like, Matt Pocock on Twitter was asking about when would you use Axios over just built in fetch? And I just screenshotted the AI summary of all of the bullet points from that Node. And it was, like, the perfect like, you don't even have to listen to the episode. You just read that list of bullet points, and and you kinda get a good idea of of what's going on. And I was like, if those are so good, why don't we do in like, do a 1st run of the show Node? Show notes. Yeah.

Wes Bos

With first, get the transcript because it can be easier to edit video if you can cut it at a specific word, like or you can search for where oh, where did he talk about x, y, and z? And second, DaVinci Resolve has a an API which you can programmatically embed markers or you can I think it's like an ETL file? You can import markers from specific time stamps. And I was like, well, if we did, like, a first pass of get the transcript and then get the the major bullet points, immediately put those into resolve. And, obviously, like, he's a human. He can take it a little bit further, and and change it and rename things. But, like, wouldn't that be, like, a a little bit of a head start to get a little bit more context for for the video,

Scott Tolinski

to embed it. Wouldn't that be cool? I don't know. What do you think? Yeah. And that Node other thing, I I think it fits this conversation very well is it's taking something that is a more in-depth technical process. Randy's gotta sit down. He's gotta, you Node, he says he listens to the episodes tons of times. So he's gotta take one of those at least one of those listens to to put together, like, final usable show notes. Like, what if you could get a head start on that or a really good foundation? That frees him up to do so many more important tasks that you Node, he's got enough stuff to do. And, I can't imagine that writing the show notes is the most fun of the tasks and jobs that we're we're tasking him with. Right? So if we could scaffold them out,

Wes Bos

and and, like, ideally, at the end of the day, we would just have, like, the AI show notes and the human written show notes will be some sort of morphed together type of thing. And, like, another thing we do is every single show, we have to figure out what are good clips from that specific episode. And there's lots of AI clip generation things, or you can you can give it a transcript and say, hey. Give me give me points, and they're not all that good. But Scott asked me to pull a whole bunch of clips out the other day.

Topic 8 12:40

AI transcript helps find clips in episodes

Wes Bos

And what I did is I just took the transcript.

Wes Bos

I put it ESLint Claude, and I just gave it the prompt that says, give me the topics and then maybe even give me some, like I Wes like, give me some interesting points. Give me some funny points.

Wes Bos

And then just from all of that data, I was able to say, okay. Well, I'm I've listened to the podcast because I was on it, and I have a good idea of where in the episode these things were talked about.

Wes Bos

That made it so much faster because I didn't have to just sit there and listen to the whole thing again to scrub and find the parts. I could just visually see where they were. So I think, like, I I think we still have to do the transcript and the AI show notes after it's all edited, but I think if we also do it on the raw value, I think you could get a lot of value out of that.

Scott Tolinski

Yeah. You know, one thing I think about too in this space is I'm working on a YouTube find and replace tool. There's these that exist at TubeBuddy. They're expensive. But I I I started working on 1 myself, and it turns out it's it's relatively simple if you know the YouTube, API. You just I I'm pulling in every episode of Syntax we have ever or every YouTube video that's formally Vercel up tutorials ever. I'm throwing them in a SQLite database. I'm doing the find and doing the replace locally, and then I'm pushing up via the IDs and the changes TypeScript. You could do a find and replace over 2,000 YouTube videos Node descriptions.

Scott Tolinski

Well, what if in that process, we were able to write YouTube descriptions as well? We I mean, we would be able to automate AI YouTube descriptions directly from our our video. That seems really cool.

Scott Tolinski

Yeah. Cool avenue to explore. Right?

Wes Bos

Oh, it's true. Yeah. You could you could do quite a bit with that.

Wes Bos

And, like, sometimes now, I'm I'm frustrated where you're you're on a YouTube video, and there's not chapters in it. And I got you think, like, come on, YouTube. Like, if someone doesn't provide chapters, at least find it out. Like, Google search does that. If you search and the answer is in a video, it will try to link you to where in that video the thing is answered, and it's it's pretty decent. So, obviously, they have that information.

Scott Tolinski

I think there is some AI chapter features coming in YouTube. I saw some some beta something for that. But Oh, awesome.

Scott Tolinski

Let's talk about, like, what types of scripts you can do because we we've just kind of been pontificating about stuff that we have done, and we can get back into some more examples as well.

Topic 9 15:13

Ways to run scripts - executable, Raycast extension, etc

Scott Tolinski

But what are some ways that you've run some of these scripts? One of one of the ways that I I've written scripts is I took it as an opportunity to learn Rust a little bit. I hacked together JavaScript in Rust, and then I was able to output it as a straight up executable. Anybody can run an executable. Right? Mhmm. You can even choose to run that from other means.

Scott Tolinski

Or I I've done little scripts as Raycast extensions Wes Raycast is essentially just going off and hitting a script. You know, we were doing a Vercel of tutorials newsletter.

Scott Tolinski

I, being myself, would frequently forget to put in, you know, tasty clicks or whatever we had for the level up tutorials version of the the the newsletter.

Scott Tolinski

If I saw stuff, I would bookmark it and then lose it. So what I did is I wrote a Raycast extension that'll let just took whatever JS ever in my clipboard and put it onto the list, and then Caitlyn would have that for whenever she was publishing the newsletter.

Scott Tolinski

So for me, that was, like, a huge productivity boost for both of us because I I, you know, I I automated that thing that would always be plaguing me, and it made it much easier.

Topic 10 16:17

Challenges giving scripts to non-developers

Wes Bos

Mhmm. Yeah. There's giving it to somebody who is not a developer is always a a tricky thing to do because you have to bundle it up into some easy way. Otherwise, if it's like like, we all know the, like, the overbearing technical person who's like, oh, why are you doing it that way? I could make it so much easier if I give you these 11 things, and then, like, they're not actually gonna use that because it's it's too complicated. It doesn't actually fit fit into their workflow.

Wes Bos

It breaks halfway through. You know? Mhmm. So with Randy, I wrote a, perfect example. It didn't actually work that well because it I don't know why, but we needed FFmpeg.

Wes Bos

The script itself was in Node, but in order to get the context menu on Bos, like, basically, we wanna right click, convert this to m p 3, and scaffold out the show notes.

Wes Bos

So that had to be triggered in bash.

Wes Bos

Oh, no. It was an Apple script which triggered a bash, which ran a Node JS script. So I had to get Randy to, like, install Homebrew, and then Homebrew install FFmpeg, and then install Node JS, and then there was some permissions issues, which I had never hit before, and then he needed Node, in order to run. You know? Like, it's just like, and, he ended up we ended up just using straight FFmpeg. I showed him how to do it, but, like, I was thinking, like, man, it might have been faster to just build a little website with a drop zone, and Wasm because FFmpeg has a Wasm that runs in the browser, and I could simply just convert it in the browser and then allow you to click it and download it.

Wes Bos

That's the beauty of of the browser JS that you can make contained shippable applications.

Wes Bos

So I think that that might have been a a better idea.

Wes Bos

AppleScript itself, I have written so many AppleScripts in my day, and I always always am so frustrated. There's a there's a whole JavaScript API for writing AppleScript, and I could never never get it to work properly. I never understand what to do, and it you're half in this, like, weird GUI with things that are connected to each other, and I'd rather just have a a node script and have everything up and running.

Topic 11 18:42

Recommend browser app over desktop app for user-friendliness

Scott Tolinski

Yeah. Yeah. I agree. You know what? One one cool thing too here that we we you kind of briefly touched on. But, you know, you could take that website that you were talking about and turn it into a app using Tori relatively easy, because with a Katori app, you could use now you can do, like, a quick Svelte interface or a quick interface in in, you know, whatever you're using. And then all you're essentially doing is invoking a script and the Tore side. And that that side of things is as simple as saying, invoke this, and then you can pass in the stuff that you wanna run. There you go. You now have a GUI for your script that you're running if that is something that, you know, would be helpful to the to user that is going to be using it.

Wes Bos

Another one from John Linkwitz TypeScript kit.

Wes Bos

And for somebody who writes, like, a lot of little scripts to automate things, this is a super handy tool. Go to scriptkit.com and check it out. I don't think they have this. I really wish that instead of having to open it, it kinda has, like, a Raycast interface, but I really wish that it would integrate with OS X finder so you can simply just right click convert, because that would honestly, that's the the ideal type of thing to be able to do it. Because whenever you're getting into Node TypeScript, then you Scott, like sometimes you gotta kick out to a different script or you gotta, like, how do you pass a file into Node. Js from a GUI? You gotta tell them to, like, CD into a directory. So some sort of bridge between those 2 things would be really neat.

Scott Tolinski

Yeah. Totally.

Topic 12 20:19

Invite listeners to share scripts they've written

Wes Bos

I think I think that's it. Like, running the scripts, those are there's probably lots of other ways. Bash scripts is one. I always regret writing Bash scripts because yeah. A little simple one, but then you wanna get into concurrency or you wanna loop over some files. And then before you know it, you're just like, what have I done? I wish I just had done this in, in Node. Js. And there's even a a whole bunch of different files. There's one called DAX that got released last week from the Deno folks, which is you write it in Node. Js or you write it in JavaScript, but you can run shell commands.

Wes Bos

No problem. I use another one on the syntax website to do that as well. Let me find the name of it. It's because I I we have to move files from 1 folder to another before we deploy because of some Vercel limitation, and I use zed x. So zed x is another one from Google, and it's it's because you can just say dollar sign back text and then write the bash script right inside of there, like CP or NPM install, and it will go off on a trial process, run that, and then come back with the actual, standard error, standard input.

Scott Tolinski

And for those of you non non Canadians out there, when Wes says zed x, he doesn't mean zed x. It's z x for Americans out here who know the letter z.

Wes Bos

Yeah. I'd I'm very proud of Scott of Canadian stuff, but the whole Zed thing,

Scott Tolinski

it doesn't sound right, does it? That's the one thing. Yeah. Yeah. I like them. I like my I like the metric stuff.

Scott Tolinski

I don't know if I like the Celsius stuff. I guess I could get behind it, but the the Zed stuff can't get behind that. No. No. That's No.

Wes Bos

I'll, I'll fold on that one.

Wes Bos

But that's it. Let us know what your scripts are that you've written for your coworkers and whatnot, because I love doing this type of stuff. There's automating things away, making things much easier.

Wes Bos

It's it's fun just to build it. Even if I'm not save saving time, I'll still build a little script to to automate it because it's fun for me to architect it.

Wes Bos

But, certainly, there's lots of people in your organization that might need a little help with that type of thing.

Scott Tolinski

I mean, programming is here to do exactly this kind of stuff. And if you're the type of person who's curious and you got these types of skills, what a better use case for getting to flex some of those muscles than, you know, getting to use those superpowers of automating away with your newfound abilities to code stuff up. So this is sick. Yeah. Let us know what kind of things you are automating. Leave a comment if you're watching on YouTube. Hit us up on Twitter or any of the socials. We want to hear what kind of cool stuff. And if it's open source, link us to that repo. We'd love to check it out.

Wes Bos

Alright. Peace.

Share