Wednesday, August 28, 2019

Homemade Taco Seasoning

I haven't made this yet, but I don't want to lose it

https://gimmedelicious.com/2018/03/16/the-best-homemade-taco-seasoning/


Wednesday, July 31, 2019

EXIF metadata with a Promise

I had occasion to use exiftool recently, but instead of a callback, I'd rather use promises.

This is what I came up with:

const exif = require('exiftool');
const util = require('util');

const exif_metadata = function (data) {
    return new Promise((resolve, reject) => {
        exif.metadata(data, (err, metadata) => {
            if (err) {
                reject(new Error(err));
            } else {
                resolve(metadata);
            }
        });
    });
};


Worked great!

const fs_readFile = util.promisify(fs.readFile);
 

Promise.resolve()
  .then(() => {
    return fs_readFile(path);
  })
  .then(data => {
    return exif_metadata(data);
  })
  .then(metadata => {
    console.log('metadata: %O', metadata);
  })
  .catch(error => {
    res.send(error.toString());
  });

Saturday, July 27, 2019

Add Port to UFW

I'm running UFW (uncomplicated firewall) to restrict traffic into my Linux system.

And while being super restrictive is generally a good thing, there are times when you have to poke a new hole and connect from another system inside the house.

Usually it's a new app running on a new port and since I never remember the command to allow this, here it is:

$ sudo ufw allow from 192.168.1.0/24 to any port 3100

You're welcome, future self!

Saturday, July 20, 2019

The DX-M04 Shelving System

My dad bought a DX-M04 shelfy thing and I was tasked with its assembly.


I don't think a nicer set of shelves can be had at any price. And do you see the little screwdriver pictured in the instructions? YES, the DX-M04 really does come with a screwdriver!! And the bottom panel (part #3) has feet. Yes, they really did think of everything.

If I could make one suggestion:

At step three, you might want to leave the bottom a little loose, so when, in step four, you insert the back, you can wiggle it into the groove in the bottom. Then after you've installed the top in step five, you can go back and tighten the bottom.

If you need some shelves, you can't go wrong with the DX-M04. No, no idea where you'd buy them, but for the right price, I can put my hands on a really well assembled set.

Friday, July 19, 2019

MySQL CRAZIES

Did you install a new MySQL and things just aren't working the way you're used to?

WHAT?? ME TOO!!

In this case, I'm inserting just a few columns, and there are non-specified columns without default values.

In my other database it just works - I know, not correct behavior, but it's what I'm used to.

In my new database I get this error:

ERROR 1364 (HY000): Field 'xxx' doesn't have a default value

So what's the difference?

STRICT MODE

Thanks, documentation!!

Before, strict mode. Giving me an error...

mysql> select @@GLOBAL.sql_mode;

+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@GLOBAL.sql_mode                                                                                                                         |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


After, non-strict mode. Working like my other database!

mysql> SET GLOBAL sql_mode = '';
Query OK, 0 rows affected, 1 warning (0.00 sec)

Tuesday, May 14, 2019

MySQL Passwords

I'll never remember this unless I write it down here. And hey, maybe it will help somebody else.

Problem:

  • MySQL version 8+
  • github.com/go-sql-driver/mysql
  • db, err = sql.Open("mysql", "username:password@/database")
    (no error)
  • query, err := db.Query("SELECT * FROM TABLE")
    this authentication plugin is not supported

Solution:

mysql> alter user 'username'@'localhost' identified with mysql_native_password by 'password';

See also: https://github.com/go-sql-driver/mysql/issues/785

Friday, March 08, 2019

How to Cook Chicken

This one, too.

375 degrees for 20 minutes, was it?

WIP: I'll note more detail next time.

How to Cook Salmon

I'm going to forget if I don't write this down.

- 1 lb salmon
- couple TBS oil
- Fish seasoning (salt, etc)

425 deg, 25 min

WIP: I'll write down more about this when I get a chance