Friday, September 15, 2023

Ubuntu Jammy Install MySQL via the Oracle PPA with Modern GPG / Public Key Keyring Method

export GNUPGHOME=/tmp/gpg
mkdir -p /etc/apt/keyrings/
mkdir -p /tmp/gpg
cd /tmp/gpg

gpg --batch --keyserver keyserver.ubuntu.com --recv-keys '859BE8D7C586F538430B19C2467B942D3A79BD29'
gpg --batch --export '859BE8D7C586F538430B19C2467B942D3A79BD29' > /etc/apt/keyrings/mysql.gpg
echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/ubuntu/ jammy mysql-8.0' > /etc/apt/sources.list.d/mysql.list



gpgconf --kill all
rm -rf /tmp/gpg

apt install mysql-server

#todo: script initial config & removal of insecure logins

Friday, April 21, 2023

Javascript OOP Classes are not real-- it is just syntactic sugar!

class MyBaseClass {
    constructor(thingOne, thingTwo) {
        this.thingOne = thingOne;
        this.thingTwo = thingTwo;
    }
    getThingOne() {
        return this.thingOne;
    }
    getThingTwo {
        return this.thingTwo;
    }
}

class MyExtendedClass extends MyBaseClass {
    constructor(thingOne, thingTwo, thingThree) {
        super(thingOne, thingTwo);
        this.thingThree = "thingThree"
    }

    getThingThree() {
        return this.thingThree;
    }
}

let theThings = new MyExtendedClass("foo", "bar", "baz");



This is the helper way to write the following:



function MyBaseClass (thingOne, thingTwo) {
    let newMyBaseClass = Object.create(myBaseClassConstructor);
    newMyBaseClass.thingOne = thingOne;
    newMyBaseClass.thingTwo = thingTwo;
    return newMyBaseClass;
}

let myBaseClassConstructor = {
    getThingOne: function() {
        return this.thingOne;
    },
    getThingTwo: function() {
        return this.thingTwo;
    }
}

function MyExtendedClass(thingOne, thingTwo, thingThree) {
    let newMyExtendedClass = MyBaseClass(thingOne, thingTwo);
    Object.setPrototypeOf(newMyExtendedClass, myExtendedClassConstructor);
    newMyExtendedClass.thingThree = thingThree;
    return newMyExtendedClass;
}

let myExtendedClassConstructor = {
    getThingThree: function() {
        return this.thingThree;
    }
}

Object.setPrototypeOf(myExtendedClassConstructor, myBaseClassConstructor);

const theSquare = MyBaseClass(2,3);
theSquareArea = theSquare.getThingOne() * theSquare.getThingTwo();

const theBox = MyExtendedClass(2, 3, 5);
theCubicVolume = theBox.getThingOne() * theBox.getThingTwo() * theBox.getThingThree();

Followers