Skip to content

Instantly share code, notes, and snippets.

@laptrinhcomvn
laptrinhcomvn / Sublime Text 3 cheating.md
Last active November 17, 2023 06:53
Sublime Text 3 patching

Ref: https://gist.github.com/vertexclique/9839383

Important Note

Please use built-in Terminal.app (of Mac OS X) to type and rune the command, do not use another tool (like iTerm2).

Common step after enter run the patch command:

  • After run the commands, start new Sublime Text app, go to Main Menu > Help > Enter License. On the popup type in any text (example "a") and click Use Licence .
@laptrinhcomvn
laptrinhcomvn / Google-Sheet-Form-Post.md
Created July 7, 2020 17:29 — forked from willpatera/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form

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 / wp-bootstrap5.0-pagination.php
Created January 18, 2022 19:59 — forked from mtx-z/wp-bootstrap5.0-pagination.php
Wordpress 5.7 Bootstrap 5.0 pagination (with custom WP_Query() and global $wp_query support)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* Using Bootstrap 4? see https://gist.github.com/mtx-z/f95af6cc6fb562eb1a1540ca715ed928
*
@laptrinhcomvn
laptrinhcomvn / nginx+php+mysql_osx.md
Last active January 11, 2022 19:58
Set up on Mac OS X El Capitan: Nginx - PHP 5.6.x

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)"
@laptrinhcomvn
laptrinhcomvn / my.cnf
Created May 18, 2020 19:11 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# 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.
#
@laptrinhcomvn
laptrinhcomvn / How to create VOD HLS Stream.md
Last active October 18, 2019 17:16 — forked from mrbar42/README.md
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
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 / Set up Ubuntu 16.04 server: Nginx + PHP 71 + MySQL + Composer 2017.md
Last active July 21, 2019 07:14
Set up EC2 Ubuntu server: Nginx + PHP 71 + Composer 2017

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
@laptrinhcomvn
laptrinhcomvn / ResourceUtil.java
Created July 16, 2018 17:22 — 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)
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;
<?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,