Programming Throwdown - Unix Commands
Episode Date: January 27, 2014This show covers Unix Commands and How to Ace an Interview. Tools of the show: Jason: Duolingo Patrick: 123D Design. Books of the show: Jason: Locke and Key http://amzn.to/L2LmEq Patrick: Lie...s of Locke Lamora http://amzn.to/1dIUJjy ★ Support this podcast on Patreon ★
Transcript
Discussion (0)
Hosting provided by Host Tornado.
They offer website hosting packages, dedicated servers, and VPS solutions.
HostT.net.
Programming Throwdown, Episode 31, Unix Commands.
Take it away, Jason.
Hey, so I had an absolutely terrifying moment over the Christmas
holidays. I moved a bunch of pictures from my camera to a USB drive that was connected to the
router. And I didn't realize until now, I didn't quite think about it, but, you know, like the USB
drive had a journaling file system, I think it was NTFS. And so, you know like the the usb drive had a journaling file system i think it was ntfs
and so you know the way journaling file system works is the driver kind of likes it says i forget
the term for it but it like writes things to kind of like some cache and then at some point decides
to sort of flush the cache and write it right actually write it to disk you know and you know
being totally incompetent
like any you know person who works on a modem like if you ever have like a router like a wireless
router it's always terrible like i bought tons of them they always they're always terrible
so i trusted my file system these people which is a huge mistake and uh the router like just we
lost power a couple days later. I mean, this is
literally days later.
And the photos were just gone.
And it was all the photos I'd taken
of the baby, like,
for the first six months, you know? So wait, why did
you hook it into the router in the first place? Presumably
you were going to copy it off?
No, well, you know, I
just thought that, like, I actually have a
NAS, but the thing is is the NAS is a little slow to access,
especially if, like, my wife,
she likes to look at a bunch of pictures at the same time.
And so I figured if it was on the modem, it would be one less hop.
When really, like, it didn't really matter
because the NAS is plugged straight into the modem.
It was kind of silly.
But, you know, at the time, you don't expect there to be this issue, right?
So at any rate, so i was really freaking out and then you know her computer i tried to like recover um you know the files off her computer but uh so just a quick heads up for people out
there in the audience who who didn't know this i actually didn't know this for a really long time. I only learned it rather recently.
When you erase something,
there's just a journal on the file system
that says, hey, this file doesn't exist anymore.
This index doesn't exist anymore.
But on the physical disk,
there's still electrons and they still have,
for the most part, the same kind of charge that they did, you know, in the file existence.
No, electrons always have the same charge.
What was that?
The electrons always have the same charge.
Well, so...
No, I'm just giving you a hard time.
No, yeah, so, well, you know what I mean.
You mean the flash, the bits of flash are still flashed the same way,
but it's just the header that says there's a file here has been erased or been deleted.
But then what happened was my wife's computer,
which is what we put the pictures on before moving them to the USB drive,
it defragged.
It did a defrag, like a full defrag, which it does like every day.
And so now like all of that electricity has been moved to a different location,
and I couldn't recover anything.
But then we were actually able to recover the files off of the camera's SD card
because we don't do any defrag or anything on that.
So it was pretty scary, but at least I got all the files.
I set up a cloud account
since then everything so i have everything backed up in the cloud and i have okay good so but wait
so you should have been able to just run like a file recovery program on the usb drive and gotten
your pictures back as well no so i tried but uh for whatever reason it didn't work yeah the usb drive just like i don't quite
know what happened there but yeah i tried that that was the first thing i tried they wouldn't
recover yeah okay i i would throw away your router or just never never plug never plug
don't plug things you don't want to lose into it yeah you know why is it that no one can
make a good router it just seems like it's really hard no no it's really hard i mean
it's it's like a high performance device that's supposed to be really cheap and do like a lot of
things right like it needs to have like a wireless router at least it needs to do both be like a good
lan router you know like switch router thing, whatever. I'm terrible with
networking stuff, but the physical, you know, port switching, but then also needs to do that
for all the wifi connections and, you know, have good RF design to have good wifi reception
and transmission. I mean, that's like a lot of different things to go on. And on top of the fact
that like, I think a lot of the stuff we were using like the wireless you know 802
11 b and g and even in are what over 10 years old and 10 years ago we didn't like in my house
there's probably 20 or more devices on the wi-fi at a given time yeah yeah definitely when you know
when they were designed people probably had one or maybe two computers that had Wi-Fi modems on them or whatever.
Yeah, they have that new 5G 802 AC or something like that.
I don't know anything about networking either.
But supposedly they have a new one that just came out, which is way better.
But of course, then it's like your device, the endpoint also has to support it, right?
Like whatever phone you have or whatever. Right, yeah, your also has to support it, right? Like whatever phone you have or whatever.
Right, yeah, your phone has to have it.
Same thing like 5 gigahertz even.
So 2.4 gigahertz is really crowded with a lot of devices.
From my house, I can see 10 or 15 different Wi-Fi routers from all the neighbors.
So the space is really congested which causes speed problems
and so five gigahertz is less crowded and i believe there's more channels so it's it's a
little bit better but five gigahertz doesn't have as good of a range as 2.4 gigahertz and still tons
of stuff doesn't support five gigahertz so you can buy new products today that still don't have
five gigahertz support in them oh gotcha yeah i mean this might be the
thing we're like we're just a couple of generations away from them getting this right you know it's
like this can't be that hard it's like the mouse you know i feel like you know they got the mouse
right and then there hasn't been that many changes to it yeah well i mean i think there was supposed
to be when they went all the tv stations went digital from analog that space was supposed to get freed up for this kind of thing to be able to be done um in in that the old where tv
stations used to live in the rf spectrum but uh i think through various whatever the auctions and
legislation got changed and so it didn't end up being a very uh good idea for companies to do that so it went to the same people that already do like the cell phone spectrum basically so it didn't end up being a very good idea for companies to do that.
So it went to the same people that already do like the cell phone spectrum, basically.
So it didn't really make a big change.
Gotcha.
All right.
All right, on to the news.
News.
So the first one here, it's maybe more of a that's interesting slash discussion.
But somebody built a 32 node raspberry pi supercomputer
cluster and i think somebody has done this before i'm sure we've even maybe had one of these in a
previous programming throwdown um where somebody did this yeah i remember this it got like a lot
of this one you know got press or whatever somebody was trying to run uh they were actually
doing distributed sensor nodes and this one had a interesting caveat where they
did a good job of actually saying like you know this is kind of impractical for most things like
a supercomputer is something different or way better or even just running on you know a couple
high performance computers might do a better job than putting all these raspberry pies but um Pi's, but the person specifically was using some extra sensor and radio communications
things and they were using the general purpose I.O. ports on the Raspberry Pi to interface
to those things.
So by having this cluster of them that way, he was able to simulate a sensor node better,
or at least that's the gist I got from the article.
So I thought it was an interesting subject and kind of one of those things where i guess you said you spent about
two thousand dollars building it um which is far cheaper than you know most things so if it's the
right tool for the right job you know i've seen people kind of spend more than like even like i
was like oh i get a raspberry pi to play around with but then you forget like you need the raspberry
pi and an sd card and a you know wi-fi usb thing if you're going to use one um you know you like add up all
the things it's like oh man this is actually kind of like gonna be like a hundred dollars and what
am i really gonna do with it hmm yeah that's the issue i ran into i was on the order like q for one
but when my turn came to buy one i just realized that yeah i didn't have any good ideas
yeah so like if you knew like oh i'm gonna use it to do this like it would you know it makes sense
anyways right tool for the right job but yeah raspberry pi supercomputer i still these raspberry
pies i thought they would just like kind of be a flash in the pan and people would kind of like
move on but like they're still in the news and people are still talking about them so
yay for raspberry pi yeah that's pretty cool did you see the like intel came out with some
really cheap uh like single board computer thing right so i don't know really cheap is true but i
saw they came out with yeah like a pentium processor that's like arduino compatible
yeah that's right people kind of passed over it because
it's kind of not the point um like it didn't make a lot of sense for people to do that but
the space is heating up like more and more people are making arduino compatible boards and
the arduino itself uses a basic microprocessor which is only 8-bit computer and not that fast
but then now there's ones with
like 32-bit computers running you know significantly faster where you can do you know a lot more
processing on them versus just like i'm gonna blink some leds yeah right no the arduino can
do a lot more than that but yeah yeah but no definitely nothing like a raspberry pi or like
this intel chip where you could do some serious like image processing or signal processing.
Yep.
So if you were going to do image processing and you created a startup to do that, you might be doomed.
Yeah, that's right.
So my article is pretty cool.
The title is Why the World's Best Photo Startup is Going Out of Business.
Went Out of Business.
Yeah.
It's called the government.
So I think that this article is, like, phenomenally interesting.
It's on this app-based company called Everpix.
And the idea here is they would take your photos, you know,
upload them to their cloud,
and then run whatever sort of image processing, classification, you know, upload them to their cloud, and then run whatever sort of image
processing, classification, etc, to categorize your photos. And so then give you sort of a search
engine for your photos, you can say, you know, Eiffel Tower, and it would just show you photos
that you might have taken over several years over several trips to Paris of the Eiffel Tower. So it seems like a cool idea and actually was a good idea.
They had a small but very loyal fan base,
or I guess customer base, that were paying customers.
So they did have revenue.
And the too-long-don't-read summary is that they basically went out of business.
So for two reasons.
One is they didn't try to grow their product.
So they spent a lot of time focusing on the details and, you know, going through feedback from customers, fixing bugs. And they felt like, you know, the path forward was through, you know,
pleasing their current customers as much as possible,
which, you know, is very noble, and I can totally empathize with that.
But meanwhile, you know, Instagram and Snapchat
and these other major blockbuster, you know, photo-based apps
spend more of their time growing the user base.
You know, log in with Facebook,
get your friends to sign in, more storage space if you get your friends to sign in.
They made the app free. I'm talking about their competitors. And so they kind of left this
company in the dust. The other interesting thing is this was a startup a few guys who were living in san francisco and they
paid themselves each two hundred thousand dollar a year cash salaries and uh this raised a huge
stink you know both in the article and in the in the comments there's a really interesting discussion
going back and forth but it really makes you think, you know, if you have, I mean, this startup, you know, based on, you know, what I read in the article, they would
have failed anyways. So it's like, at least they were able to make a decent salary. But then on
the flip side of it, or I guess a great salary, I should say. But on the flip side of it, you know,
a lot of people are saying, look, you took, you got $8 million in funding, and you basically took most of it and kept it.
The investors should never invest in any company that you guys make,
and they're just really upset.
And so I thought that that whole dynamic was actually really interesting.
Yeah, I mean, I never had heard of this before, this article,
but this startup Everpix.
But yeah, I mean mean i thought that was
interesting too the like when i was skimming the article the first time i saw it and i saw the
salary costs were like so huge and i was like not just like theirs but like in general they were
showing like how much they had spent on salaries i was like wow that's like really high and and
as we're saying like oh we're paying ourselves like the equivalent you know of other jobs but
that's kind of one of the things I've always heard about startups saying
is you don't take an equivalent salary.
You get a lot less salary because you're essentially donating
some portion of your salary to the company in hopes that like,
or you're investing it, right?
So instead of taking the money out now,
you're leaving that money for the company to have more runway
to get to the time when it makes tons of
money. And then your investment of shares and percentage ownership of the company pays out
that much more. Yeah, exactly. I mean, you know, it's true that they had this growth issue where
they were, you know, charging customers and it was hard to get new customers. But, you know,
if they had paid themselves like $ 000 a year instead of 200 000
a year then maybe they'd have another year or two to sort that out but instead they're just like
you know they're dead now so i think you have the next news article so yeah 3d printers at the
consumer electronics show i should like that is ces stands for yeah i never i never actually
looked it up okay i think it's consumer electronics show um so i i'm not super big
into consumer electronics i guess like some people are whatever like the latest phones and the latest
gadgets um but i it's somewhat interesting and uh i am interested in 3D printers and there was a lot of news about 3D printers at this year's CES.
And I was trying to read through what people were saying
and it's still like, I guess,
a relatively younger new industry
about what's gonna happen with 3D printers.
And it appeals to me because a lot of hardware,
a lot of software,
and you get to make cool things that you hold in the end.
Yeah, definitely.
But there's still like a lot of questions around my mind. Like I still see like a lot of software and you get to make cool things that you hold in the end um yeah definitely but um there's still like a lot of questions around my mind like i still see like a lot of
people who think that they will be able to have a lot of use out of 3d printers without doing any
cad work um like no designing their own things in 3d programs and maybe that's like 3d programs
need to become much easier to use um or like this, there was a lot of scanners coming out.
You could scan an everyday object in your house.
Like, oh, I like this mug.
I'm going to scan this mug, and then I'll have a 3D model of it.
So maybe that's one avenue.
But they also have the Thingiverse, right?
At least the Thingomatic has the Thingiverse.
And it's a huge warehouse of 3D objects.
I've done that before, just printed other people people's objects but how far does that get you like if you had bought like your own
3d printer in your house and you didn't know any like programming any you know didn't want to do
any cad work 3d work like how would it you that you'd justify the price like of a thousand dollars
to only be able to print stuff that's on thingiverse um i don't know i mean so
the thing is like the only if the printing itself was an activity like if i would get my son when
he's older and the two of us would find crazy things on the internet like on thingiverse like
dinosaurs or whatever and print them out uh but yeah you're right a thousand dollars i mean i'm
hoping that by then the price will be more like you know three hundred dollars or something yeah so they have three
hundred dollar ones now but they tend to involve more tinkering uh bummer so i think yeah maybe
maybe in another few years it will be i just like i just wonder like what is and um several of the
articles talked about this and the one that'll be in the show notes was more lengthy than most but
the you still need the killer app like what is the thing that you want to get a 3d printer to
like you would do it get one just to do that um and we haven't really found that yet and maybe
once we do it'll be like oh of course like this is awesome um but for now i'm still interested
because like i like electronics and tinkering and I'm not afraid to do 3D drawing.
But the whole it's ready for the masses or it's going prime time
or it's a consumer device still eludes me.
I'm not sure that that makes any sense.
Maybe the 3D printer becomes a way for you to customize, you know, something where like, you know, you'd go to Best Buy and you would
buy like a toaster, let's say, but it would just give you like the inside of the toaster.
And then you could go to Thingiverse and the toaster manufacturing company has given you
like a hundred different shells for the toaster like one that looks like an angry bird or whatever
and you could just print oh angry bird toaster yes what i've always wanted actually you know
i think 3d printing something uh like a toaster is probably supremely dangerous well and a bad
idea because it's plastic it'll melt yeah yeah yeah that's exactly right but you know what i
mean i mean you get where i'm going but but i mean even in that case like i agree like i think 3d printing rapid prototyping has like a use in
industry and among engineers and like for rapid prototyping right or like at a store like the
best buy you would go buy the they would have a kit of toaster oven innards but instead of stocking
300 different styles of toaster oven they would just
stock one or two different insides and then they would 3d print whichever one you chose
yeah exactly right but that doesn't still explain like why i would need one at home
unless i was gonna like change toaster shells every couple months yeah yeah but you know maybe
that's maybe that's where it goes like for example you know uh you don't really need a paint mixer at home but you know i'm really happy when you know i go
to lowe's and they have one but paint mixers aren't all talked about at ces and people saying
oh this is the wave of the future well maybe they were. It's CES 1932.
Okay.
Anyways, 3D printers are cool.
I guess my point is maybe it's not, you know, the end goal really isn't your home.
You know, like it's just for, like right now it's mainly for geeks.
And geeks like doing things themselves.
But, you know, maybe the end goal is, you know know to put it in a best buy like you're saying
that's true no i mean to me it's extremely interesting but i also like making my own
furniture and building circuits and so i mean like it makes sense to me for me i just like i
guess i feel like i'm atypical in that respect that most other people aren't like that where
they don't want to do that kind of stuff so we'll see but if you use if
you're interested in 3d printers you should check out some of the cool stuff that was shown off at
ces yeah definitely yeah 3d prints are actually really fun and learning like uh i use blender
but whether you use blender or uh was it solid there's one called solid some solid work scad
solid cad okay regardless of which one you use they're all uh they're all pretty cool you can Was it Solid? There's one called Solid something. Solid Works. Or SCAD. Solid CAD.
Regardless of which one you use, they're all pretty cool,
and you can make some really fun stuff.
Yep. All right.
Okay, so I got a pretty cool article. It's Top 25 Oddball Interview Questions,
and it's a good lead-in you know, our nice little segue, you know, mid, mid show topic that we're going to keep hidden for suspense reasons. But, uh, but yeah, so this website, uh, you know can look around in Glassdoor and they'll give you like superficial
information on different jobs different companies salary expectation things like that but then after
you get a certain you know way through the site they say oh hey you know you have to give a little
to take a little more and so they have you log in through
like their account or Facebook, et cetera, and put in some anonymous statistics about your job,
which, you know, they use to sort of, you know, keep the whole thing running.
But now they've, you know, they've become pretty popular among, you know, job seekers or career
enthusiasts, I guess. And so they have spun off this blog.
And on this blog, they do a variety of different things.
Every year, they have the top companies to work for,
the craziest work environment, et cetera.
And this is a top 25 oddball questions.
And I've seen a lot of sites like this.
And most of them focus on questions that they ask like project
managers on the grounds that you need to be able to sort of think critically and think mathematically
so you see a lot of these like this one in particular says how many cows are in canada
how many quarters would you need need to reach the height of the empire state building
um you know i've heard like how many so those are i don't see those are odd airplanes stuff like that those are all the same same type
of question or how much extra gasoline would the united states consume if there was a law passed
that all headlights had to be on all the time on cars when they were driving right right and most of the time what it comes down to is you have this
like very complex dynamical system and you just need to start with like trying to simplify it as
much as you can and you know just like for example the ping pong question you start by thinking you
know how many ping pong balls can you fit in like a one meter cube yeah like basically it's just all
about estimation but it's also proves on some of them you need to know a little bit more like for
instance the one i said like headlights being on like that there's an inefficiency in powering a
generator to have the headlight on that causes you to use more gas or whatever in addition to
estimating how many cars are in the u.s and how much do they drive and how much gas do they consume right yeah exactly so yeah but you should
be ready to answer those like if uh like that's a really common style of question to estimate
something really big that there's no way you can actually know the answer to i don't think that's
oddball like i think you should really know that if you're going to do any sort of engineering interview yeah that yeah definitely don't uh just say like
a hundred or something like that you know i mean what they want to know and we'll talk about this
more as uh we go on but but uh what they really want to know are just like uh the process and
like your methodology yeah i think that's it like knowing you can take a
seemingly impossible question and break it down piece by piece yeah exactly exactly and each so
did you go through these questions do you know so why is a tennis ball fuzzy
um why is a tennis i'm assuming it has something to do with the way it bounces to keep it from rotating or something.
I actually thought it was to slow it down or something.
Yeah, to keep it from going too fast.
Oh, is that the real answer?
To level the playing board.
No, I don't know.
There's actually not answers on these.
They're all ball questions.
Do you believe in Bigfoot?
Do you believe in Bigfoot?
No, that's one of these.
Okay, we can stop stop so you should go
that's more ridiculous um so so on interviewing what are some what's that on interviewing so
what are some like good tips for people like if they're going to interview so so this is sort of
deviating from the normal show yeah we're definitely going to get to unix commands but
uh as you might expect,
that's not an entire language,
although maybe it should be.
But we wanted to add a little bit of spice,
a little bit of interesting content.
And so we decided to think,
what does it take to really ace an interview?
Now, of course, you have to know
what you're talking
about you can't have a degree in computer science and then try to ace an interview for the legal
team right i mean it's just not going to happen but you know with that said there are um there's a
there's there's a whole process to interviewing and to being interviewed. And, you know, the reality is that
sadly enough, there's some people who fail at that process, despite the fact that are extremely
qualified. And it works the other way as well. And so understanding the interview process is a big
step towards, you know, either, you know, changing careers, or to interviewing other people for roles within your company.
Or graduating from college and trying to get your first job.
Yeah, yeah, yeah, definitely. There's no doubt.
And we'll mostly be talking about, we'll go from general to specific,
but in the beginning it'll be applicable to everything.
But then further along we'll start talking specifically if you have what's called a technical interview,
which is an interview where they're going to ask you to solve problems or
you know do programming in the interview which not every interview is that way and if possible
you should try to find out in advance if it will be a technical interview or not yeah definitely
that's a really good point it's kind of sad but i considered college as a career like when i was thinking in my head
switching careers i guess because i was in college for so long that oh okay it's pretty bad anyways
so um you want to go first sure so i mean like the first and maybe this is like like i said
they're general and therefore probably more obvious in the beginning but you should read
up about the company you're interviewing with i mean it's kind of like bad but i've done interviews where the
person comes in as kind of like so what do you what do you guys do and they don't mean like what
kind of work specifically do i do because i've already said that they're like just asking like
in general what does the company do or like what products they make um and it's like yeah okay that's like
you didn't look us up on the internet uh you know like this is not good um so definitely read up and
know about you know like what are the most famous products they do or the things in the news and
specifically like if it's a big company it's good to find out like at that branch what do they work on so like if your company has like
you know makes furniture and in one city they make couches and in one city they make desks
you know if you can find that out like that's also more helpful because then if you're interviewing
in the city where they make desks you're probably talking to people who work on making desks and
then you know you can ask specifically about that kind of stuff.
Yeah, definitely. I mean, so Patrick and I have been interviewees several times. We've interviewed
a lot of people. Probably between the two of us, we've interviewed over 150 people, just estimating.
So, and one of the big things is you know there's some people who are
there um but they don't really want the job or you know they find out they don't want the job
by the time they get to your interview if they've had other prior interviews the same day and so
um as an interviewer just because of the statistics it's very easy to sort of lump
someone into the pool of people where you just feel like this, like they're just not interested. Right. Because there are a lot
of people who aren't interested, um, but are interviewing for other reasons or who knows.
Right. So, um, yeah, you definitely, uh, as a interviewee, you want to understand the company
and be enthusiastic. And I mean, the reality is if you don't understand what that
company does then uh like how can you really want to work there it doesn't really add up but yet you
find tons of people who uh who are in that category so that's definitely where you want to do your
homework um so another one is you uh it's really important to be confident and not to be intimidated
so or at least to act confident yeah yeah especially when you're doing a technical interview
uh just kind of keep telling yourself or just remember uh meditate on this that you know the
interviewer um you know he might have asked that same question to say 50 other people, right? Or
if he hasn't, he's preparing to ask that question to another 20 or 30 people, right? So he's going
to be an expert on that question. And he might have seen just about everything that people have
thrown at a certain question. Like the guy who asks the, how many ping pong balls can you,
you know, does it take to fill up a 747, right?
Like he's probably heard a hundred different answers.
And so, you know, nothing is really gonna phase him.
And he's always, the interviewer is always gonna seem
like one step ahead of you
because they are one step ahead of you.
They're in fact, they're more than one step ahead of you, right?
So don't let this intimidate you.
The reality is, you know, you can go through a process,
and while it feels like you're kind of struggling,
what you're really doing as an interviewee is solving the problem,
and you're solving the problem under distress
because there's a lot on the line and there's a lot of time
pressure. And, uh, so that's not a bad thing. You know, I think that there's a, a lot of people get,
get way too nervous in an interview setting. Uh, as soon as, you know, they start saying things
that are on the wrong track, you know, don't hesitate to throw things out there that are bad
and then, you know, come back to a better place and to a better solution
you know so um that's my two cents on that and we're gonna have to speed this up a little or
this will be the whole episode but um yeah i mean the other thing is like always try to answer what
they're asking but then try to finish it out right so say like okay first here i'm describing you
like how i'm gonna attempt to solve it then like oh here I'm describing you like how I'm going to attempt to solve it. Then like, oh, here I'm writing code.
Okay, now I'm done with my code.
Don't be like, oh, okay, I'm finished.
Say like, okay, now I'm going to test my code.
Now I'm going to, you know, like try to evaluate
if I've made any errors.
And really going through that whole process
is useful as well.
And then, you know, make sure also like it's,
some people don't think about this,
but you will almost always get asked at the end of your interview.
Do you have any questions?
And like it seems kind of silly and oh, this doesn't really matter.
They're just asking me like to be friendly.
You know, do I have any questions?
But in reality, like at least this is what I've always been told.
And it seems to work.
People think positively about themselves.
So if the interviewer is talking
about themselves, they're thinking positive thoughts. So they'll think positive thoughts
about the interview. And it sounds really like psychological or something. But if you think
about it makes sense. So if you ask a question, like, what's your favorite part of working here?
Or, you know, what do you like most about, you know, being a software engineer at Intel or
wherever it is, then the person is
going to like say something that they're passionate about. And then that's what they're going to
remember about your interview. And it seems really silly, and maybe it doesn't matter.
And if you have actual real legitimate questions, you can, of course, feel free to ask those as
well. But at least ask some question or questions, even if you've asked other interviewers the same
question that day.
Yeah, definitely.
Yeah.
I mean, that's another good point.
And then we'll try to, as Patrick said, speed this up.
But basically, you know, you'll often have many interviews, you know, within one day.
Like you'll have many interviewers that are coming and going for a particular interview.
And they, by design, they don't collaborate. So you know, if you flub the first interview, because the morning and you just,
just didn't work out. Don't let that ruin your whole day, right? Go into the second interview
with a blank slate, because it is a blank slate. I mean, if, if the company like, you know, has
people sort of collaborate from from one, you know, session to the next, then they're not going to end up with five sources of honest feedback, right?
So most people don't do that.
And so it's okay to flub an interview or like one part of an interview.
So let's get to maybe more of the specific, like, technical parts of the interview.
One big part is to do a lot of open source or at least open source your own work, especially, you know, if you're not in industry yet, if you're in academia or if you're just a student, you know, graduating from college, you know, take your assignments and kind of polish
them, maybe put some comments and whatnot, and then open source them, right? Even just put them
on GitHub, just so you have an account and a presence, you know, I think that's, that's a
really good idea. And it sort of like, gets you familiar with some of the tools that you'll be
using when you go to industry. Definitely. It's also important to even if you are fresh out of
college or you've been out of college for a little bit longer to go through and like kind of from
scratch go through the common data structures and algorithms that that you're likely to be asked
about and the important thing here is from scratch like it sounds kind of silly but like without
looking it up without doing it or looking
it up once and then you know trying to implement it because there's one thing to like read about
something and say like oh okay now i know you know about binary tree traversal and it's another to
actually sit down and write the code for it and if you're in a coding interview you're gonna have
to write the code for it and it's best if you've written the code for it recently and so it's a little easier to do
so things like binary trees and tree traversals sorting you need to know at least you know one
in login algorithm that you can do from scratch the graph algorithms recursion dynamic programming
and then another big one in college it's not stressed, but if you go to any sort of large-scale internet company,
knowing about hashing and hash maps, like, a lot.
Almost every question at an internet-based company
seems like it could have a solution that uses a hash map.
Yeah, you're absolutely right.
You're absolutely right.
Have you heard of locality-sensitive hashing?
I mean, no no but the words in
english make sense to me okay yeah we'll have to talk about it some other time but that that is
like the topic du jour it seems like everybody is um like that seems to be like the internet
the interview question of the week or something on everyone's calendar oh interesting interesting
but but yeah but patrick's absolutely right i mean you want to understand the fundamentals and uh and yeah it doesn't hurt to code them up i mean
you think about it um you see a lot of people like practicing martial arts like kung fu or
taekwondo or whatever and they do the same kick over and over again every day and a lot of that
is kind of muscle memory it's like supposed to be instinctive. And so there's a number of competition sites
like Topcoder, Kaggle, Project Oiler.
And if you go to these sites
and you do a lot of their practice problems
or compete in some of their student
or professional competitions,
then you will build that sort of muscle memory
for your brain. And you will be able to sort of muscle memory for your brain.
And you will be able to sort of instinctively,
you won't just, someone won't just tell you some question
and you'll say three.
It doesn't work like that.
But you'll instinctively jump to a certain set of tools
that will at least get you in the right direction.
Yep.
And it is worth noting too,
like even if you do programming day to day
and like it's arbitrary as it seems
to do these silly questions,
that is what these companies have chosen to do
to screen people.
And so you either got to kind of sign up to do it
or just decide you're not going to work
at one of those companies.
So like, you know, in my day to day job, I don't ever implement a binary tree from scratch. But if I know I'm interviewing at a
company that asks these kind of questions, I should study that or decide that I'm just not
going to bother. Because it's also I've heard stories, and we're moving into maybe the section
where we talk about some bad stories. But I've heard stories before people saying, like, I know
how to do that, but I'm not going to do it for you. That basically like that's so elementary, like it's a waste of time. Like,
let's talk about other things. Um, and yeah, so that doesn't work out that well. So like,
you gotta be prepared to like, it sounds bad, but like play the game that the interviewer wants you
to play. Um, even if you think you're above that um yeah it's a really good
point i mean the reality is is it you know it doesn't matter whether you're 25 or 52 uh you
know if you go to a technical interview you're gonna have to know binary trees hash maps sorting
etc yeah an interviewer knows there's a tool that does that already yeah i mean they know that as
well but like that's not the point yeah yeah like the right answer isn't oh i'll use the binary tree
code off the internet it's not gonna work yeah so um so uh you want to cover best and worst
yeah so well best moment i don't know if i have a best moment other than like ever not completely flunking out at someone's question but um my worst moment what about a best interviewer moment
like did you have a moment where you interviewed somebody no it was really profound or anything
okay no but i do have a worst one i was in an interview where i was gonna have several interviews
that day i think like four or five and it was like the first or second one.
And this person asked me like a really open-ended question,
like one of these kind of like estimation style questions.
And I was like really going very in depth on it,
like kind of, you know, exploring all the possibilities
and waiting for them to guide me into like,
okay, yeah, that's good enough.
Or like, okay, let's get to a final answer. You know, know like kind of seeing like where how much detail they wanted me to get into
um and then uh kind of by the end of it they said you know i i don't really think you have
any technical ability whatsoever um oh and it was just like oh what like i was and you can't
explain right like i was like can you even say
after that so then i was kind of like well you know i was just like waiting for you to tell me
like when you wanted me to start you know coding or when you were thought i had given enough detail
and like no i think you're just trying to dodge having to do any coding i was just like oh oh my
gosh okay oh that's gut-wrenching so it was at the beginning or at the end of the day that was
like the second interview out of like oh no so you still have to face the you know most majority
of the day after that yeah but you gotta kind of like jason said shake it off because like
just because that guy was that way doesn't mean other people will be um and if i go through with
a bad attitude like it's just gonna everybody else is just gonna
assume that i'm that's me normally yeah yeah definitely so i actually don't have a best moment
either i think it's actually pretty hard to have a best moment interview right so i got offered i'll
talk about my uh worst interview interviewee moments um so as an interviewee it's similar to patrick you know i
did like a lot of you know computer science theory and so um i had this one um stage of an interview
where somebody was asking just kind of very specific questions on um like this certain type
of architecture that i just never been exposed to it's like i never took a class on like networking or or anything like that so these are kind of like very specific networking
questions and uh it was just really it's just really hard because i i i kept like saying variety
of things and there's sometimes when the person was trying to guide me in one direction but like
by guiding me they were saying things that like opened up holes in the original problem so i was
like oh well now there's this hole in this problem so i could just do it this way and they're like
okay yeah but what if you couldn't do it that way and it's like i just knew that they wanted me to
say something but i didn't know what it was what that they wanted me to say and i just felt so
helpless but um but like patrick said
you just have to shake that one off it actually went pretty bad the person about halfway through
the interview started going on like opened up their computer and started like chatting
like i don't know like it's hard to say if someone's taking notes or chatting i'm pretty
sure this person was just like chatting to other people did i get a joke interviewer talk to me joke interviewee are you guys testing me it was so bad but uh my worst interviewer moment i guess
i have two one really short i was a phone interview and the person like pretty quickly
into the interview it's not like i had been kind of like badgering this person but like you know
like like relatively quickly in the interview, you just started crying.
And I think it was just like the pressure was just too much that they were putting on themselves.
That's just sad.
It was just really super awkward.
And then I'm only laughing because I'm remembering just how awkward it was.
And the other one, it was an in-person interview and it's the same
scenario the person was extremely nervous and um we were on a whiteboard and the person had
these expo markers and they were furiously writing but they were left-handed and so as they were
writing they were kind of smudging the whiteboard with their hand and then they were like profusely
sweating because they were so nervous so they kept rubbing their hand and then they were like profusely sweating because they were so nervous
so they kept rubbing their forehead and then that kit this the the expo marker like you know
migrated to their forehead and they had just like they looked like they had like kind of
like these like native american tribal tattoos like all over their face but it was all these
different color expo markers and you didn't say anything i was like
hey you know after the first problem i was like let's go get a get something to drink so we went
and got a drink we came back it was like he got a soda and he was kind of like his hand was shaking
so he's shaking the soda so no he uh like he turned around he didn't even have a chance to
open the soda he turned around and the soda flew out of his sweaty hand and hit the wall and then exploded.
And both of us and the whiteboard got like showered in like very foamy Coca-Cola.
And it was disgusting.
That's not funny.
That's like just depressing.
That was the worst interview that I've ever given in my life.
And I actually, I probably gave a little too much detail and if you're listening or if you're friends yeah i
apologize um and you know i still thought it was hilarious um no hard feelings but but that was
just it was just so bad oh okay time for book of the show book of the show so my book is actually a series of comic
books called locky and key and i thought it was very well done basically um the thing that i
thought was really cool about it is you know without giving too much away um there's this house full of keys and each key
it's almost kind of like the twilight zone where each key kind of like bends the world in a way
that's not you know generally bent you know and it just each key causes something crazy
some kind of crazy power or whatnot um the book is a little too like generic you know like like they gave themselves too much freedom
it's sort of like you have any key and then uh without spoiling too much the the the antagonist
ends up being just also kind of generic but the the creativity is absolutely astounding and the
kind of crazy combinations of keys and all the things they do
with them i thought it was a really awesome series and i highly recommend it nice so it's a
like comic book or a yeah it's like 20 or 30 issues okay but you know i don't really like
you know like spider-man superman any of that but i do uh really like kind of reading comics
it's kind of light.
And, you know, usually I really like the artwork and everything.
But, you know, this is like more like kind of not serious comic,
but it's not one of these like superhero kind of like crazy fantasy comics.
It's meant to be.
It's, I guess, a horror comic.
Oh, okay. So I chose this book before i knew what you were picking but it also has lock in it um with l-o-c-k-e but this is the
lies of lock lamora um and this is a fictional book by scott lynch that i just finished well
actually listening to but i'll call it reading um and it is pretty good so it's a
like crime thriller kind of like oh think like oceans 13 like a heist and um but it's set in
like a fantasy world so it's this kind of really interesting world where they don't get into as
much as it as like most science fiction would um, the details of how this world came to be
and kind of the rules of the world.
But the author does a good job of setting up
an interesting environment for this thing to take place in.
And I believe it's going to turn into a trilogy.
I think the second book is already out
and maybe the third is in the works as well.
I'll have to look into it.
Oh, so it's pretty new then.
Yeah, but it's probably like three or four years old. I'd have to look into it but it oh so it's pretty new then but it yeah but
i it's probably like three or four years old i'd have to look i don't really know um but i just
read it and i really enjoyed it and it's not like some trilogies end where like it's just the
trilogy is just really one long book um but this seems to have you know it like you could just read
one book and be happy gotcha cool cool yeah i'll check this out so wait
what's the theme again is it like futuristic or no so it's it's like a fantasy world so it's not
really futuristic um and there's like a little bit of magic um i don't really know it's not like
medieval how would i call it i don't even know like the age maybe like a little like steampunk
oh okay but not like with like balloon steam boats or anything okay cool yeah maybe like 18th
century maybe like 18th century but like in a fantasy world now i'm trying to remember if there
was any technology in the book that would have placed it in a specific time.
I love seeing some of these futuristic
but the art styles from the past.
There was this
artist that did pin-up art.
These are kind of like
1920s, 1930s.
Very pastel,
very flat colors.
But then the cars would be flying cars
or like the technology would be like something outlandish right and uh i always thought those
contrasts was pretty cool nice nice all right so time for tool of the show
tool of the show my tool this show is du lingo so long story short i uh used to be
pretty much fluent in italian i lived there for a while lived in italy for a while um but uh
i've since lost almost all of my fluency uh literally all my fluency and so i wanted to
build it back and you know i have i have brady and I want to sort of teach him Italian and all of that.
So I picked up this app.
It's really cool.
It sort of gamifies learning a language.
And I feel like it does a really good job.
I mean, my opinions, I feel like I can't really give it a fair, you know, assessment because I already know Italian.
So I'm kind of, you know, bree i already know italian so so i'm kind of you know breezing through it but i but i really feel like uh if you had no idea um about the language maybe i'll try chinese or
something next maybe i'll try learning italian and i'll tell you it it walks you through it at
like such a fundamental level that uh that that you could that you could uh you could pick up any
language with it so you can get back your flu. I'll try this out and try to become fluent
and try to learn Italian and become fluent,
and then you can tell me how good I did.
All right, sounds good.
One thing that's particularly cool about it is,
although I found out later, like only through using the app,
that it's not that accurate.
It gives you a lot of leverage.
But it has this thing where you speak in the language to the microphone,
and it evaluates your accent.
I thought that was pretty cool.
But then you told me it wasn't accurate, so now I don't think it's cool.
Yeah, that's the thing.
I don't know.
Either I have a really good fake Italian accent,
or it's just giving me way too much credit.
Play some of the Mario soundtrack or something something like Mario speaking and Super Mario Brothers or whatever one of the games he actually
talks in and see what it gives him yeah it's a me Mario 100 percent all right, so my tool is by a company called Autodesk and it's one, two, three D design. And, um, so if you've heard before, I think we even talked about SketchUp, which Jason was talking about CAD tools before and talking about using Blender and SketchUp was something that a company had made and then i think they sold it to someone else now but um was like a free you know kind of more
basic cad tool and so this one two three d design is in the same vein and um i picked it up because
i've been trying to learn some 3d modeling and there's like you know all these recommendations
and depending on what you want to do or what it's targeted to it's like blender is you know good for
like you know artistic stuff and
you can use it for kind of precision mechanical drawings but you know maybe it's not the best i
don't really know um but this one seems good it's a free it's not open source though um and it's
called one two three d design um so if you're interested in learning cad and looking for
something that seems simple yet still like you still quite powerful, then you should check it out.
So if I remember correctly, Autodesk made 3D Studio Max,
and then I believe they also bought Maya.
Is that correct?
Yeah, so they actually, this company is like, yeah,
they have like a whole host of, yeah,
like all the major types of CAD software they do i'm trying to click through to see all
their apps now but um yeah i'm amazed that like this company has so much experience and like so
much invested in in paid um apps which would make a free one but i'm assuming like the other ones
maybe this is like the gateway to getting people to buy these more professional ones. Yeah, so they make 3D Studio Max, Maya, this more professional one called Inventor, I guess, AutoCAD.
Oh, they make AutoCAD too, wow.
Yeah, so they make a lot of these kinds of products.
And this one seems like it doesn't have a lot of crazy features,
like a lot of the macros and things for doing like bill of material and
tolerances and stuff i haven't seen in it which i know some of the other ones do um but it seems
like it is in a similar vein to the more complicated products so like if you got to
the point where you outgrew this one you could transfer your knowledge into one of their paid
products um yeah which i guess is the point but also an advantage because then you don't have to relearn something because uh you know like blender you couldn't do exactly what you needed in blender
and you know you have to relearn another tool um which i'm not picking on blender i don't really
know that may not be an issue with blender um yeah i mean i've used blender quite a bit but uh
you know i uh i mainly used it for artistic things so yeah i don't know
how precise it is per se yeah cool so on to well you're calling it unix shells and i called it
unix commands but it's just general unix knowledge yeah unix unix knowledge so one thing i have to
warn everybody by listening this podcast um you warn everybody by listening to this podcast,
after you listen to this podcast, look in the mirror,
and you might have a huge neck beard and not even know it.
What?
I don't know if my wife's going to approve of that.
No, my wife definitely wouldn't approve.
But, yeah, it's, you know,
if you need to know something about a very specific way a eunuch man behaves,
look for your closest neckbeard.
We also just lost all our female listeners.
That man or woman will definitely help you with their eunuch's fantastic knowledge.
We'll cover some of the common shells.
I've used a bunch of these but to be
honest uh only one of them i've really liked so uh maybe you had a different experience but uh
okay yeah so there's born shell seashell corn shell thompson shell there's also tc shell
which is a derivative of seashell and i've've used all of them, and in my opinion, they all were terrible.
The only good shell, and fortunately, a lot of people agree with Patrick and I here,
so it's the default on almost any Unix computer nowadays, is Bash.
Bash Shell.
Actually, I've been wanting to try out, do you know anything about fish shell?
I've never heard of fish shell.
People on, like, Hacker News are always talking about this fish shell.
Is it F-I-S-H?
Yeah, I keep telling myself I need to check it out.
But all right, I'll keep looking. Keep going.
So I'm looking at Bash shell.
Bash shell was a replacement for Born shell.
But I can't find out if bash
is supposed to be an acronym or what regardless so we broke so basically
there's a number of sort of core commands that will really make your life
much more productive as a someone who's like a programmer has to mess with a lot of you know
structured data now by structured data i mean like sql or something like that i'm talking about
you know like comma separated files space separated files if you want to write something
to like a flat file structure and you want to do something kind of quick and dirty
the best thing is to just kind of write ascii text to a file
and then do some manipulation and so the unix shell is actually extremely good at this it has
a lot of functionality people don't know about so we'll start with some of the easy ones so there's
cat cat lets you basically it takes the contents of a file and it writes it to standard out.
Actually, we should probably explain what these are.
So any Unix shell has streams.
So it has standard in, which is a stream of data flowing into a program.
Now, by default, that stream comes from the keyboard.
So you can run a program.
It can say, what is your name?
You know, you type in, you know, you could write a program like this.
You type in your name, hit enter.
Now, when you hit enter, the information flows through standard in to the program, which is kind of waiting for it.
And then it says, hey, hello, Jason, or hello, Patrick, right?
So standard in now you can also if
you don't want to have to use the keyboard you can cat a file which will
take a file and sort of dump it to the screen but then you can use the pipe
character and you can take things that would have been dumped to the screen and
sort of pipe them or redirect them into another program. So instead of typing JSON, you could have a file that has JSON in it,
cat that file, pipe it to your program, and now your program runs with JSON.
So if you wanted a program that executed some process on some data,
but you didn't want to have to put the file name in the program,
and then you make a change, now you have to put the file name in the program, and then
you make a change, now you have to rebuild the whole program, right?
The program could just read information as if it was coming from the keyboard, and then
you use Unix streams to sort of feed whatever file you want through the program.
So that's CAT, and that's sort of redirecting.
There's also sed and awk.
And now we're starting to get a little more complicated.
Sed does a number of things, but the most common is find and replace.
So again, you can have this stream of data that's coming through.
Say you're catting a file, so you're just dumping a file,
but you only want the words patrick
from the file so any line or or another way of saying is anytime you see the word patrick you
want to replace it with jason because of course you know let's be honest who would hey hey hey
jason so so you would use said and then you do I think it's like, s slash Patrick slash Jason slash g.
So there's a little bit, again, it's Unix,
so it's going to have this crazy wizardry,
and you'll have to look it up on the internet.
Don't worry, all of us have to.
Except for the guy with the neckbeard, he has it memorized.
But you'd use sed to sort of do things, like simple things like that.
awk lets you do even more complex things.
But together, they both sort of have a nice union.
Like between the two of them, you can do a lot of cool text manipulation.
So then you have diff and patch.
And so this will take diff will say like if I have two files, so like I made a copy of
a file and then a piece
of code and then i made changes to it diff will tell me what lines have changed between the two
files and patch lets me instead of having to send someone a whole new file just send them the delta
that they can then patch into their file and reflect my new version of the file so it captures
the differences between two files versus diff is
more for examining by eye and the same thing so you can you can also you can diff entire directories
and it'll diff like everything inside the directories and you can also redirect diff to a
file so now you have this diff file. You can send that to somebody
and then he can patch your diff file
and now he has the same changes you have
for a bunch of directories.
Yeah, so then there's TAR.
Actually, do you know what
TAR stands for? I have no idea.
I'll look it up. Keep going.
Terminal Archive or something.
Okay, so what's the difference between
tar and gzip?
Yeah, so
gzip
takes a single file
and then
shrinks the file by using some
compression, right? Tar
will take a group of
files and it basically just concatenates them together
but it also stores a little bit of metadata so it knows where one file ended and the other began
so tar stands for tape archive oh tape archive ah i guess now it makes more sense as terminal
archive but it originated as tape it's interesting So you can actually use both of these together, right?
So you can use tar on a directory
to collapse the whole directory into one huge file
and then use gzip on that file
to make the file a reasonable size.
And that's why if you're downloading,
especially things for Unix,
you download these files that have the extension.tar.gzip.
And that's because that's exactly what they've done, right?
They had a directory, they tarred it, and they gzipped it, and then they put it on the Internet.
So what's crontab?
So this is for when you want to run a script or program on a regular schedule.
So something every hour or something every so often.
Yep, that's pretty much crontab.
Yep, okay.
Yeah, so like a bunch of programs on your computer that check, you know, the, that like, uh, check for
updates and all that stuff. They all just, they're basically crontabs and you can actually,
I think you can type crontab, maybe it's crontab dash H or something. One thing,
oh, one thing we should mention for all of these commands, if you type man, which is short for
manual, man space, and then the command, they give you like a whole dossier
on how the command works and everything.
So half of the things we'll say are wrong
because we just look it up every time.
But yeah, if you type crontab by itself,
I would think, or maybe the dash L,
it gives you a list of all the programs
that you have scheduled. So next is
BG
Jobs and Kill.
These kind of all work together.
So BG says...
An Assassin's Toolkit?
What's that? An Assassin's Toolkit.
I was guessing what they're for.
BG is for
Back... Background.
Yeah.
Basically, it takes your program runs in the background so you can keep doing other things on the terminal and your program will just
you know run in the in the background until it's finished um jobs gives you a list of all the times
that you've done this um so all the BG commands that haven't finished yet.
And kill lets you kill one of those.
So if you have one that's kind of going out of control,
you just type kill and first type jobs,
find out which number it is,
and then type kill percent the number
and it will kill that job.
So I never get the PS right but PS lists the processes
is that right?
so you can get processes
I have no idea, I've never used the history command
is that the same thing as pushing up
in bash shell?
or control R and searching through your history?
history just gives you a list
of all the commands you've typed
since you opened the shell.
I've always just output my, it's like.bash history
in my home directory.
Oh, yeah.
So this is a one-word command that does exactly that.
That's useful.
See, this is why I do this podcast,
so you can tell me things I didn't know.
Yeah, so that's history so read link is a rare but extremely useful command you type read link
and then dash f and then the name of a file and it gives you the full path to the file
now if you do read link and then the file it gives you like the full path based on where
you are now.
But where you are now can be a symbolic link to some other directory, right?
So we won't get into symbolic folders.
It's kind of complicated.
But you know, you do read link dash F and then some file and remember all these commands
work in Mac as well as Unix.
So if you have a Mac desktop or laptop,
if you have a Mac Pro, if you roll that way,
all these commands will work.
So readlink-f the file,
and it tells you exactly on the disk where that file is.
So that always kind of comes in handy.
So actually, we talked about programming questions before and sometimes it's really easy to solve programming questions using a sort and
unique um sort will just sort the lines in a file and unique will give you the unique occurrences it
and also can give you counts so if you have like unique and then it occurred this
many times or just the number of distinct lines in a file and so this can be useful for instance
if you have like a log of all the ips that have visited your website you could unique them and
then get just the number of unique ips and know how many unique visitors you had in the log file
right so this like could be a common programming question you could solve this way although they might want you to actually do it programmatically there is a file
or a unix command you could use to just do it yeah i think if you walked into an interview and like
somebody said you know as patrick said like you know give me a histogram of you know the frequencies
of ip addresses and instead of like instead of busting out C++,
you just whipped out a one-liner in Bash
and did the whole thing.
I think that'd be pretty cool.
You get some props for that.
Like Patrick said,
you probably still have to do the problem again.
But that'd be pretty interesting.
So the next ones are TR and TS.
Actually, that's a typo in my notes.
I meant TR and TR-S.
Oh.
So basically, TR...
Let me make sure I get this right.
I'm totally flubbing this.
TR-S is a...
Basically, okay. So TR dash s is a collapse command
so for example let's say you have a file but this file is like maybe user generated content
and what you really want is to you know split the file based on spaces spaces so that you can do a cut, which actually I'll cover cut as well.
The list is getting longer.
Yeah, that's right.
So, you know, but some of the columns have, like, so you'll notice as if, like, you look at, say, the output of PS, right?
The output of PS has usually three columns, but then they use spaces so that all the columns
kind of line up which is great for looking at it but if you want to write a program to analyze
the output of ps it'd be much better if there was just one space between the three columns right
then you wouldn't have to like write some code in c or C++ to like, you know, move that many spaces and all of that.
So tr-s does exactly that. It looks for consecutive characters and then it collapses them.
So like if you put in tr-s and then the letter e, you know, if you, if somebody put the word c
and it would turn into sen, it would just like collapse all the consecutive e's together. This is really
useful because the next command is cut. And cut lets you pull individual columns out of a, you
know, a Unix stream. So again, going back to the PS example, if I did a tr dash s, so now I only have,
you know, one space separating all the columns now i can do a cut
and then the space you can actually represent a space with like a you know a single quote space
single quote then what that will do is it will cut the stream and then after that you do a dash f and
then the number so if i did if I did cut space dash F one,
it's going to pull the first column from that stream of information.
So if I wanted say to kill every process that I started,
I could do a PS and then I could do a,
you know,
send that to cut.
And then now I have just this list of process ids that i could then you know
go through and kill nice and grep is like the de facto search tool so if you have like a file and
you want to look for something in that file you can use grep and there's all sorts of parameters
for it as far as like expressing what you're looking for and tweaking the output,
like showing stuff before and after the line that contains what you're looking for
and all that wonderful stuff.
So grep is a really powerful command
for searching for things in a single file
or in multiple files.
Yep.
Yeah, if you want to do a whole directory,
just do dash R
and put the name of a directory instead of a file
and it'll look at all the files for
whatever you want it to search for.
So then there's
last but not least, there's xargs
and
this is pretty cool. What this does is
it takes some Unix stream,
it looks for all the new lines
and then it splits that up.
So each line of the stream is kind of its own thing.
And then it takes whatever program you put after the X args,
and it executes that program on that string.
So for example, let's say you did a grep dash h dash r on a directory,
and you looked for Patrick.
So dash h will tell grep,
return all of the file names
that have the word Patrick in them.
Then you could pipe that to xargs
and then say xargs emacs
and it'll open emacs with all those files
all ready to go
so that you could change Patrick to JSON.
So... so that you could change Patrick to Jason. So.
This is exhilarating, my friend.
Best podcast content ever.
Oh, man.
Just type this into your terminal and follow along with us.
Yeah.
So now we have,
this will be a little more interesting,
some rare but useful commands.
We have a couple on here.
Have you ever used this one?
Nope.
None of the remainder that you're going to talk about
I've even ever heard of before.
Okay.
We'll go through these pretty quick.
Expand turns taps to spaces. so one thing everyone should know if if you leave the podcast with one bit of information know that the tab key is evil
and should be abolished and anyone who thinks the tab character should exist is a is a bad bad bad person and so expand agrees with me expand takes
any tabs and uh deletes the tab and replaces it with spaces so you can open a file i can open a
file and mine won't look totally screwed up because my tab width is different um fmt is short for
format and you know sometimes you might have you know you might have a lot of
data and like you might have some huge spreadsheet that you want to put into a terminal or something
and it just like it's like the line is 4 000 characters long and it just looks ridiculous
and it just like half of the words get or not half the words but you know some of the words
get cut off at the edge of the page because they wrap around.
So FMT, you just
pipe your, you know,
whatever you're streaming to FMT and it just
comes out looking pretty.
I like my output to be
pretty. Yeah, pretty
output is
guaranteed path to success.
Even better than a successful interview is having pretty output.
So then there's quirky commands.
Have you ever used these, cal or banner?
No, I've never heard of any of the ones I told you already.
Are you on a Mac now?
You surpassed my knowledge, yes.
Type banner and then type some text okay i feel like this is even
more compelling a more compelling podcast
what i don't really know how to explain this so what is the point of this banner
and then you put in some text and uh it just makes your text look ridiculous it just made it really really big
and repeat it over and over like from way back in the day when people had like dot matrix printers
or something and the banner is like somehow useful for that i don't know it's bizarre okay
interesting so it just takes the letter so those of you who weren't watching my screen, if you type banner and then test,
it makes like ASCII art of the word test, basically.
Yeah.
And like, it's just crazy that every Mac computer on earth
has this completely useless program on it.
Cal is also pretty useless.
It just gives you a calendar.
Whoa, wait, that sounds good.
I'm sure this was useful 40 years ago.
No, I didn't know this.
But now it's just a relic.
I'm constantly going into my email program
and using the calendar there.
Oh, are you serious?
Yeah.
It actually is useful?
No, this seems good.
Oh, and I can say how many months.
Yeah, no, this is good i i'm i'm like only like 50 sure you're
not playing alone no no no this seems good to me how do i make it up more than one month
okay anyways i'll figure it out later this seems awesome well you know you'll be pretty
pleased there's also a date command we didn't wait what that one but what does this do oh that's boring but between my calendar i have my command prompt already set up to show
the date like this though okay all right well this was uh if this wasn't the best podcast ever
hodgepodge of things it's been uh it pretty crazy year, definitely a crazy start of the year.
And I think now that we've sort of got our feet in the water,
we'll definitely dive into a programming language next episode.
All right, sounds good.
Now that you've won the lottery and you're a multimillionaire,
you'll have more time to just sit on your uh couch and study programming languages yeah that's right well
sipping mai tais in hawaii but but yeah your couch is not in hawaii nice yeah actually so uh um
i did not even come close to winning the lottery. Oh. But I do, if I did win the lottery,
I would be able to print the amount I won
in ridiculous ASCII art using the banner command.
Yes.
Yes.
All right.
Well, before we keep people up past their bedtimes
listening to this long rambling podcast,
I think we'll call it to a close.
Have a great start of the year.
The start of the year has definitely been pretty exhilarating
and exciting for Patrick and I.
And I hope you guys are having an equally interesting and fun time.
And keep checking out the books of the show.
We really appreciate it that all those proceeds
go to keeping the servers up and running
you guys use terabytes of bandwidth and uh um the books are what help to support all that bandwidth
so uh maybe maybe there isn't very many people actually out there listening to us maybe they're
all just have like evil scripts running against us to download our podcast continuously in hopes that it will run out or cause us to go bankrupt.
Well, you know, if we got DDoSed,
because we have the unique visitors,
if we got DDoSed by that many people,
I would wear that as a badge of courage.
Yes!
No, wait, no, no, no.
That sounds like you're encouraging people
to DDoS us.
Please do not.
Yeah.
No, our server can't take it, really.
I mean, they're mad enough as... they're mad enough at us as it is.
So they don't need to get DDoSed.
All right.
Well, till next time.
All right.
Catch you guys later.
The intro music is Axo by Binar Pilot.
Programming Throwdown is distributed under a Creative Commons Attribution Sharealike 2.0 license.
You're free to share, copy, distribute, transmit the work, to remix, adapt the work,
but you must provide attribution to Patrick and I and sharealike in kind.