Skip to content

Instantly share code, notes, and snippets.

View epicsagas's full-sized avatar
🎯
Focusing

Sangseng Lee epicsagas

🎯
Focusing
View GitHub Profile
@epicsagas
epicsagas / 01-README.md
Created November 30, 2018 08:54 — forked from petemcw/01-README.md
Mac OS X LEMP Configuration

Mac OS X LEMP Configuration

This Gist is a collection of configuration files that can be used to easily setup a Homebrew-based LEMP stack on Mac OS X.

Files in this repository are numbered and named for ordering purposes only. At the top of each file is a section of metadata that denote what component the file belongs to and the default name & location of the file. Feel free to implement it however you want.

Note: some configuration files have hard-coded paths to my user directory -- fix it for your setup

Setup

@epicsagas
epicsagas / createKoreanWon.php
Created April 12, 2019 05:41
Korean won with Korean unit / 한국 금액을 한국어 단위로 처리
function createKoreanWon($price = 0)
{
$krw = '';
if($price) {
$priceArr = str_split(strrev((string)$price), 4);
$unitArr = ['','만','억','조','경'];
$count = min(count($priceArr),count($unitArr));
@epicsagas
epicsagas / fix-permission.sh
Last active December 17, 2019 04:08
Fix laravel directory permission
!#/bin/bash
# commands are from https://tecadmin.net/laravel-file-permissions/
user=$1
group=$2
dir=$3
chown -R $1:$2 $3;
find $dir -type f -exec chmod 644 {} \;
find $dir -type d -exec chmod 755 {} \;

It seems that it does not matter what timezone is on the server as long as you have the time set right for the current timezone, know the timezone of the datetime columns that you store, and are aware of the issues with daylight savings time.

On the other hand if you have control of the timezones of the servers you work with then you can have everything set to UTC internally and never worry about timezones and DST.

Here are some notes I collected of how to work with timezones as a form of cheatsheet for myself and others which might influence what timezone the person will choose for his/her server and how he/she will store date and time.

MySQL Timezone Cheatsheet

@epicsagas
epicsagas / iterm2-solarized.md
Created February 20, 2020 16:28 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@epicsagas
epicsagas / macbook-pro-2011-defective-gpu-fix.md
Created May 19, 2020 05:23 — forked from cdleon/macbook-pro-2011-defective-gpu-fix.md
Macbook Pro 2011 GPU Defect fix macOS Sierra and High Sierra
@epicsagas
epicsagas / pre-commit
Created June 4, 2020 06:05
git pre-commit for phpunit
#!/usr/bin/env php
<?php
// locate this {project root}/.git/hooks/pre-commit)
// and make this runnable with chmod +x
echo "Running tests.. ";
exec('vendor/bin/phpunit', $output, $returnCode);
if ($returnCode !== 0) {
// Show full output
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL;
echo "Aborting commit.." . PHP_EOL;
@epicsagas
epicsagas / mysql-large-db-import
Created September 23, 2020 04:32 — forked from molotovbliss/mysql-large-db-import
Importing Large DB faster MySQL Settings
Source: https://dba.stackexchange.com/questions/83125/mysql-any-way-to-import-a-huge-32-gb-sql-dump-faster
innodb_buffer_pool_size = 4G
innodb_log_buffer_size = 256M
innodb_log_file_size = 1G
innodb_write_io_threads = 16
innodb_flush_log_at_trx_commit = 0
Why these settings ?
innodb_buffer_pool_size will cache frequently read data
@epicsagas
epicsagas / rm_mysql.md
Created September 23, 2020 04:34 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@epicsagas
epicsagas / login-without-password-and-without-copy-key-to-server.md
Created November 4, 2020 16:43 — forked from marcoblos/login-without-password-and-without-copy-key-to-server.md
Step by step: create a pem file to login without password and without copy local keys to remote server. SSH authentication like AWS EC2.
  1. Login with account user (not root)
mkdir pem
cd pem
ssh-keygen -b 2048 -f identity -t rsa
  1. Copy public key contents to authorized_keys