Ben Lobaugh Online

I think, therefore I am. I am, therefore I sail

Picture of tables

How to extract a single table from a MySQL sql file

Ever received a large MySQL dump file and only needed one table out of it?

I ran across just this issue. The full database took significant time to import and I only needed a small subsection of the DB, just one single table. Rather than waiting for it all to import, I pulled together a sed command that extracts a single table from the sql file. Check it out:

sed -n ‘/Records of TABLE_NAME/,/Table structure for/p’ FULL_SQL_FILE.sql > table.sql

Replace TABLE_NAME and FULL_SQL_FILE with the names of the table you want and the sql file to pull it from, respectively.

You will now have a table.sql file in your directory that is ready to be imported.

Photo by chuttersnap on Unsplash

WordPress: How to “properly” allow unfiltered uploads

If you are working with a WordPress site and getting the dreaded “Sorry, this file type is not permitted for security reasons.” message, fret no more!

WordPress has a config that allows you to enable unfiltered uploads

define( 'ALLOW_UNFILTERED_UPLOADS', true );

This, however, does not always work. Especially on Multisite, which may only allow unfiltered uploads for super admin users. No bueno.

Filters to the rescue!

Drop this code into your project (I put it in mu-plugins) and viola! You will have unfettered uploads.

add_filter( 'user_has_cap', 'unfiltered_upload' );

function unfiltered_upload( $caps )
{
    $caps['unfiltered_upload'] = 1;
    return $caps;
}

See also this StackExchange message

Temp guest room desk

Guest Desk

It seems part of this REI project has me getting bounces all over the house. Now I am set up in the guest room. Same temp desk set up as in the basement, now with a bed for napping 😉

Temp guest room desk

Converted dining room office workspace

Converted Dining Office

This workspace is in the back dining room of my current real estate project. Made cozy with an area rug and an electric fireplace that was left behind by the previous owner.

Converted dining room office workspace

Grilled Cookies on the BBQ? Putting the Yoshi Grill Mat to the Test

For Mother’s Day, my mother gave me a set of Yoshi Copper Grill Mats. The mats are claimed to be able to cook ANYTHING without leaving a mess, but can it stand up to chocolate chip cookies?

Lets put it to the test!

Want your own Yoshi Copper Grill Mat? https://www.amazon.com/Yoshi-Copper-Grill-Bake-2-Pack/dp/B07DNGWZ5D/

Page 1 of 153

Powered by WordPress & Drip City Coffee