Skip to content

Instantly share code, notes, and snippets.

View tintnaingwin's full-sized avatar
🎯
Focusing

Tint Naing Win tintnaingwin

🎯
Focusing
View GitHub Profile
@tintnaingwin
tintnaingwin / HOWTO.md
Created July 11, 2019 18:29 — forked from ivanvermeyen/HOWTO.md
Multiple MySQL versions on MacOS with Homebrew

Multiple MySQL versions on MacOS with Homebrew

At the time of writing (december 2018), there aren’t any up-to-date and easy to apply guides on how to switch between different MySQL version on a Mac using Homebrew . Or at least, I didn’t find any.

So I picked up a few things here and there and finally managed to connect all the pieces of the puzzle. I hope this guide can help you and the future me. If anyone knows of a better way to accomplish this, I do hope they will share their insight :)

The basic idea here is that you need to install all MySQL versions one at a time and assign each its own data directory.

I am using Homebrew 1.8.5. (brew -v)

@tintnaingwin
tintnaingwin / guide.md
Created July 20, 2018 04:19 — forked from fyrebase/guide.md
Setup individual pools for PHP-FPM and NGINX - http://www.binarytides.com/php-fpm-separate-user-uid-linux/

Php-FPM

Php fpm is the new way to setup php to run with your webserver. Php-fpm is a fastcgi process manager for php that is totally separate from the webserver. The webserver communicates with fpm through a socket and passes the name of the script to execute. So fpm can run with any web server that is fastcgi compatible.

I recently moved from my old shared hosting to linode. Linode provides linux vps hosting at economic prices. However the servers are totally unmanaged are just raw linux machines that have shell access. So through the shell you have to setup everything including the web server, php and the web files.

So this time I decided to go with the combination of nginx and php-fpm. I had multiple sites to setup on this new webserver. Nginx deals with these through separate server blocks (aka vhost in apache). However there was another thing needed. Php on each site should run with its own user and not the nginx common user named www-data.

Running each site with its own uid/gid is more secure and

@tintnaingwin
tintnaingwin / UpgradeTimestamps.php
Created July 4, 2018 07:07 — forked from wayneashleyberry/UpgradeTimestamps.php
Laravel Artisan command to upgrade timestamp columns for MySQL 5.7 strict mode.
<?php
namespace App\Console\Commands;
use DB;
use Illuminate\Console\Command;
class UpgradeTimestamps extends Command
{
/**
@tintnaingwin
tintnaingwin / chukify.js
Created June 23, 2018 06:37
Splitting a JS array into N arrays
function chunkify(a, n, balanced) {
if (n < 2)
return [a];
var len = a.length,
out = [],
i = 0,
size;