Skip to content

Instantly share code, notes, and snippets.

View tuananhzippy's full-sized avatar

Tuấn Anh Zippy tuananhzippy

View GitHub Profile
@tuananhzippy
tuananhzippy / install_imagemagic_with_heic.sh
Created May 17, 2023 13:50 — forked from hurricup/install_imagemagic_with_heic.sh
How to install ImageMagick 7.1.0-54 with HEIC and WEBP support on Ubuntu 20.04
# inspired by https://gist.github.com/rjnienaber/af47fccb8410926ba7ea35f96c3b87fd
# remove bundled ImageMagick
sudo apt remove imagemagick -y
# install base dependencies
sudo apt-get install -y \
build-essential \
git \
libde265-dev \
@tuananhzippy
tuananhzippy / imagemagick.sh
Created May 17, 2023 13:46 — forked from cupnoodle/imagemagick.sh
Install ImageMagick on Ubuntu 18.04 with HEIF / HEIC support
sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install build-essential autoconf libtool git-core
sudo apt-get build-dep imagemagick libmagickcore-dev libde265 libheif
cd /usr/src/
sudo git clone https://github.com/strukturag/libde265.git
sudo git clone https://github.com/strukturag/libheif.git
cd libde265/
sudo ./autogen.sh
sudo ./configure
@tuananhzippy
tuananhzippy / angularjs_directive_attribute_explanation.md
Created March 24, 2023 09:52 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
yum update -y
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
@tuananhzippy
tuananhzippy / nonAccentVietnamese.js
Created April 26, 2022 03:28 — forked from doraeminemon/nonAccentVietnamese.js
Converting standard Vietnamese Characters to non-accent ones. Example: hải -> hai
function nonAccentVietnamese(str) {
str = str.replace(/A|Á|À|Ã|Ạ|Â|Ấ|Ầ|Ẫ|Ậ|Ă|Ắ|Ằ|Ẵ|Ặ/g, "A");
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a");
str = str.replace(/E|É|È|Ẽ|Ẹ|Ê|Ế|Ề|Ễ|Ệ/, "E");
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e");
str = str.replace(/I|Í|Ì|Ĩ|Ị/g, "I");
str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");
str = str.replace(/O|Ó|Ò|Õ|Ọ|Ô|Ố|Ồ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ỡ|Ợ/g, "O");
str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o");
str = str.replace(/U|Ú|Ù|Ũ|Ụ|Ư|Ứ|Ừ|Ữ|Ự/g, "U");

Multiple MySQL Versions for Development

Options included below:

  • Using Docker docker-compose
  • Using Homebrew brew

Using Docker (recommended)

This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.

@tuananhzippy
tuananhzippy / HOWTO.md
Created April 6, 2022 07:10 — forked from ivanvermeyen/HOWTO.md
Multiple MySQL versions on MacOS with Homebrew

Update - 4 september 2020

Making multiple MySQL versions work with Homebrew was tricky to say the least. Fortunately there are 2 new easy ways that I learned of to achieve this.

DBngin app

As @4unkur and @henrytirla commented below, there is this extremely easy to use app called DBngin, which lets you setup multiple databases (not only MySQL) simultaneously using different ports:

https://dbngin.com/

@tuananhzippy
tuananhzippy / SampleFilterAnalytics.php
Created January 19, 2022 03:05 — forked from ko31/SampleFilterAnalytics.php
Get reports with multiple condition filters for Google Analytics Reporting API v4
<?php
// composer require google/apiclient
/**
* @link https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-php
* @link https://developers.google.com/analytics/devguides/reporting/core/v4/samples
* @link https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet
*/
DROP FUNCTION IF EXISTS proper;
SET GLOBAL log_bin_trust_function_creators=TRUE;
DELIMITER |
CREATE FUNCTION proper( str VARCHAR(128) )
RETURNS VARCHAR(128)
BEGIN
DECLARE c CHAR(1);
DECLARE s VARCHAR(128);
DECLARE i INT DEFAULT 1;
DECLARE bool INT DEFAULT 1;