Skip to content

Instantly share code, notes, and snippets.

View katalystsol's full-sized avatar

Don Cranford katalystsol

View GitHub Profile
@katalystsol
katalystsol / upgrade-maria-db-on-ubuntu
Created August 29, 2019 18:42
Upgrade MariaDB 10.3 to 10.4 on Ubuntu 18
# https://mariadb.com/kb/en/library/upgrading-from-mariadb-103-to-mariadb-104/
# Add MariaDB APT repo
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main'
sudo apt-get update
# Stop MariaDB
sudo systemctl stop mysql
@katalystsol
katalystsol / laravel_convert_char_36_uuid_to_binary_16
Last active July 22, 2019 20:48
Laravel - copy char_36 column to binary_16 column
// For use with dyrynda/laravel-efficient-uuid && dyrynda/laravel-model-uuid
// Can be used for other Laravel conversions as well...
// Assumes you rename the uuid CHAR(36) column to uuid_save and add a uuid BINARY(16) column before running this via artisan tinker
// Replace App\Model with the appropriate model
$items = App\Model::all();
foreach ($items as $item) {
if (empty($item->uuid_save)) {
echo 'uuid_save is empty'.PHP_EOL;
git stash
git fetch --all
git reset --hard origin/[branch_name]
@katalystsol
katalystsol / Get Laravel Storage path
Created January 4, 2018 20:33
Get storage path used by the Laravel Storage facade
// set the disk('local') to the desired disk to check
Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix();
@katalystsol
katalystsol / gist:3bee4010300d94daaacfab87c0023b79
Created September 27, 2017 19:04
Update the old MD5 hash to the new bcrypt - one approach
/* Update the old MD5 hash to the new bcrypt -- rough outline */
if (strlen($member['password']) === 32) {
if ($member['password'] == md5( $_POST['password'] )){
$password = password_hash( $_POST['password'], PASSWORD_BCRYPT );
$DB->query("UPDATE members SET password='{$password}' WHERE id='{$member['id']}';");
$auth_success = true;
}
} else {
/* Not 32 characters? Then it is a bcrypt password */
if (password_verify($_POST['password'], $member['password'])) {