 All right. Hello everyone welcome back Again, I should probably welcome myself back. I guess but I've been offline for like three weeks. It's been fantastic but now I'm ready to Do some streaming again? I Figured we'd start with something that I've gotten requests for basically every stream and like YouTube comments or Twitter comments or on patreon where people have been asking me like What is your setup? This seems to be something that a lot of people want to Sorry, I'm just need to This my chat doesn't turn off a lot of people have been asking what my setup is in part because they want to replicate it or just Because they're curious like how do you have Firefox but with the tabs on the bottom and instead of answering everyone individually? I figure to do a stream just to get us started on like what is my desktop setup? What is my editor setup? What kind of rust tools do I use commonly that kind of stuff? For those of you who are new to the streams and have just watched the live video, sorry the past streams I do live streams mostly of rust coding. Although this one is a slightly different And I've done a lot of them. They're all archived on YouTube. So you can watch the past ones We've done a lot of different kinds of development on asynchronous IO. We've done some on easy to orchestration We've done some on data structures I have a patreon page where I post whenever they're upcoming streams and also where you can support support me if you're able to do that You can also just follow me on Twitter where I announce whenever they're upcoming streams If you have any ideas for streams, you'd like to see them Please let me know either on patreon Twitter or just send me an email And I'm happy to look at those I want to keep doing this for as long as I can And of course, hopefully there are more interesting things that you want to see that were both I can learn and you can learn Today I'm going to go through a lot of my setup and I have there's a github repo that has all my config files Or at least should have all my config files You can follow along there or copy things from there if you're interested I should probably do some cleanup of this which I haven't done in a long time But at least most of the Most of the files are here If at any point during the stream you have questions whether they're about my setup Whether they're about writing rust code about programming in general about streaming anything at all We should use the stream to sort of As an opportunity for you to ask questions like that as well So if you have any questions that I'll feel free to fire away at the chat I'll monitor it as well and try to answer things as we go So now that that repository is out of the way my I'm using I'm running Linux and my setup is just using a tiling window manager So in particular I'm using xmonet although Considering switching I just don't have anything good to switch to yet A tiling window manager has the ability of doing this So whenever you open additional windows They sort of tile nicely and you can change the size of the different tiles You can move different tiles around It's just really convenient for if you don't want to use your mouse all the time because you don't have windows You need to drive around I've been really happy with xmonet. It's a little bit awkward that all the configuration is in haskell But it seems to work all fine and there's basically no Configuration of windows like as you can see I don't have any title bars or anything So it just it just ends up with giving you a very seamless interface and I kind of like that There's a tiling rust window manager that is kind of cool this one That I really want to start using at some point last time I looked at it It wasn't quite mature enough to use But that might have changed it might now be good enough It also used to Oh, it seems to have changed. Okay. Yeah, so this is something that I might consider switching to I have not given it a chance yet But it looks pretty neat As I said the exact window manager isn't terribly important as long as you are able to set up your hotkeys correctly The bar at the bottom I get a lot of questions about so at the very bottom here It's like this very bottom here. I have bar that shows you like which workspace I'm on What windows open and the the system title bar now? That is a program called poly bar I recently switched to it and I'm really happy about it. It's very configurable. So they have a lot of plugins like for example If I have github notifications, they show up with a little github icon down here All of this is really convenient and you can use Unicode emojis down here too. So that's how I have an icon here. That's why the github notification icon is an icon It's really easy to get set up It's really easy to make it look nice and it integrates with like basically any window manager that you have and Produces a really nice layout So I can highly recommend poly bar And then my terminal is actually written in rust. My terminal is alacrity it is a Terminal manager that was written by what's his name jib. Well, I don't remember his actual name His actual name is joe. Nice joe well. Well Joe decided to start writing a terminal Manager that was supposed to be fast, right? Like the goal was to use the gpu to speed up an accelerate the display of the manner the terminal because it's something that you open and close and Do things and so often that you really want it to be fast And I think he succeeded like I think alacrity at this point is really nice to use it also has A config file that is in yaml. So it's pretty easy to get set up with I'm using the noto font and I think together these work just really well. It ends up looking really nice and I'm using the So I'm I'm a big fan of the base 16 themes So base 16 is this tool this chris kemsen wrote that basically It is not in and of itself a theme, but it's a way of taking color files and Sort of templates for how to set up style sheets or themes for different programs And then it generates all of the color schemes for all of the programs So for example The one I'm using I don't know if this is listed here anywhere the repository Yeah, so there are a bunch of templates for different programs. Oh, I didn't know there's an alacrity one great So for all of these programs There are all of these themes, right? So it it cross generates all of them. So I'm using a theme called atelier dune And I use it in everywhere like I use it in I use it in vim. I use it in my terminal. I use it in fish. I use it everywhere I can find it. It's really nice both for code and for general terminal setup And so it's something I can highly recommend doing But in general alacrity just it's a very minimal terminal emulator But one that provides basically everything you need. So I've been really happy with that My shell is fish. So I'm a big fan of fish. I found it many years ago I love the title as a that fish is a command line shell for the 90s With the claim that bash and the other sort of non fish shells are from the 80s or even earlier And so it has various kind of 90s features, which I just appreciate a lot It just it's not great for scripting, but it is great for just like General terminal features. So you have autocomplete it parses man pages to look for what options are available for a given command So if I do this, right like it will autocomplete what are the possible sub commands for git and it does so by parsing the man pages It has really nice support for history So history as opposed to having to press like control r or something like you do in bash To search everything is always a search. So if I do this it will autocomplete with saying git push because that's the last Git command I I wrote I can also just press arrow up to go back through the ones I've used in the past Um The other thing that's nice about fish. It is is it's pretty easy to write simple commands Like if you want to run a command multiple times, uh, if you were to do that in bash, you would do something like for I in sec 110 do echo I Semicolon done, right? So this is how you do it in bash Um in fish is it's much simpler. At least I think it's much simpler Not in the sense that there are fewer commands or anything It's just that you don't have to remember all the bash isms Right, so you don't have to remember that sub commands are in a dollar. You don't have to remember the do keyword Everything is ended with end as opposed to in Uh in bash where it's like fi ends if uh isek ends case done ends for Like you don't have to think about all of these things. It's just nicer to type simple commands in Um, so I I've been pretty happy with that and at this point there are autocomplete files for fish for basically every program as well Hmm So that's pretty cool. Uh, then I use tmux to do terminal multiplexing So if you notice when my terminal is open here, uh notice down at the bottom here, it says zero fish I can rename that to like Uh stream So what tmux lets me do is I can press Um the tmux command key, which is usually control b I've remapped it to control a control ac and that creates a second terminal tab if you will So it's basically a way to give you tabs and your terminal without having your terminal actually actually support tabs Um, I'm a big fan of having things be Just use keyboard shortcuts And that is essentially what this gives me. Um, because Prefix p switches to the previous tab prefix n switches to the next tab And you can keep doing this the other thing that's really nice is if I now close this window entirely Um, I can do I just opened a Sorry, what I did was just open a terminal window that does not have That is not running tmux and here I can run tmux ls and you see there's still a terminal session open here So tmux, even if your terminal crashes, uh tmux will keep running and keep all your sessions alive So I can do tmux attach dash t0 and now I'm back to the one that I had I can close it again Open a new tmux session Here as well Now there are two sessions one that's a currently active one and one that is the one that's still running in the background You could have multiple terminals attached to the same thing. So now if I do tmux attach dash t for Notice how if I type in one it appears in the other So you have multi attachment, which is really nice um now of course Close this old one because I don't need it anymore And we'll get back to your terminal over here So tmux is really nice for multiplexing onto a single terminal window Um, I sometimes still end up having multiple terminals open So I might have one to like look at a man page and the other Um, where I have code or some or some command I'm typing that might have multiple tabs So tmux does take you take a little bit of getting used to in the very beginning, but it's just it's so handy Um, there are some other ones. So screen is a very common one I like tmux a little bit better the customization is a little bit better. Um, it also Uh supports a few more things like you can You can do things like This to open another terminal split And you can split the other way as well. So you can do this And it's just like there these are these small things Just make it easier to work if your life is primarily operated in a terminal Then you really want keyboard shortcuts for these kind of things Um, my editor is neo vim, uh, which is really cool I uh, I found it a few years ago when they were stills are just starting out And it's basically they started with vim and then they decided to get rid of all the old stuff Like actually rip out all of the code that was no longer necessary. There was supporting old platforms and such Um, and just implement the newer Like implement a nicer protocol for integrating with vim. So basically vim is at this point a library for neo vim sort of Um, they have then multiple front ends for it. You can write now extensions and plugins in lots of different languages And there's a json rpc protocol between the editor and the extension This also means that you can have asynchronous asynchronous behavior of extensions Which now is landed in vim 8 but was not usually the case in vim Um, it also means you can write extensions in other languages than vim script Which vim script is a painful language to work with. Um, so Like it's just a I find it to be a better editor Although vim is catching up now, but it's unclear why you would not just use neo vim in part because it's Basically backwards compatible. So extensions to work with vim also worked with neo vim All the commands are the same the key bindings are all the same. Um, it just has more things that are nice You can in fact for me, I have the same config files sim linked for both of them. That's how similar they are If you look at the mrc, I have a fairly extensive mrc. Um, that just like has sort of accumulated over the years Um, some of it isn't related to us. So let's take a quick look through Um, so the things that I would say are useful to have are I'm using vim plugged Which is a plug-in manager for vim, which is just really nice So if you want to add some kind of vim extension, you just type plug and then the Username slash repository name from github and it will automatically pull everything down. So this is um, you type this command Yeah, uh, except not super And if you're using bash, you don't need the end shell part And this just updates and installs any plugins you've listed deletes old ones All of it handled just really nicely. Um, I'm using light line, which is this bar down here That tells you what mode you're in and such I don't know that I really need it anymore But it does add a certain visual flair to the editor that I kind of like I'm also using ale. Uh, so ale is actually really nice vim ale so ale is uh, Sort of similar to syntastic, uh, if any of you use that for older versions of vim um, so it basically gives you a gutter in your editor that gives you things like, uh, syntax errors compilation errors, uh, if you integrate some kind of, uh, Grammar tool, then it will also point out, uh, poor phrasing if you're writing documents in latech or in markdown or whatever Um, and the nice things about the thing about this compared to syntactic, although syntactic might have changed since Is it's also fully asynchronous? and so It's not like your Editor has to wait for the limiting or compilation to finish before you can show anything It like actually progresses while you type and you can keep typing while it's operating Um, it also supports So many languages and it's fantastic. Uh, the other thing that's nice is for each language It also has multiple implementations. So for rust, for example, it uses cargo rls rusty and rust format and can give you messages from all of them Uh, and I find that really useful. You can also mix and match them. So for example, I have turned on, uh, Grammar checks for comments in rust code, which is just really nice to have I'm a big fan of ale Highlighted yank is sort of nice. So it's if you mark multiple lines or if you say that you want to Like yank or copy in vim terms the next three lines. So three yy it highlights the things that you copied Vim router is kind of nice, especially for rust projects So what vim router does is if you open a file in vim, it will cd to the root of the nearest git repository Um, this means that now if you try to open a file, it will open relative to the current directory It's a specially nice in combination with uh, So if you haven't heard of it, I don't actually know how you pronounce this Is a fuzzy finder that integrates really nicely with just like everything It basically takes a list of files or a list of just lines of text and lets you do fuzzy search on it So if I'm in a given repository, so let's go to, uh, Tokyo So if I'm in Tokyo, um, I can type my shortcut for Open a file with fuzzif and now I have Uh, fuzzy search for files. So I can go let's say I want to look at something in current thread I want mod rs Right and then notice how this just gave me a fuzzy search across that entire repository and because of the, um Because of vim router it searches from the root. So if I see the let's say I'm inside Tokyo codec And I'm editing like source lib Source lib in here and now I want to go out to current thread I can still just search current and because router put me in the root I can now search the entire tokyo repo Uh, it also has things like you can fuzzy search across curbed the open buffers. So let's see if I open, uh codec readme codec Toml and codec license I can now fuzzy search among the open buffers. This is also another binding you can set up This is really convenient if you're frequently switching between like three or four different files um The other binding I have in vim that I've been really happy with is, um, vim has this notion of a leader character That is sort of like the thing you press before command keys. Um, I've set that to space Um, and then I have leader leader map to switch to the pre the buffer I was just in so I can really switch really quickly switch between two files Um, this just speeds up development so much when you're in the terminal because it's so often especially in rust code Where you're like modifying two files because one is calling the other or something like that, right? And quick switching is really handy um Let's see. What else do we have? Language client neo vim. So this is the thing you need to install in order to use rls With neo vim, um, it also integrates with ale really nicely Um, there's some talk about integrating language client directly into neo vim, but that work hasn't landed yet But when that lands hopefully this plugin will go away even though it works pretty well ncm ncm too is what gives you autocomplete Oh So it was called the the nmin completion manager and now it's just ncm uh, it whenever you're writing code it gives you autocomplete for um Using whatever source you have for autocompletion So in my case this would be using rls for example, and so it gives you really nice autocomplete Um for css it gives you autocomplete for like keywords and values, which is really nice for rust code It gives you any kind of autocomplete that rls rls gives you um It gives you like python and javascript completion just all kinds of completion and just works really well Like I've I've basically have no problems with ncm um The one thing that's worth pointing out is in vim Uh, the default autocomplete behavior is a little bit weird So you need to explicitly say what tab and enter should do And so it's taken me a little while to set up these exactly the way I expect it to work like Uh, basically this is saying that if the so for if I press tab if the uh, If the autocomplete pop-up is open and an element has has not been selected then Uh Then select one if it has been selected choose it otherwise insert a tab, right? So these are this is just my preference and there's a default that they give in here That you should probably just use and then see whether it works for you But one thing that is nice is you can change these as you see fit um What else do I have some plugins for ncm? Echo doc although that's not terribly important anymore Uh, the rust plugin although that's also not terribly important and support for fish also not important um What else here is relevant so here you see there's still a basic steam theme Um I'm using rg so ripgrep the uh the Rust searching tool that's sort of like grep for the silver searcher or any of these Uh, those written by burn sushi. It's really fast and really nice to use So I'm using that for all kind of vim search internally Um, so there's colon rg rg uh, where you can search through like It basically searches from the current directory recursively down and takes into account any git ignore files So this is a really handy search and because of the vim router plugin, it will actually search your entire project So let's say that I'm in Tokyo again and I search for handle Right now it gives you all results for handle and it gives you fuzzy search over the results Right, so it's just these things all just integrate really nicely And these are the kind of things that you sort of really want to have if you want your uh an editor like them to sort of Have all the conveniences of an id Uh, can you post your vim rc? Yeah, so my vim rc is all all of the config files I have are in this repository They should all be up to date, but you should double check Notice also now I have a github notification and there's a notification icon down here. It's really nice Uh, yeah, so all the config files are here Uh Learning rust is pointless without knowing c in systems programming I tried and felt like I would not reach the kind of understanding that I want I actually think it's the other way around. I think at this point You might as well learn rust straight away. I don't think there's an advantage to learning c first Uh, learning c first might actually just confuse you Um, but It sort of depends what resource you're Using and what you're planning to use rust and or c for Um, like if you're going to do a bunch of embedded programming It's true that it might be easier to start with c if you're doing operating systems programming Then maybe it's easier to start with c But I think in general you might as well just start straight with rust and then Expand your knowledge based on like read tutorials on advanced rust for example Um, a snippet engine. No, I do not use snippet engine. I have never found the use for one In general, it's very rare that I have to write boiler boiler plate code. I think Like my typing speed is not generally the bottleneck and so I don't find that snippets really help me Um It is quite the opposite for me. I'm assuming you're referring to rust versus c So I'll leave that discussion to the chat Uh, let's see where we're yeah, so fsf Is also really nice because it also works for file search on the command line. I haven't set that up, but I've heard it's nice Um, let's see. What else do we have here? Um Yeah, so various ale setups for doing cargo check Uh Yeah, so I have control p set up for uh open a file in this project and that's the one that will also use um use fsf for autocomplete Um, and then there's leader semicolon, which is what I use for search for open buffers Uh, I also have leader w for save the file Um Various things for inspecting things with language clients. So uh gd for example goes to the definition of a function for me in rust code Or in any other language that has language client support. Um, what else do I have rust format is set up, of course These aren't terribly important I should probably document why I have each of these settings. Most of them are there for a good reason Many of them are there because of things that older versions of vim did strangely um Scroll off is kind of nice actually, but I want to be to come to think of it Um, what else do I have? Oh, yeah, this is a nice thing to set undudir an undue file what this does is um Normally if you open vim do some changes you compress you to undo But if you close the file and open it again, you you can no longer undo If you set undudir an undue file You get undo even if you close vim and open the same file again later You can undo past when you close the editor, which I found so useful Because it means you can pop in and out of vim without losing your undo history It also means that you've if you edit say, um system configuration file You can make changes and then like a week later open the same file and undo it again Whatever change you made a week ago So that's that i'm a big fan of Um What is your keyboard so i'm currently using a philco majesta touch philco majesto touch ninja This one And i'm really happy with it. It has the keycaps on the front, which is actually kind of cool. Um It also just has a good feel I'm just really happy with it. Uh at work. I have the microsoft ergonomic keyboard But not the new one but the old one This one no that is the new one that's terrible Uh But i've actually been really happy with that because so i do a lot of programming and If you do programming for a long time like if you're young it doesn't matter But after a while you like feel that you're like Moving your wrist more and it's nice to have a keyboard that's made to have your wrists in a more neutral position So i've been pretty happy with that. Uh, but at home. I have the the majesto touch and i'm really happy with that too Um Let's see So uh pal the one thing you might want to look at is uh What is his name? this guy So if you look up philip opperman's blog He has a sequence of posts on implementing an operating system in rust from scratch And that covers a lot of the topics that you're talking about. Um, and so you might want to look at that It doesn't really talk about like very low level things like How like how compilers work? But it is a really nice guide just for understanding operating system primitives and the In general virtual memory memory mapping How monitors work those kind of things Let's see what else do we have here? These Not terribly important although kind of neat Uh one thing you'll find is the more you use rust Sorry, the more you use them you start just automatically doing things that people look at and go what so Zz will center the current line in the editor zt will put that line at the top of the editor Uh, and zb will put it at the bottom. This is really handy if you're moving around files um Just something to like Get used to Um, what else do I have? Oh control j s escape is fantastic. So escape is really far away and it's kind of annoying uh control j is sort of On the home row of the keyboard. So it's really quick to type instead of escape all the time. Uh, what else do I have? These are for um Uh keyboard, sorry clipboard integration like x clipboard integration Uh, it's kind of nice not terribly important One thing you should definitely do in vim disable the arrow keys immediately It forces you to learn to use the home row to navigate and it's so much faster The sculpt ergonomic is that the one I mean? I think that's the even newer one This one does not so I generally browse with javascript disabled and it makes a lot of pages really sad Uh, also Yes That is the one I have And I'm pretty happy with it works pretty well These are handy for working through errors, but it's not terribly important Uh Yeah, I think that's basically it for neo then Uh, and then you may have noticed that if I list files, so I type ls, but it becomes xa So this is one thing that um If you look at the fish config fish has a thing called fish user abbreviations Where you can set up that a given command is really a different command Um, so here you'll notice that I've set l to be xa ls to be xa l l to be xa-l So basically I've remapped using whenever I type l it just becomes xa if I type ls it becomes xa xa is a um Uh Ls replacement written in rust and it's really nice like it gives you color coding human readable Sizes it does nicer like tree listings. It's just like a better version of ls That I've been really happy with um, so just something to Like look out for if you're if you want to use more rust things too, but it's really nice I've been really happy with xa it gives this kind of output as opposed to the Ls output it also integrates with things I get Like get so you can if you pass dash dash get you also get information about The get status of the different files that are listed Uh for email I use mutt Oh, do I want to open my mail right now? That's a good question. Let me uh, give me a second Um No, I do not think I want to do that That's kind of stupid Well, in any case mutt is a command line email client. It's something that I'm going to go with most people probably don't want to use I just I live in the terminal and I don't really want to Open more things keep more things open in the browser. Um, I am using fast mail As my mail provider and I've been really happy with them. I use them for many many years and I've never had any issues Um, I have basically never used their web client. So I have no idea if it's any good But they're really good about supporting like, uh, IMAP and SMTP standards So I've never had any integration problems whatsoever Um, very little span too So I've been pretty happy with that So I use mutt for that. I also use, uh, buzz which is a tool I wrote a while ago for Uh, also written in Rust for notifying me about email. So it comes up with this Uh, let's see. Do I want to run buzz now? Probably So buzz is this little tool where all it really does is it puts a little Um Puts a little icon in your toolbar that shows you whether or not you have email It integrates with you just put in essentially the connection details for various IMAP servers Um, and then when you click it it runs some customizable command And whenever you get new emails you get a little notification like you saw on the top there Um And so that's just a handy A handy thing to have when you're using mutt because otherwise you don't get any kind of notifications from mutt, right? Mutt does not run in the background. It just you open it whenever you know that you ever know RLS Right, my guess is most of you have probably seen RLS already anyway Uh, can you link buzz here? Yes, I can Uh, it's also just on my github. So if you go to a github john who slash buzz Is this one? Uh Escape to cap stock. No, actually, uh, that's another good point Uh, oh, you can't see notifications in the top. Sorry the notification looks like this It's just in the top right corner. You can also customize how it looks and just uses the The default notification demon. So usually that's notified osd But yeah, this is all the buzz does is it is either an icon like this Or an icon like that to show that you are you have email and it shows you a notification using whatever notification system That's currently set up on your machine. Usually this one that comes with every desktop environment um Yeah, so sorry david so Uh, I have not mapped escape to caps lock Uh, I have mapped caps lock to control So if I press caps lock that is really control and it has just changed my life because it means that control j for escape is caps lock j Which is just perfect home row Um new tab control t also just perfect home row basically Um control c just there's so many things to do with control and having that on your little finger is just really handy So I've actually been happier having that about to control than to escape um Tinkering with vim and tooling can be a deep rabbit hole. Oh, that's definitely true That is definitely true that you can spend a lot of time What I did with vim is basically I started out with a fairly basic setup and then over the years As I found more things that I would enjoy having I've added that to my config But it's true that you can spend a lot of time on doing it But at the same time you often end up with a really nice working environment like I spend most of my days In vim or in my terminal and so optimizing that Actually has major implications on like my life Right, uh, and so it's actually worth it Uh No more questions about that. I think all right Um, yeah, so our less most of you are probably aware if you've been using rust for a while if not, it's basically a um A tool that integrates with the rust compiler that runs Usually it's run by your editor and runs in the background integrates with the compiler and gives your editor information about Especially about types, but in general it gives you it gives the editor information about your code base So you can do things like pull up the documentation for the current function look up the list of arguments and their types Look up the type of the thing that's currently under the cursor look up the Go to the definition of a function that you're currently implementing It's just a really nice tool for Having your integrate into having your editor integrate with the language It uses the language client protocol, which is supposed to which is supported by most editors at this at this point Some of them just through an extension But if you haven't installed installed rls, I highly recommend you do it's pretty straightforward now if you're using rust up You just add these components And then there are instructions here for how to integrate it with varied kind of editors if you look at Neo vim I think they even explicitly have an example for the rls Somewhere yeah here Right, so the example configuration is server commands for rust run rust up run stable rls That's basically all you need and then it just works rls Does have to it does compile your code in the background as you're typing and so that can cause some more strain on system resources Um But it's usually not that bad So it uses incremental compilation and because it integrates with the compiler. It usually doesn't do much more work than is necessary Um, but for if you're working on very large projects, you may want to turn it off at least for the time being It has gotten a lot better but uh, for example, I have one project I'm working on that's like a 50 000 line code base and Running rls on that all the time is not always great It depends a little bit what files you change um, I also have a bunch of cargo extensions installed so If you type cargo install there and then there are a bunch of different cargo utilities like The one that most of you have probably heard about is is rust format. So that installs a tool called cargo dash format The way this works is just The cargo tool if you type like foobar here, what that really does is it looks on your system for a binary called cargo dash foobar and then runs it Um, and so cargo dash format for example integrates with rust format So you could type cargo cargo format to format your current um cargo project But there are a lot of other neat cargo extensions or cargo Utilities that I have installed The first one of them is cargo outdated. So cargo outdated Uh, what will you be building today? So today, I'm actually not building anything. Um, today I'm just going through my desktop and editor setup Um, because we're still trying to figure out what the next thing we build should be Um, but I've gotten so many questions about what my setup is that I figured I'd do a stream on it But if you have questions and feel free to fire away and I'll try to answer them as we go Even if they're not about my setup, but about raster coding in general Uh, so cargo outdated is a really nice tool that you can run and it will tell you So here's an example. Uh, it will tell you for each of your dependencies What is the latest upstream version or released version that is compatible with the one you've listed in your cargo tumble And what is the actual latest version of that project? That you that might be a major version bump But something something you would have to do some manual Work to upgrade to and it does so even for transitive dependencies. So this is a really nice way to get an overview of Um, are there dependencies that you should be updating but haven't so for example if we go to uh Yes, we go to tokyo Actually tokyo is set up a little bit weirdly. Let's go to Tokyo suekeeper, why not? So if we run cargo outdated here What it does is essentially sort of compile to your crate and then looks at all the dependencies And sees which of them are out of date. So we'll see what this comes up with There'll probably be some things throughout dated I'll just yeah here Uh, so here that's a lot of things in fact So you can see bytes order for example Is not up to date Failure is not up to date although most of these things you'll notice are only minor updates Uh, so if I do a cargo update And then when cargo outdated again now nothing is out of date So that what this really means is my cargo tumble is fine Like there haven't been any major releases than any of these but my cargo.lock was set to older versions Uh, some ideas for github bot audits prs so far. I came up with about 20 features that audits, uh, rust pr specifically you mean Oh for like repositories in general You could probably do that The part of the problem with github bots is that they're a little bit hard to discover But it might just be fine Do I have thoughts on x11 versus wayland? Yeah, I really want to switch to wayland actually, um, but there are a bunch of things that are preventing me from doing so so the, um The login manager I use does not support wayland yet, uh, and I quite like it Firefox only has sort of partial wayland support. I haven't found a good, um A good window manager for wayland yet There's this thing called way cooler Uh, which is also a tiling window manager written in rust Um That is for wayland, but it seems to not have seen updates for a while It may have gotten better. Um, it's just like I don't think wayland is quite like I don't think the Applications and the environments for wayland are quite there yet. Uh, but then again, we won't get anywhere if no one uses it. Um But so I want to I just haven't yet Uh, I think I saw sway at some point Yeah, I mean this seems pretty similar to They all Oh, they also maintain ws roots. That's pretty cool Yeah, I mean, uh, I I look at wayland every now and again. I subscribe for example to the the firefox Um bug tracker for the wayland issue and it still hasn't been resolved because there's so many sub issues Um, it's a little annoying Uh, what else? Does cargo outdated work with windows? It should Uh in theory, you should just be able to run like cargo install cargo outdated Does that not work for you? Um, oh, yeah, any of them works great with rust. I've had no issues with that really. Um Sways about releasing new major version. It seems nice Uh, yeah Ask you about lock and login with xmonad Uh, so for locking in fact, I can just show you my um xmonad config So let's look at some haskell code. Um, so for the key bindings for xmonad I have a bunch of things set up the most important one for that is I have uh So mod 4 is the windows key plus l is lock I'm using s lock. I don't think it matters terribly much what screen locker use I've been pretty happy with s lock. All it really does is it blanks your screen entirely um And then if you type the screen turns blue If you press enter and the password is incorrect It turns red and then it stays red until you unlock So this means that if you can visually tell if someone tried to unlock your computer while you were away from it This hasn't happened to me yet, but it's a feature that the system has so I've been pretty happy with that. Um For login I use uh s ddm this thing And I've actually been really happy with it. It looks quite pretty. Um, it works even with multi monitor Um, just like overall pretty pretty nice and it integrates nicely with system d um Yeah, I mean I wish there was something simpler like ideally I want something that Just like has minimal configuration Which sdm does not do like it uses qt. It has a bunch of dependencies But it works pretty well. Uh, it also now supports wayland although the I think the support is still somewhat finicky But I works pretty well I just ran cargo and still cargo out there and it came up with that issue Yeah, that seems weird. I think uh, you should probably You should probably report that upstream. That seems like a bug It's a project that rewrites. Can you use this in rust? Oh, yeah, I've seen that. Um Don't remember what it's called at the moment, but that is really neat. The other thing that is kind of cool is, uh A rust gimli So gimli is a parser for debug info for files. What's particularly cool is there's also added to line So I was part of writing the implementation for this and it's really neat It's basically a re-implementation of added to line from bin utils Uh, that is written in rust and is faster and also kind of nicer Um, so that's also a fun thing to look at if you're interested about those kind of things. Uh Redox the rust operating system is also really neat I don't know how far they've gotten at this point. That's a good question Um I think you can like boot it on a decent amount of hardware. I don't know that it I don't know that there's a good reason to except that it's kind of fun Um Includes common unix commands Kind of neat. Maybe I'll try it sometime like There's just such a high barrier to like using a different operating system that Especially using a new operating system, but it could be pretty cool I think at this point they've gotten pretty far Um What distro to use I use arch Linux. Sorry. Yeah, I know you're right. I did not mention this I've used arch for Many many many years and I'm a huge fan I really like the fact that it's rolling release. Um that I basically always have up-to-date versions of things It doesn't mean that every now and again something breaks, but it's actually really rare I rarely have any problems with this. I run it on servers too without any issue If you're you running some kind of like serious production system, you probably shouldn't do it But for anything that I run, I've been really happy with it Part of what I like about it is the a u r the user repository has packages for Basically everything you can imagine and it's just really easy to write your own packages. So Packages If we take some silly one like, um, let's see an example Like oh, yeah, that's right. I wrote the package for rust up. I forgot about that Um, so you write a file. There's just a basically a bash file where you declare various things There's a build function that where you build the thing and there's a package where you You pick which file should be included in the final package And that's all there is to writing a package in in arch and it's just so easy to get started with It's so easy to just package random things where normally you're just like downloaded and extracted somewhere You might as well just write a package around it and then you get all the niceties of it being managed by the package manager Um, I've just been really happy with arch. I've had I have no complaints um You're on nightly I'm also on nightly cargo. I did it should compile just fine I would say, uh I would say file an issue You could try doing um, oh, this is something that a lot of people actually don't know uh, so Say that you want to run some cargo command like install cargo outdated And you default to nightly if you want to run with stable you can just do this That will tell rust up to use the stable version of cargo for this particular command So you could try running that and see if uh, that works out Uh, you can put redox on a vm. That's true. That's also really neat Uh Oh, yeah pacman is fantastic. I like I also just love the name so pacman is the the arch package manager um I use uh, I use a you air a you are a man now, which is a wrapper around pacman That also integrates with a you are which is really nice Uh, it's one of those things where you you really should know how the packaging system works and how the a you are works Before you start using a an a you are a package manager because there are a lot of risks involved in just like building random code that other people upload But a you are a you are man is Pretty good about warning you when things are wrong or when things move Things are signed and you're not trusting the key. I've just been really happy with it So Arch is one of those things where you should install it if your goal is to learn linux If you just want to run linux because it's convenient for many other things Arch is probably not the right choice for you like you should just go with the buntu and be happy or Like one of the like linux mint or something like that That's just built to be really user friendly Arch is great because it forces you to learn linux things Like they just drop you into a terminal and you have to install the system yourself And I think that's fantastic, but it does require that you're willing to learn Let's see where were you so that was cargo outdated. Uh, the other one is cargo tree, which is sort of similar Um, it tells you for each for for the current package all of the dependencies the dependencies dependencies Etc. The stars are packages that are listed more than once And you can also like show additional features. It is a nice way to to, uh List all the dependencies, but the crucial feature that I use it for is this inverted tree So you can do dash i which lists for each dependency why it's there So let's go to this large project I have so here if I run What is the Cargo tree I'd have cargo tree on this machine Yeah, so dash i will take each dependency and list where it comes from Which is really useful for detecting if you have Multiple instances of the same dependency, but with different versions You can see why the different versions are installed, right? It might tell you the like you have zero two four because of postgres and you have zero two three because of some outdated version of Serdi and now you know that you should probably bump one of them and that could get rid of an entire dependency from your compilation process which speeds up dependencies a lot. Um There's a flag for also only including things through duplicates. I've been really really happy with that Uh, this has been fixed on latest nightly. I should run rust up um How'd you get started with tokyo? so I work on a So i'm a grad student at mit I do research on distributed systems and systems in general and i'm working on a A new type of database and When building this database One of the things we're doing is we need to do a lot of a i o And we need to do it really efficiently and we used to have just lots of threads spinning around but it turns out that You really at some point you just don't want to spin up that many threads as we had a thread pool that we built ourselves That like multiplex connections and used e-poll Uh, but then you get to the point where like you want to make sure that you don't accidentally block some Some part of your execution and it was sort of natural to move to the world of async i o at which point Tokyo is the obvious contender in rust space. Um, and so it actually started out with me writing What do I call it? myo pool um, which is sort of a Basically, it's starting to do async i o But without using any of the tokyo stuff and then at some point we realized we should just use tokyo So i've chatted a lot to carletcha the the maintainer car lurk I don't know how to pronounce his name either Yeah, carl lurk it I don't know how to pronounce his name. Anyway, uh, I chatted a lot to him about the fact that we have this large project We want to work on They've been interested in using that as a benchmark for tokyo as well And so that's just gotten me more and more involved with tokyo because When we've been running this large pieces after using tokyo, we've also we've also discovered bugs performance regressions Places where tokyo adds a bunch of overhead especially when you get to very large deployments And so we've started debugging some of those and improving tokyo from the inside And once you start getting familiar with sort of the guts of something It's really easy to then start making changes as we go, right? And so it's been just a really fruitful relationship between The team working on this new database and the tokyo team Cargo plus stable fails with the same. Yeah, that's definitely an issue It took me about an hour the first time I installed arch. Yeah, that sounds about right Although the installation guide the beginner's installation guide is actually pretty helpful now I think the biggest issue it has is there are a bunch of places where it goes Now you should install time synchronization Here are 14 different ways you could do that arch really doesn't want to Choose which one they're going to recommend so they just tell you about all of them And I don't think that's always the right strategy, but I just wrote a very simple proxy server in tokyo. Yeah, tokyo is getting really nice. Um, tokyo at this point is It's just It's just great. It's just great. It's also pretty easy to work with. Um For those of you who are new to tokyo or to futures, I recommend looking at some of the earlier streams There's a lot of subtlety in dealing with tokyo, but it it Does work really nice when it works, especially now that there's support for this experimental support for async await So, uh, Carl just released, uh, tokyo async await So this thing Which is a preview of how async and await are going to work with tokyo. It integrates quite nicely Uh, I think that's going to help a lot if you remember back to our EC2 streams in the EC2 streams are a bunch of cases where we move things to be asynchronous and then there were just like nested function upon nested function upon nested functions of and thens Async await is going to make all that so much nicer and that's pretty exciting Uh, let's see. So the thing I wanted to show here was you can do cargo tree dash d Which is duplicate. So it shows only dependencies that are where there are multiple versions Uh, and in the inverse. So if I run this, I don't probably take a little while, but we'll let that run Uh, I like how you can just combine everything and compose and stuff. Oh in tokyo Yeah, so tokyo's and I think this is in big part because of Carl is really set up to Deal with combinators. Um, and that makes it a very modular thing to work with and that's really nice Like you can take some futures that come from this library and some futures come from this library And you can just combine them. That's also because that's how futures were designed So big props there as well Nice videos on arch installations. Oh, yeah, I believe it I'm following your previous streams. It just takes practice to get it. That's definitely true I think uh futures in tokyo in particular is one of those things where there are a lot of subtle details on exactly how it's implemented and how it works and It takes a little while just to Get into the mental model of how futures execute because it's sort of weird, right? Like your program no longer really executes top to bottom You have to think of them in in terms of There is this event loop somewhere that's like pulling all of the futures are running at a given point in time And I think one of the things if you want to challenge yourself Futures If you want to challenge yourself You should I think it's here somewhere Uh do some digging This combinator is fairly complicated. Although the api provides is really simple You give it a bunch of futures And it will pull all of them and when you pull it, it will tell you that one of them finished If you're you should read the source code for this particular combinator And it will tell you a lot about how futures are executed how they're scheduled Uh, and it's pretty neat. Uh, there's also a stream version here that I ported a while ago But I recommend if you want to challenge for yourself and like understanding how tokyo futures work take a look at this one It's a good Thought or brain exercise Uh, so future is 0.2. I think you should basically basically ignore Because 0.1 is the thing that's supported by tokyo So it's basically what you'll find everywhere 0 2 is backwards compatible sort of like it forward exports the The interfaces and 0.3 is the one that's going to be integrated with Uh, the russ standard library and so that's actually the one that everyone will move to so 0.2 is basically not going to be used Uh, the move to tokyo 0.1 though is something that had a lot of impact and something that Does require a bunch of crates to change. Um, we haven't We've done anything. Yeah, we've done something on tokyo 0.1. It's much nicer to work with I don't think there's any reason to to deal with the old tokyo core stuff anymore, especially now that hyper is moved along um As a reason for the way the tokyo is set up as opposed To the event loop of j s I'm not entirely sure I understand the question uh so Java the javascript event loop Is a little bit special in that the language doesn't have threads like Everything is implicitly asynchronous and that changes the like that's a language feature Uh saying that only one thing will execute at once in uh in rust that is not the case right like they don't want to change the Rust language tokyo is just a library and that's part of the reason why they have this notion of executors and futures Because all of the asynchronous stuff has to be explicitly asynchronous as opposed to just everything implicitly being asynchronous The way it is in javascript Uh All right, so here is this place where we ran cargo tree dash d Uh notice that this project has a lot of dependencies, but crucially here Uh look at this for example, so cross beam dq we depend on version 0.2 because of rayon 102 and then we depend on Cross beam dq 0 3 because of tokyo thread pool And so this means that ideally we'd want rayon to bump their dependency across beam dq And that way we'd only need to compile one instance of it rather than two um similarly there are a bunch of others for memcar proc macros And quote which is for the same reason and so this is one way that you can look through your projects Here's the bump from, uh, ran zero four to ran zero five um This is a great way to try to prune out unnecessary dependencies from your projects Or even just to figure out like if you want to write, uh, pull requests for existing projects One way to do that is if you detect that they're using an old version of a dependency You could bump that dependency's major version and implement the necessary changes which are usually fairly few Um and sort of do the ecosystem a great favor um The way you work with the event open javascript is through callbacks That is the case in tokyo 2 right so in in tokyo or in futures, I should really say um In futures you work through futures and on futures you have all these So here when you're working with future You have a bunch of things and in particular you have and then right so and then is Do this thing and then when it resolves do this other thing Which is basically like a callback. You're saying Call this closure when this future resolves Right and this is this is not something that immediately resolves like this is a Promise if you will in javascript land that eventually it will become the value that came out of here Uh, so in that sense they're actually pretty similar um Which there was a tool that translated code to pleasant music you can actually interpret while shopping and understand the code So then I thought I had that thought a long time ago of trying to write something that takes um Asking text and produces music it it's just really hard to make it sound good If a crate uses nightly only features can you still use that crate on stable? uh I believe so I believe you can Compile the tool using stable and still use it to interpret nightly packages It basically what cargo tree and cargo outdated both do is they sort of link with cargo So they basically have they integrate with cargo and use cargo to extract that information And cargo of course can operate on stable or nightly packages. So it should work fine Is there a way to discover unused tables and columns in postgres? Uh What do you mean unused tables and columns there are ways you can inspect the entire schema Uh, like if you do backslash Dt it lists all the tables for example Um, but that seems somewhat unrelated to all of this Uh cargo read me is another really useful extension to cargo. Um, so I use this for most of my crates actually so let's look at minion Uh, which we wrote a while ago um So if you look at source lib Remember how we wrote a bunch of documentation for the crate in the source lib and it's really annoying to replicate all of this code In a read me file, right if I had to rewrite all of that and read me just Just annoying and it's also error prone and in particular because often You want some example code like this read me has example code And I want to make sure that if I change the library this example's code remains valid So I really want it to be a doc test Um, the way you do that is using cargo read me. So what cargo read me does is you create this read me dot template file Um, and that has it basically is markdown But it has a couple of special keywords like read me which gets filled in with the parse documentation output of your source crate So read me here gets replaced when you run cargo read me This read me gets replaced with the markdown parsed version of what's in source lib So if I change this code and then run cargo read me my Read me file will be updated and this basically guarantees that the code that's here will also Always compile because it's run as a doc test because it's really in source lib So I've been really really happy with this one. Um I use cargo read me a lot for basically every project The one thing that's a little bit sad about it is you have to remember to run this command anytime you change source lib and That's surprisingly hard to remember But something that's uh, that's worth doing And the final cargo plugin I've used is cargo bench compare now. This is something that might change a lot in not too long because the way the so in in rust you can have On nightly you can write benchmarks directly as unit tests Uh, which is just really handy for especially if you're doing smaller smaller benchmarks. Um, and what cargo bench compare does is You run cargo bench on the old version of your code Then you run cargo bench after you make some performance improvement And then you give both of the output files to cargo bench compare and it gives you a table like this Image of like, uh, this is the Uh, performance of it before the change. This is the performance after the change for each bench each benchmark And here's how much the results changed And so it's just a really nice way to side by side compare How big is the improvement that you measured in terms of your cargo benchmark results? Um, Yeah, it's just a really nice tool for seeing whether changes actually make a difference. Uh, so I use this for example for, uh Search Yeah, so here for example, this is a An optimized version of doing, uh, Search for the largest value that is less than a given value in a list Um, and this is comparing it to searching with binary search in the sorted vector and comparing it to a btree set. Um And it shows you like for each of these different benchmarks. What is the speed up or slow down? This is a handy tool to have in your toolbox um Futures makes more sense to me now new question. What's the difference between then and and then? um I mean I can show you but the uh In basically the difference between then and and then is and then is You can think of this in terms of a result As well as very similar. So And then is map But the asynchronous version it is if this thing resolved to okay Then map the okay value into some other future Um, then is once this future has resolved give me the result and I will give you a future Uh, this might be clear if we look at the signatures Uh So then and then both take a function. They both return something. That's a future but look at the signature of the function Uh, then is given a result That is the item or the error of the resolved future And then just takes an item So and then is if it resolved correctly call disclosure as an if it resolved with item instead of error Then is when it resolved give me what it resolved into and both of them return a future that you should then continue processing So if the thing you've got was an error and then would not be called but then would Uh This might be an issue with some cargo tools for windows cargo tree also failed to install Oh, that's interesting huh It almost sounds like cargo doesn't build No, it's very weird. I don't know what to tell you Uh All right, I think the last thing I sort of had planned although there may be other things you're curious about Um is this uh browser window that I have set up. So they're actually Firefox multi-account containers. I should also talk about Um, the first thing is I'm running firefox. I'm running firefox developer edition Which is sort of like firefox nightly except it's not quite nightly. It's like a little bit more than beta. It's just weird in between It's kind of nice. I like it But normally in firefox the taps are at the top And I like having my taps at the bottom It doesn't matter too much in this particular setup that I have right now because I have a normal like Like a landscape setup, but at work I have a I have my monitor standing so in portrait mode Because it's much nicer when you're reading large pieces of code or some long blog post or something Which is most of what I spend my time doing. Um, should arguably do it here too, but I currently haven't And then the top of your screen is actually really far up So you'd be sitting like this all the time to look at your tabs Whereas the bottom is just like really easy to look at and so I wanted to move my taps to the bottom But that's something that hasn't been supported since like way earlier firefox versions before they changed the whole plugin system But the cool thing about firefox is the entire UI can be styled with css So this is file called user chrome css in firefox This file it's in your profile directory And it basically lets you change Or apply css to the browser chrome itself And so what this does is it basically this file file that I wrote It just reorders the UI so that the entire tab bar ends up at the bottom Mostly it works pretty well. There's some things that are kind of weird like menus sometimes still go down Although these are now currently all going up, but sometimes they go down Because why not? And then they sort of disappear through the bottom of your screen and that's a little bit sad the same thing this the url thing Notice how it's supposed if it's at the top it sort of falls down naturally from the url bar here. I've had to basically Set it to be in the middle of the screens if you look here The pop up auto complete is set to just like Roughly here on the screen to just start there So if I start typing something Notice it starts up here and then sort of ends somewhere down here depending on how many results there are Because you can't There isn't an easy way to reorder it to have it flow bottom to top So that's like one of the things that's a little bit sad about this setup But apart from that, I've been pretty happy with it. Um, it's something that I think I'm one of the few people who wants my tabs on the bottom, but it's kind of neat um The other thing I have some of you may have noticed this work thing here, um, is using something called farfox multi account containers that are fantastic. They were added as a sort of prototype feature that never quite made it into a browser, but it's now a separate extension I don't know whether it's really being maintained anymore. It's just really nice Basically what it does is it gives you multiple browser sessions in a single browser window Um, so down here, um, I have multiple different tabs Or sorry multiple different containers and the different containers have completely segregated local storage caches Like cookies everything is just segregated between them. So, uh, for example, I have github open in my work container but if I were to open like, uh amazon.com It will open in my shopping container The reason for this is if something if like someone Hacks amazon and puts something that seals my cookies or whatever on here They wouldn't be able to get at my github stuff Similarly, normally I browse outside of any container, which is also sort of a separate container so if I go to like reddit or something or like Some site where there's likely to be lots of crap Then if they try to seal my cookies, they also can't get to my github cookies and they can't get to my amazon cookies They're all entirely segregated. So it's a nice way to just like partition your entire Like online life so that the your it's compartmentalizing your secrets, right? So I've been really happy with that Let's see. I think that's all I wanted to cover Oh, here's another thing I get a bunch of questions for so my uh, my terminal My terminal setup. So my terminal greeting is kind of funky. Um So it's not all that fancy like it just runs a bunch of bash commands But people are pretty curious about it. It basically here just runs like uname uptime hostname It runs the df command. So df will list how much space is available on various disks Um, similarly, it runs ip adder to give me all the ip addresses for the current machine These are just things that are nice to have at a glance when you open a new terminal because you may or may not find them useful um, and then I also just manage my to dos directly in my In my fish greeting And what I've set it up to do is I have sort of like multiple different categories of things in different colors And the lower priority categories are shown Randomly less often. So if I open a new terminal, it will always show the things that are red So they are urgent It will show the things that are yellow half the time things that are green A quarter of the time and things that are like cyan Much left often. So if you see I open a bunch of them Most of the time is just red. Sometimes it shows more Let's see if we can get it to show the cyan ones And this is just because some things matter a lot. There we go Right. So this shows this now also shows those It's just a nice way to manage your to-do list It's like it's not synchronized anywhere, but it's just really nice if I have So for this database project, for example I have a bunch of things I know I need to do and I get to I can just prioritize them here And I'll be reminded of them sort of at appropriate intervals of when I should be thinking about them So that's worked pretty well um Now of course are just set to bogus things um What else is there I don't think any of this is particularly relevant Oh auto jump. Yeah auto jump So for those of you who don't know about auto jump, I only found out about it like a few months ago auto jump is fantastic so auto jump is uh It's usually just a command j And it's basically a really efficient cd So what it does is whenever you cd into a directory to remember that you've cd into it And then it gives you fuzzy jump to So here now i'm in the root of my project if I want to go to remember went to minion earlier I can just do j minion And it will go to the appropriate directory Right If I if I cd back Let's say I jump to Tokyo so it goes to tokyo zookeeper. Let's say I actually meant the real tokyo I'll just jump tokyo again and then it goes to some other thing that also completes tokyo And over time it learns what directories you have gone to most frequently when you search for a given thing and it will Start to go to that one instead first There are also some other variations like jc to jump to a child j o to open A bunch of these kind of things, but this is just like so efficient if you're moving around a lot on the command line It's a great way to move around efficiently There's so much useful information i'm glad uh, yes, I will So I will upload YouTube is a little bit weird because youtube live records the video But then doesn't look you edit it in various weird ways So I will upload the recording that I Have I think i'm recording yeah Uh I will upload the recording of this to youtube as well and i'll tweet out the link and everything So all of this will be online and then i'll try to categorize i'll try to in the description put Links to the various points in time where I start discussing different things Uh, so it should all be online Um, if you're dealing with dialogue windows and xmonad they go full screen. Oh, yeah This is one of the reasons why tiling window managers are a pain um You basically need this thing So you need a manage hook and you write it to match on different types of windows and set them to be floating as appropriate. So for example, um, I think the one that's like most important Is you need to set Ah, which one is it? Oh, maybe it's Maybe I don't have a binding for this anymore Certainly one of the things that's important to use and this took me a long time to realize Is you need to use desktop config as the base xmonad setup because otherwise like events don't work and um Integration with poly bar doesn't work and windows spawn in weird places. You need to make sure you do that. Um, and then you set up a Uh manage hook I thought I match on dialogues here Certainly, I match on the gtg file chooser because I want that to be full screen I think the other thing is like uh Make sure that I think desktop window is the one In any case you you just like find the appropriate thing to match on and you set it to be float. Um The way to figure out what a given window is is you use, uh Ech. Ooh, do I not have it here? Is it x event? That's like, uh I think is this one What is the name of it? It's like one of the x tools that lets you Click a window and get information about it. I thought it was xcb, but Maybe it's not x tools Oh, that's sort of an helpful I thought it was xorg utils Maybe I'm wrong xorg utils What? That's really strange Well, it's one of them Uh I think it's x win info Where you just like run the command and you click a window and it will tell you like So notice here. I'm matching on the class name of the window or the resource Or one of the string properties. So you would just for the dialogue that you're having problems with um, you would just use x win info whatever the thing is Look at the properties for that window find a thing to match against Put it in the list of rules for your mana choke and set it to be do float And that should resolve your issues Uh I'm running a tokyo version of the beanstalk. Oh, yeah, I saw that on Oh, are you the person who's writing on discord? um And if only the tokyo zookeeper streams or another steamer recommend to have a look at some more background on working with tokyo That's a good question. Let's take a look um Rose live coding so The zookeeper ones I think are probably the best ones for working with modern tokyo stuff uh The asynchronous h1 is like fairly advanced async and tokyo stuff in part because we're working with an existing crate And then trying to wrap things around it And that crate was written a while ago and hasn't been updated So that was a bit of a pain, but I think that gives you a very deep dive into tokyo and async stuff um Yeah, I would say the zookeeper ones are the best in part because they also deal with things like parsing network protocols and such Which you'll have to do with beanstalk um It might be that we want to do a less advanced tokyo thing Um Just because I've gotten this question before so if any of you have ideas for something you'd like to see us build in tokyo um Like some kind of protocol that's less advanced than zookeeper Um that we could use to sort of an intro to futures in tokyo Uh shoot me like a twitter message or something afterwards Um, I don't have x prop x prop is the name of it Nice see this is why it's great to have uh Other people watching Yeah xorg x prop That's the one I want So x prop You it gives you a cross there you click a window and it gives you information about the window That's the one I was after Uh, but yeah, if you have ideas for things we should cover in tokyo or futures Just like send me something on twitter uh to remind me and then i'll try to Do that at some point. I have this major conference deadline coming up for um For this conference and so When is the next deadline participate call for papers? So we have a paper that got accepted but Here so september 27th until then I will be very busy But I will try to maybe do another stream before then and it would be really cool to do a more basic tokyo and futures space stream um What keyboard am I using I am using the filco majesto touch ninja. It's really cool Use a file manager used to everything on the command line. I just do everything on the command line um There is one exception to this which is I have installed a program called mirage. So mirage is like a I use it just for directories that have a bunch of photos Um Then I will open it with mirage because it gives me previews of the photos Which is the one thing I don't really get in the terminal, but apart from that. I just use um I just use uh the command line for everything It's very rare that I actually need to like look at the icons for files in part because um Exo is pretty good about this like it highlights different file types in different colors as well. So usually there's no need Uh, what a shame Oh as Bank keyboard like a youtube command. That's weird How do you come up with an idea for a new tool or project? Sorry, I'm just like working my way through the backlog. Uh, do you come up with a An idea for a new tool or project? So usually it's actually based on a need that I have Um, so if you have some larger project you're working on A lot of the time you just like discover that you need to solve the sub problem And you're like I should just write that as a library. I think this is something more people should do is take Small parts of their current projects and make them into libraries that might be useful to other people So if you look at, uh The various repositories that I have most of them have come up because I've been using them for something else Right like arc c-string for example is like a reference count atomically reference counted string type For c-like strings and I just like needed that in a project I could have just like implemented directly in my project But instead I was like let's release that as a library And I think that's the way the ecosystem grows and that also lets you build a lot more interesting things Uh, and it means that you end up with a list of crates that just like Grows very quickly to having lots of things implemented. Uh, so that's kind of cool Sometimes you just look at things that are interesting like here. I implemented the the mysql binary protocol So you can write a rust server that looks like it's mysql Um, and that was more like that seemed like fun. So I did it Uh, sometimes I think this is one of the things that easily happens is uh, you sort of get nerd sniped And uh, it's fantastic. I love when someone presents me with something that's interesting and I just have to do it I spoke for the win. Yeah, indeed You can get previous with ranger and fed. Yeah, so I have used fail bunch. Um, I used geeky for a while. I was pretty happy with that, but mirage works pretty well Uh, where does the zookeeper crate fit in? So the zookeeper crate fits in because for One of the things I've been doing for this database is as I mentioned, we've moved a lot more to async.io And one of the things that's still synchronous in here is talking to zookeeper because we've been using the rust zookeeper crate which is synchronous, but It's sort of weird to have a code base where some things are synchronous and some things are asynchronous And so I wanted the the zookeeper integration to also move to be asynchronous So it integrates more nicely with the rest of the code base But there is no async on the zookeeper Bindings and so I had to implement async zookeeper Uh I use a file manager to see pdf thumbnails I never actually need the thumbnails for a pdf. I usually just need the name of the file But for opening one I use mute pdf, uh, which I've been also really happy with so do I have a paper here that's useful? Uh Oh, I don't have any papers here Uh, these are all pretty uninteresting, but Sure, oops. Oh, apparently I have not even set up my pdf binding on this machine Well, I definitely did not want to open it in gip Uh xdgd default New pdf application slash pdf That's weird I don't think you have mute pdf installed That's strange. Oh, I'll set this up later, but um, I guess I can just So mute pdf is a very straightforward pdf reader But it has all the things you need like it has full screen You can rotate documents if you need to There's like fit to width fit to height fit to window This is like a really nice and simple pdf viewer um Another one here, how do you come up with? For the large project itself so large coming up with ideas for large projects, it's like It's on kind of issue. This is so I'm doing a phd and when you're doing a phd You sort of need to find a large project, but it's one of those things where You just need to set a lofty goal, right of here's something that doesn't exist that I feel like should exist And then you realize that's a fairly big task and while working on it The thing you're building just becomes larger and larger and larger to try to tackle that problem um In general like It is much better if the thing you're working on is Goal driven like especially if there's some need that you have that you feel is not being satisfied Then you should build something that addresses the need that you have because you'll be more excited to work on it as well um Interested in too many things I start one project find another one more interesting and swap Yeah, I do the same thing all the time It's part of the reason why I have so many uh repositories to this point uh Although I try I try to maintain all of them, but most of the things I write I try to write them in such a way that they end up in a usable In like a usable form so that I don't really need to do that much maintenance on this Most of the things I start I try to not start things that are large I try to only start things that are small and only have one or maybe two large things at once Because you just don't have enough resources to handle lots of large things where small things you can finish Um, and then the second thing is make sure you document them well because that way they sort of live on their own So every now and again, I'll find that there's a pull request for something I wrote a while ago like for um stream cancel There's another thing I wrote as a library For something I needed in this large crate and I could have just implemented directly But instead I chose to publish it and then suddenly someone submitted a pull request and was like hey, this panic's unnecessarily I was like, well, okay, great now. That's fixed um And so as long as you make sure to uh to document both your code and the uh and the implementation well You don't really need to do that much maintenance and it's actually possible to finish Uh What switch are you using with your keyboard? Uh, well, so that's a good question. I think it always comes with browns But I could be wrong fairly short browns, but Majesto touch um For some reason I get a memory management Bzood whenever I use google chrome That seems unfortunate. That seems like something you should fix. Uh, but yeah, it's Zathura, what is Zathura? Oh, maybe it's red switches actually I don't know. I don't know. I haven't looked at it in a while Zathura Github A document viewer. Oh, yeah. I used this a while ago. I don't remember why I stopped using it But mood pdf is just really nice. It's very simple Um, uh, yeah, there's definitely there's a bump. They're not they're not continuous I really like these Wish there was a way to monetize personal open source projects Yeah, um, I wish there was too So this is something that is really hard in the open source community is to try to get paid by companies for open source projects although what I've heard is that um A bunch of people working for companies want to do this the problem is they can't do donations on behalf of the company They have to actually be paying for something in order to get it reimbursed And so, um, I know that what a lot of people do is they set up or some open source projects do is they set up some like Advanced version that doesn't really give you anything meaningful extra like it's not something anyone ever would ever want But it means that companies can buy your open source project and pay for it If they want to give you money, but in general they can't give you money just as donations I don't know to what extent this is true for companies in general But I know that there are certainly instances where the company just has to have some excuse to pay you and then it's fine You can also do this for support. So for example This is something I think Mike Perham has done pretty well for So he's building this new thing called factory So Factory is basically a Replacement for sidekick. It's a job management server. I wrote the rust bindings for this It's entirely open source, but he wants to write a Essentially make a pro version of it too that you can buy and everything works in the non pro version But the pro version has some additional like support and some additional enterprise features And so that's one good way But of course that requires a much more work and now do you want to devote that much effort into your open source projects? it's unclear The patreon for me is like it's on I don't really do it for the money. It's more I think it's I think it's a good way to showcase the work But I agree it would be really nice if there was some way for companies to like show that they're using something Uh Oh, yeah, I don't know why the key gaps are so important. Where is my Thing I have a thing Give me a second Let's see. Let's answer this question once overall All right control key come here. They are browns It has been answered they're browns Uh, do you have a set up for writing papers in the oven? Uh, I don't know what you mean about setup, but I write all my papers in them I usually write them in latex And so it's a source code anyway um I do have some things set up for it though so Uh in particular Where is it? Uh, where is it? Where's the ale set up for? So this is really cool python tool. It looks like I haven't set it up on this machine, which is a little bit sad Uh, apparently not So this is a python tool called What is it pros lint? I think it's the name of it So pros lint is really cool It is a command line utility That also integrates with ale for example To give you grammar suggestions while you type And you have that and a spell checker and you get really far like you can write papers in the tech In vim without any problems It depends how visual you are like In general, I want the tech to deal with all the layout for me. And so I don't actually micro optimize too much But if you need the visuals, then of course, it's not great for you um Goyo What is Goyo? Oh, this is the thing that just like erases everything around it I don't find that so remember my setup if I'm in vim Is this and so it's already distraction free editing like I don't know what more it gives me um Vim techs, what is vim tech? I'm sure there there are things that like make it easier to manage Uh writing latex files. I just like haven't really had a problem with it like Generally if I'm writing in the tech I'm writing text and so It's not like I'm writing a lot of fancy latex. I'm just writing text and that's basically sufficient I guess better syntax highlighting might be nice, but I just haven't found it to be that much of a problem um Latex run is really nice. It's actually written by someone who used to be in my lab at mit I usually still just end up writing a make file, but I should probably just use the tech run uh live compilation I mean maybe so um Usually I solve this a different way which is I have bound capital M to make So I have a make file that builds my paper and when I want to read the paper I just press shift M and then I just open I switch to the thing where I have the paper open or I just switch to that window press R for refresh in mu pdf And then I have the new paper So I don't actually want it to live compile. I save my files a lot And I don't want it to be compiling all the time because it's annoying So I prefer being able to tell it to compile now This is the same way. I've set up a cargo check in my rust projects I don't have it do it automatically on save instead. I have shift. I have capital l map to run the linter Um, because I don't want it to just do things every time I save In general, like I will save partway through having written a function And so I know it doesn't type check yet. Uh, so I want to finish writing the thing before I run the checker Uh Shorter lines are easier to read that is definitely true. Um, but that's why you set up text wrapping That I guess the one thing it gives you is it centers your text Uh here centered But I agree with you. Like maybe there's a Maybe there's a reason to add it in general what I've done with my vin config so far Is I try to only add things I need Uh, or that like Actually help a lot in the majority of cases where I use vim I don't add things that are like I use ones in a blue moon, right? Definitely a matter of taste, uh, have you experienced that there's way too many mappings in vim with all these plugins? Uh, no Not really. I think most of the most of the keyboard shortcuts I have I've set up myself Uh, one thing that's nice. It's sort of changed in the vim ecosystem I don't know if it's recently, but It has changed is that plugins don't generally map things anymore They give you a bunch of commands and then they tell you how to map them and what mapping they recommend So for the vim auto complete stuff, for example They never actually hijack your tab or or enter But they give you like here are the auto commands you should set up if you want it to work this way It which just means that like In general, I have all the base vim bindings are the ones that come with vim And then I have all the ones that I've defined and there are no others um nub question With regards to tokyo, how do you use the connect method on a tcp stream? How can I store the stream object which is resolved in a struct? so you mean tokyo net tcp stream So tcp stream connect gives you a future that resolves into a tcp streams if you look at this It's a future whose item is an actual tcp stream and that is the thing you'd want to store Uh, you could of course store the future, but then it's not connected yet So in general you would do connect and then you would either wait on this future to get the tcp stream Or you would run it through like a some kind of runtime Um, and then the resulting tcp stream is what you would store somewhere Any tips or suggestions on how to get a better grasp on borrowing in rust? um I mean apart from reading the rust book So So in general like I think this chapter is pretty good Um, if you feel like this is not quite enough, um Oh It's gotten longer since last time I looked at it good. Um The, uh learning rust with Way with entirely too many linked lists is also pretty good It doesn't explicitly deal with borrowing, but does it does give you some More intuition for how the memory model works. So that might also help I think the biggest way to go about this is just to write rust code and you'll develop more of an intuition for it Uh, but in general this this chapter is pretty good and a good place to start Um, yeah, you know the borrow checker is really weird. It does take a while to get used to um How can I summarize borrows in the easiest way? So you should think of owned values as Uh A value in memory like just think of owned values as just any variable Uh, if you borrow that if you borrow that value So if you borrow a variable you get a reference you can borrow things in one of two ways You can borrow them immutably or mutably if you borrow them mutably then you get a mutable reference immutably you get a Immutable or just a regular reference. You can only have a single mutable reference at a time and the compiler basically the only thing the compiler does or the borrower checker does is It ensures that you cannot have a reference to a variable that is no longer there So if the variable gets moved somewhere like it gets returned from a function It gets passed to a different function without borrowing Or it just gets dropped Or it gets moved gets moved into a closure or anything like that Then the variable is moved and so the reference isn't valid So the all the borrower checker does is make sure that if you have borrowed something You sort of give it back or you give it up before you ever get back Uh, oh lifetimes So lifetimes are actually very related So lifetimes you should think of as If you borrow something a lifetime is how long that the resulting reference is valid for So if you have a lifetime of tick a so you have some reference with lifetime tick a what that means is You know that that that reference will be valid until tick a ends in general any tick any tick a any lifetime is a Sequence of lines in your program is probably the easiest way to think about them So a tick a refers to this lives This is valid for these lines If you're generic over a tick a it means that I accept so if you have I hear let's uh One of these like so So this is a let's make that a little bit larger So what this is saying is that Oh, why is this For some reason the terminal wanted to be unhappy with me So this struct is generating over generic over some lifetime tick a What that means is If you have a foo That foo is associated with some sequence of lines in your program In this case, it is the sequence of lines named a or Uh, let's see if we make a main We do a create a new scope Sorry, let me just set this up and then Okay, so here Uh, we create an x which is a A string here. We borrow x and put it inside foo And the borrow of x starts a new lifetime. Sorry. It starts here technically Uh starts a new lifetime of a that is we're borrowing x here And that borrow of x Can only be alive for as long as x is alive If we moved x or x gets dropped then tick a is immediately terminated, right? So here if we drop x that means we're terminating tick a here But because foo still lives right foo is still here with a lifetime of tick a This is illegal the compiler looks at this and goes there's a foo with a lifetime of tick a But tick a has ended therefore the uh, the foo is invalid. It is not legal And that is why if you try to drop x here, the compiler would yell at you On the other hand if you drop f first then at this point there is no longer a foo tick a So no one is using tick a anymore And so dropping x now is fine because there is no outstanding reference to foo bar and therefore tick a can be terminated safely because no one is currently borrowing it That's sort of the most straightforward explanation. I can give of course. There are a lot more Advanced scenarios where you have like multiple lifetimes for a given thing I think you just need to write more code that uses lifetimes in order to get a handle of it Just don't be afraid of the lifetimes is the biggest thing I would say like I think A bunch of people end up giving up on lifetimes and just go I'm just going to make everything arc or everything arc mutex or something So I don't have to think about it or clone everywhere Try to force yourself to figure it out and you will develop the mental model pretty quickly The rust book felt way too wordy, but it really does explain things in the simplest way Yeah, the rust book is a little bit weird because the goal is to explain things even to people who aren't programmers And that means that they have to spend some more time. It's also because One of the reasons it's hard to teach people lifetimes is because they don't fully understand borrows and references And so The book spends a bunch of time on explaining borrows and references for a good reason And that is because people don't actually understand how they work And so they're trying to encourage you to actually read it and understand it Which requires a bunch more words, but then people don't read it because it's too much text So it's it's a hard trade off Um Lifetime explication is simpler more intuitive in the first version book for my taste Uh, sort of so I think um, I think that the first book used fewer words and that helps to some extent But it depends how comfortable you are with the concept of things like pointers from the beginning It's just like lifetimes are sort of weird and they're only going to get weirder with nll So it's a hard thing to explain Don't have a good answer for you. I think it really is one of those things where You just need to write a bunch of rust code to develop the intuition and hopefully we Hopefully we're slowly gravitating towards a good resource where people can learn about them Which is probably going to end up being the rust book one thing that's neat that they've done about the rust book recently is um, if you go to Doc rlo Slash book it brings you to this page where they have the first edition the second edition and the live edition And the live edition is one that will keep getting updated And so this is probably the one you want to monitor because here as we find better ways to explain things This is also where you'll see that um They read the source of the standard library Oh, yes reading the library the standard library is fantastic. Um I I think this is something that I have done more for rust than for any other language um One of the reasons Why this is really rewarding is what do we want to look at? I find that I do this a bunch for things like iterators where Like I want to know exactly what let's say cycle does Right, so cycle if you have an iterator and you call cycle It just means that it keeps rotating around the iterator. So when it goes to the end it goes to the beginning again Uh, so cycle and let's say I want to know how this works internally. The neat thing is you can just go Where's the source link? source You can just click source and then you actually get to the source file into the standard library that defines all of them And I can search for a cycle and then now I can search for a struct cycle Really? That's interesting Uh through super. Yeah, this is where it gets annoying. I really wish that the rust file browser had an up button So you could go to one like so you could actually browse the files and not just look at a single one um, but in general the the links from The links from the documentation directly to the source is one really good way to try to explore the standard library So with tcp stream, for example, I do this a bunch too Where you're looking at like what does read to end do click source and you get to the implementation And that's really handy I think exploring the standard library is a really really helpful way to understand how many of these things work And it's often easier to explore it just directly through the rust repositories So you go to source and then lib std down here And then here you it's pretty easy to browse to whatever thing you want to look at Like if we got a Cursor whatever and then you have the implementation of cursor all the tests. They're usually pretty well documented too So following it is not that bad Um All right, I think I think unless there are more questions that That's as far as we're going to go today um, as I mentioned I want to do some more streams on Tokyo and concurrency Probably on something slightly simpler than suekeeper because I think some people fell off just because the protocol is complicated and I'm worried that some people will think the tokyo and futures are more complicated than they really are Just because what they saw implemented was itself complicated Is that something I'd like to rectify I also have noticed that a bunch of people have watched the Linked hash map in rust video, which is sort of a more introductory level Video on implementing a data structure in rust and so we might want to do some more of that So if you have an interesting data structure that you think would be Interesting for newcomers to the language to also see like not something that's a super advanced data structure But something that is like an interesting thing like a mutex for example Ideally something that's already in the standard library so we can compare them Then let me know on twitter or patreon or something And we'll dig into that I'm hoping I'll get to do another stream in two weeks. I'm not entirely sure it depends a little bit on this this upcoming deadline But yeah, I think we'll yeah, vectdq is a good idea actually What do you mean by data frame and what do you mean by vecti? Oh as in like vector We could probably do vector vector is a little weird because vector is basically just contiguous memory Like it's it's not so much a data structure as it is a primitive But we totally could it would include a bunch of unsafe code because you need to deal with alloc But maybe that's interesting in and of itself Um vectdq is a good idea Um It's vectdq is like basically a ring buffer. I think Oh like pandas um You can probably do data frame although I think data frame is actually a fairly large thing like it's not a very complicated data structure There's just a lot of apis around it um Pin and unpin and async and await. Yeah I want to do something on that. I wanted to shake out a little bit more So there's still a lot of velocity going on there. They've like merged the The rfc, but I think it's still there's still a lot of Still a lot of motion going on and I think a lot of things may change going up exactly how the implementation details work So I wanted to settle a bit more before I deal with it Uh, including the tokyo bindings. I'd also like to see stabilize a bit more Uh ghost style channels and rest. What do you mean by ghost style? So there's um cross beam channel Which is a really good implementation of uh of channels and rest that also performs really well um So maybe that's what you mean. I don't have headphones, but happy to watch nice um But yeah, that would be So channels are a lot more work, but they're they also have some interesting concurrency questions um All right, well, I'll give it a think and try to see What might be a good fit? I want to find something that is all so interesting and understandable for people who are newer to rust All right, I'll give it a think but thanks for the suggestions. They're all great. Um, right. I think that's it for today thanks for watching and Feel free to reach out on twitter on patreon if you have other ideas for things to do and I will see you Hopefully in two weeks. Maybe sooner Bye everyone. Thanks for joining