Command line tools every web dev needs to know
coderholic.com
coderholic.com
one of my favorites is querying dns to get wiki excerpts
dig +short txt bmw.wp.dg.cx
"(BMW), is an independent German automobile manufacturing company founded in 1916. It also produces motorcycles, is the owner of the MINI brand and is the parent company of Rolls-Royce Motor Cars. http://en.wikipedia.org/wiki/BMW"
http://www.commandlinefu.com/commands/view/2829/query-wikipe... cmdfu(){ wget -qO - "http://www.commandlinefu.com/commands/matching/$@/$(echo -n "$@" | openssl base64)/plaintext"; }
It's like man but for one-liners. [URL]/matching/ssh/c3No - Search results for the query
'ssh' (note that the final segment is a base64-encoding
of the search query)
So it's passing the command args through 'openssl base64' to encode them as required by the api. $ echo -n ssh | openssl base64
c3No
It's not immediately clear to me why they require both - base64 encoding might be useful to allow non-printable/special-purpose chars in the URL, but we already have a perfectly good URL-encoding scheme for that.And requiring both (it doesn't seem to work with only one) is just silly.
There is a Django-rewrite of commandlinefu on the way including a saner API.
$ echo 'test' | openssl base64
dGVzdAo=
Which is the same as: $ echo 'test' | base64
dGVzdAo=
The URL is the same as: args="$@"
b64=$(echo -n "$@" | openssl base64)
url="http://www.commandlinefu.com/commands/matching/$args/$b64/plaintext"
For these purposes though, "$@" could probably be replaced with "$*". Technically the URL is invalid since "$@" could introduce non-escaped spaces into the URL.$(<command>) gets replaced by the output of <command>, in our case that means the output of the openssl base64 call, which takes stdin, applies the base64 encoding and prints it out on stdout. echo -n $@ just serves to translate our parameters into something the openssl base64 call can work with (-n means it won't introduce a superfluous newline). I'm not sure why the script uses openssl base64 instead of just base64 (a GNU coreutils utility).
I agree with the sibling that the API requirement to include both verbatim and base64-encoded search terms are fairly bizarre.
A little bit of shell scripting goes a long way in automating away dev work.
Rare are the ones who know how to use these basic commandline tools.
The last time I've shown ngrep to a sysadmin he was like "omagad amazing" - always feels nice :)
But, that's not really an obscure tool. I initially thought everyone knew that, like most know nmap.
Turns out most know nmap and ssh because they're really that well known (generally they don't know most options)
Makes me sad! Command's line easy and fun!
I am frequently amazed to see professional software developers with years of experience in the field, who only type using their two index fingers. You probably do not need to type 120 WPM to be an amazing programmer, but typing without looking at the keyboard is absolutely essential.
I am not the most patient of people and had to bite my tongue a few times when instructing him. I can understand being more comfortable with the mouse than keyboard shortcuts but programming is not the best profession for anyone keyboard-averse to that level.
Of course some people genuinely find the keyboard physically uncomfortable and there's no reason they couldn't still be excellent programmers - but it seems like it would impede the "flow".
Things I suspect you'd be better off getting good at than keyboard shortcuts:
* Regular expression search and replace
* The command line (default Windows command prompt is fine), and the POSIX-style command line tools (default Windows command line tools are NOT fine)
* Some kind of popular scripting-type language (perl/python/ruby/whatever/etc.), if you don't know one already
I like my keyboard shortcuts, but the above have saved me much, much more time over the years.
Then there was the day when he had to merge a huge branch back in TFS. I try not to speak much of that day...
Admittedly, I was typing pretty fast before I started--I think I went from something like 80 wpm to 110. But it was certainly fun!
As an aside, I've found short mental breaks like that really help when I get stuck on some little issue or bug and am not making any progress. It also keeps me from getting too frustrated!
I'm in college taking some CS classes and the actual material is great, but the framework code they give us for projects is really poorly written Python. I've spent more time grappling with Python and their code than I have with AI or compiler concepts! Taking a break whenever I encountered yet another stupid bug helped me avoid spending hours going in circles.
Folks who did not grow up touch typing, though, simply learned to construct a longer-lasting mental model, which they can then write out however slowly. Think of it as a bigger buffer. In rare cases it can become enormous, and people write entire novels in their head before ever putting ink on paper (famous example: "The Diving Bell and the Butterfly", which was written at a rate of about one word every 2 minutes).
Or, they learned to create and capture design decisions in higher-density media (like diagrams or pseudocode), which, again, can then be typed in more slowly.
It's probably much better to judge developers by the quality of their output than how fast they type--especially since most software spends way longer in production and maintenance than it does being developed.
In fact, I'd wager that if someone is typing constantly at 100+ wpm they're probably writing bad code. Or very simple code, I guess. Or they're just transcribing UML or whatever, but nobody here does that anymore do they?
If we assume something like 30 characters per line, and maybe five characters to a word, you'd be writing 600 "words" in a day where you'd write 100 lines, and as many as 6000 "words" in a 1000 loc day.
100 wpm for 600 words means you're saving 6 minutes per day over the 50 wpm guy. Not much, I doubt anyone would care about 6 mins one way or the other. 100 wpm for 6000 words means you're saving an hour over the 50 wpm guy. It's rare you write 1000 loc. I don't know if I've ever done it, myself.
But that's just code. How often do you write non-code related work? Documentation, email, notes, comments, spec, etc. 6000 words per day is probably not uncommon for a developer when you include the noncode writing a dev will do during a day, and when a 100 wpm guy gets done a whole hour before the 50 wpm guy, that's an undeniable advantage.
I don't think time gains because of faster typing don't even factor into a decision, but broader knowledge/experience does.
If someone watched me on Visual Studio without letting me install Viemu first, I'd look like an idiot.
> python -m SimpleHTTPServer
> python -m SimpleHTTPServer 5000
> python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
> python3 -m http.server 8080
Serving HTTP on 0.0.0.0 port 8080 ...> php -S localhost:8080
$ sudo python -m smtpd -n -c DebuggingServer localhost:25Even though this is Google and they probably don't have a problem with this, I don't think you should benchmark servers that don't belong to you. It's not nice and could be mistaken for a DOS attack.
$ http GET http://yourmom.ca/
After that, it's integrated into the System Preferences panel. You simply pick which network conditions you want to simulate.
I think it's also possible to launch it from the xcode Utilities folder w/o installation. Sorry I can't be more coherent w/o my machine in front of me.
$ curl -I news.ycombinator.com
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: private
Connection: close
Keep in mind that this will fire a HEAD request to the server which, depending on web server you use in development, may not return the exact header you'd get with GET (IIRC, Jetty used to do this).I like to use something like this in such situation:
$ curl -s -D /dev/stderr news.ycombinator.com >/dev/null $ curl -s does.not.exist; echo $?
6
$ curl -sS does.not.exist; echo $?
curl: (6) Couldn't resolve host 'does.not.exist'
6
$ curl -i http://news.ycombinator.com curl -v https://github.com
which dumps everything. Including, handily, the HTTPS handshake.Deliver a standard test email, requiring CRAM-MD5 authentication as user me@example.com. An "X-Test" header will be added to the email body. The authentication password will be prompted for.
swaks --to user@example.com --from me@example.com --auth CRAM-MD5 --auth-user me@example.com --header-X-Test "test email"
http://linux.die.net/man/1/swaksecho '{"foo": "lorem", "bar": "ipsum"}' | python -mjson.tool