Monday, October 26, 2015

Export a CVS file from MySQL

To dump all the records from a table called "sale" into the file /tmp/sale.csv as a CSV file, use the following SQL query:

SELECT *
INTO OUTFILE '/tmp/sale.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'
FROM sale

Showing all changed file buffers in vim

So, editing a rails project in vim + NERDTree, I often edit several files and then browser refresh to check my work.  If I forget to save a particular file, it's problematic to check all the buffers. In #vim, they told me about ':ls', which shows all buffers in that session, with a + before the ones that are unsaved.  Also, ':ls +' will just show the unsaved buffers.

Also, the % indicates the current buffer, the # indicates the buffer you get to with a ':e#'.

TIL...

Saturday, October 24, 2015

rsync

I expect to be adding to this...

When refreshinging the saver directory from bargabus.com to local, get only the new files with...

rsync -ahv --ignore-existing user@bargabus.com:~/saver/* .

Friday, October 9, 2015

Using the 'less' pager in the mysql client

In iTerm2 on OS X, the default less is rather wonky in the mysql client.  I use it as my pager.  Anyway, I added the -S flag to my less options and things got better.

export LESS='-S'