Skip to content

Instantly share code, notes, and snippets.

View anhdiepmmk's full-sized avatar

PHẠM NGỌC ĐIỆP anhdiepmmk

View GitHub Profile
@anhdiepmmk
anhdiepmmk / TopCropImageView.java
Created September 1, 2016 10:16 — forked from arriolac/TopCropImageView.java
Custom Android ImageView for top-crop scaling of the contained drawable.
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by chris on 7/27/16.
@anhdiepmmk
anhdiepmmk / nginx.conf.default
Created January 25, 2017 19:12 — forked from nishantmodak/nginx.conf.default
Default Nginx Conf
#user nobody;
#Defines which Linux system user will own and run the Nginx server
worker_processes 1;
#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores.
#error_log logs/error.log; #error_log logs/error.log notice;
#Specifies the file where server logs.
@anhdiepmmk
anhdiepmmk / 00. tutorial.md
Created April 26, 2017 08:54 — forked from maxivak/00. tutorial.md
Importing/Indexing database (MySQL or SQL Server) in Solr using Data Import Handler
@anhdiepmmk
anhdiepmmk / nginx.conf
Created April 26, 2017 16:46 — forked from turtlesoupy/nginx.conf
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
@anhdiepmmk
anhdiepmmk / OkHttpProgressGlideModule.java
Created September 8, 2017 06:35 — forked from TWiStErRob/OkHttpProgressGlideModule.java
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}
@anhdiepmmk
anhdiepmmk / php-docker-ext
Last active October 22, 2019 04:13 — forked from hoandang/php-docker-ext
Complete list of php docker ext
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
@anhdiepmmk
anhdiepmmk / Dockerfile
Created October 31, 2019 12:56 — forked from shov/Dockerfile
Docker PHP 7.2 fpm with GD jpg, png suppot
FROM php:7.2-fpm
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# make sure apt is up to date
RUN apt-get update --fix-missing
RUN apt-get install -y curl
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
FROM debian:buster-slim
# prevent Debian's PHP packages from being installed
# https://github.com/docker-library/php/pull/542
@anhdiepmmk
anhdiepmmk / _etc_nginx_vhost.d_default
Last active December 26, 2019 07:47
nginx proxy pass
## Start of configuration add by letsencrypt container
location ^~ /.well-known/acme-challenge/ {
auth_basic off;
allow all;
root /usr/share/nginx/html;
try_files $uri =404;
break;
}
## End of configuration add by letsencrypt container
@anhdiepmmk
anhdiepmmk / nginx.gzip.conf
Created December 27, 2019 03:02
Cấu hình nginx với module gzip bật để tối ưu tốc độ trả về của các file json, xml, css, plain text.
server {
listen 80;
server_name your.domain;
root /var/www/html/;
index index.php;
client_max_body_size 10M;
client_body_buffer_size 10M;
location ~* \.php$ {