Live data from Hacker News

Don't copy paste from a website to a terminal

thejh.net

231–240 of 257 posts

Re: Don't copy paste from a website to a terminal

#231

Earlier quoted context omitted.

Like many Unix commands, if you don't give cat any files to read, it reads from stdin instead. So first he runs the command (as he typed it), and then while cat is waiting for input he pastes in whatever he copied from the website. Another handy convention is the magic "-" filename (which is not actually a file). Many tools interpret that to mean stdin/stdout. For example here is a trick to copy a tree of files: tar…

I'm glad I asked, I wasn't realizing that `cat` would read from stdin in this case. Makes sense, given the Unix piping philosophy (which I use to great effect on buffers in vim). But wrt your trick to copy a tree of files, what's wrong with `cp -r src dest`, or `scp -r src desthostname:/dest` if it's over a network? Is there some advantage this way?

It's not quite the same as `cp -r`. Tar will create the directories if necessary, but it will also drop the files into an existing folder hierarchy. So you could use it to create/update a few entries in an existing tree of files. For instance you could deploy updates to a website like this (locally):

    cd ~/src/mysite && tar cf - . | (cd /var/www/public_html && tar xvf -)
or this (remotely):

    cd ~/src/mysite && tar czf - . | ssh mysite 'tar xvzf - -C /var/www/public_html'
I would probably actually use rsync for this, but there have been times the tar approach came in handy.

A long time ago, in the dark ages of version control, I used to use tar for rollback-able deployments: I would create a tarball of the files in development to be deployed, and I would create a tarball of the files in production to be overwritten. Then I could just explode one tarball to deploy and the other to rollback. Not something I'd do today, but we didn't always have such nice tools. :-)

Re: Don't copy paste from a website to a terminal

#232
post #209

Earlier quoted context omitted.

The thing is, if you came to me and said "I know everything in this book", I'd say "so let's save money and buy the book instead of hiring you." Interview questions are an opportunity for you to show what you are worth. If you're worth less than a book, it's not a good sign.

Shouldn't interviewers be asking about things that wouldn't be answerable in a book?

Yeah, but most of those kinds of questions take a long time to answer.

Re: Don't copy paste from a website to a terminal

#233

So, ok. Don't copy and paste from a website to a terminal, I get it and I got it the last time that this kind of thing was posted. But if I look around I put so incredibly much trust in total strangers all the time that compared to say ordering a pizza (where the cook could put anything in the food they wanted), driving on the highway (where anybody could swerve any moment if they wanted) and simply walking down the…

I found it really easy to turn off styles, to show the real code. In firefox the View Menu, Page Style, No Style. There are ways to assign this to a keypress or button as well.

The QuickJava add-on for Firefox lets you add toolbar button to toggle CSS (and other features) on and off.

https://addons.mozilla.org/en-US/firefox/addon/quickjava/

Re: Don't copy paste from a website to a terminal

#235
post #158
post #145

Earlier quoted context omitted.

And I thought it was ridiculous when someone had cut and pasted a page from an Oracle manual in response to a set of pre-screening questions for a hiring round, headers included (for a generic SQL question we expected a one sentence answer to). At least that guy didn't pay for it - to my knowledge at least (he did cut and paste most of his answers from various places, though, and got many of them wrong, including an…

Isn't the first place you would go to the Oracle manual? I use stack overflow all the time these days (documentation pages before that existed), not quite cutting and pasting but close enough.

There's a difference. I interviewed one guy who when asked about what a product does, read the introduction to the manual.

Re: Don't copy paste from a website to a terminal

#236

Earlier quoted context omitted.

Notepad? Sounds like your machine is already infested with malware ;-)

Run Atom/ST3 with random plugins downloaded from around the web instead, that's much safer :)

I prefer Emacs with MELPA for my editor based vulnerabilities ;-)

Re: Don't copy paste from a website to a terminal

#238
post #221
post #198

Earlier quoted context omitted.

At my school, it was made very explicit that you'd be immediately expelled for plagiarism (subject to appeal, IIRC, but yes: One strike.)

In a US university I have noticed that some international students (I was one too) took a very liberal attitude towards cheating, I won't name any specific countries (think East though) and noticed students from those countries played fast loose when it came to cheating. Maybe I am being prejudiced or that particular school had a knack for picking cheaters from some countries but not from others. Anyway just my obser…

My anecdata: I did some work at an Australian university engineering department and there was a cultural disconnect with some of the Chinese students; they did not understand that the university wanted them to figure out problems individually -- supposedly they would get together with the smartest students to figure out the answers, and then share them among themselves.

Re: Don't copy paste from a website to a terminal

#240
post #209

Earlier quoted context omitted.

The thing is, if you came to me and said "I know everything in this book", I'd say "so let's save money and buy the book instead of hiring you." Interview questions are an opportunity for you to show what you are worth. If you're worth less than a book, it's not a good sign.

Shouldn't interviewers be asking about things that wouldn't be answerable in a book?

They should be asking things that are relevant to the job.
Post reply on HN