Skip to content

Instantly share code, notes, and snippets.

Avatar

Le Anh Tung laptrinhcomvn

View GitHub Profile
@laptrinhcomvn
laptrinhcomvn / Google-Sheet-Form-Post.md
Created Jul 7, 2020 — forked from willpatera/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form
View Google-Sheet-Form-Post.md

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Depreciation Warning: This code is not maintained, and should be seen as reference implementation only. If you're looking to add features or update, fork the code and update as needed.

Run example

You should be able to just open index.html in your browser and test locally.

@laptrinhcomvn
laptrinhcomvn / my.cnf
Created May 18, 2020 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
View my.cnf
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated January 2020 ~
#
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
View gist:3af7c0fd66c4a515348258e9ebdd3103
Steps to recreate tests:
// Create and configure server:
1. Create 2GB DigitalOcean server using Forge
2. Enable OpCache on server
3. Create http://domain1.com (use whatever domain name you have available)
4. Create http://domain2.com (use whatever domain name you have available)
5. Enable SSL on both domains using LetsEncrypt
6. Install: sudo apt-get install apache2-utils
@laptrinhcomvn
laptrinhcomvn / How to create VOD HLS Stream.md
Last active Oct 18, 2019 — forked from mrbar42/README.md
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)
View How to create VOD HLS Stream.md

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
      |- 360p.m3u8
@laptrinhcomvn
laptrinhcomvn / ResourceUtil.java
Created Jul 16, 2018 — forked from Gnzlt/ResourceUtil.java
Android utils class to get a Bitmap from a VectorDrawable Resource Id (Took from http://qiita.com/konifar/items/aaff934edbf44e39b04a)
View ResourceUtil.java
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.VectorDrawable;
import android.os.Build;
import android.support.annotation.DrawableRes;
import android.support.graphics.drawable.VectorDrawableCompat;
View send-fcm-pushnotification.php
<?php
// API access key from Google API's Console; change to cloud messaging tab to get the server token
define( 'API_ACCESS_KEY', 'YOUR_FIREBASE_API_ACCESS_KEY' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
(
'body' => $_GET['body'],
'title' => $_GET['title'],
'vibrate' => 1,
@laptrinhcomvn
laptrinhcomvn / Set up Ubuntu 16.04 server: Nginx + PHP 71 + MySQL + Composer 2017.md
Last active Jul 21, 2019
Set up EC2 Ubuntu server: Nginx + PHP 71 + Composer 2017
View Set up Ubuntu 16.04 server: Nginx + PHP 71 + MySQL + Composer 2017.md

1. Commons

Reset ssh know host for remote ip:

ssh-keygen -R hostname [-f known_hosts_file]

ssh to server, and run as root user using command,

sudo su
View moving_from_jquery_to_vanilla.md

Moving from jQuery to Vanilla

Events

// jQuery
$(document).ready(function() {
  // code
})

// Vanilla
@laptrinhcomvn
laptrinhcomvn / nginx+php+mysql_osx.md
Last active Nov 27, 2017
Set up on Mac OS X El Capitan: Nginx - PHP 5.6.x
View nginx+php+mysql_osx.md

Mac OS X El Capitan setup Nginx - PHP 5.6.x, MySQL 5.7.x, phpMyAdmin

1 Install homebrew

Run this command to install homebrew at system level

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
View Ads block by hosts.txt
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 Les-MacBook-Pro.local # added by Apache Friends XAMPP