pbcopy terminal command, which adds “stuff” to the clipboard to be pasted later, is really useful. For example, to download some webpage and put the HTML source in the clipboard:
curl -s http://example.com/ | pbcopy
Here’s a WordPress example; want to get some fresh API salts and keys for a
wp-config.php? Try this:
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | pbcopy
Want to be notified when the download and copy are complete? Add the
say command, like this:
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | pbcopy; say 'Ready to paste';
I use DTerm, which is an excellent little “popup terminal” which inherits the current context, and these commands are super handy here.
I tend to find myself in the terminal.app on my Mac more often than not, SSHing into servers, checking whois, host, and any number of other things. My most frequent incantation is searching the command history so I don’t have to re-type a previous command, something like this:
grep curl ~/.bash_history
I’ll then copy and paste the command and hit return. It’s pretty quick, and I’ve got the muscle memory right down now… but there’s got to be more elegant commands, right? Or course there are. Continue reading Speeding myself up on the commandline
Everytime I need to do this I go into at least five minutes of Googling for a decent solution. The problem is that a lot of people don’t have access to the commandline, so the solutions all reference PHPMyAdmin which is, you know, OK, but I don’t use it or want to install it just to export some quick reports. Other solutions are similarly indirect.
Continue reading Exporting from MySQL to CSV