Skip to content

Instantly share code, notes, and snippets.

View namnv609's full-sized avatar
🥰
Preparing for something new

NamNV609 namnv609

🥰
Preparing for something new
View GitHub Profile
@namnv609
namnv609 / gist:055023db0ff9b4b73686280e193f179a
Created December 8, 2016 01:45 — forked from tonykwon/gist:8910261
MySQL - Row size too large - BLOB prefix of 768 bytes is stored inline
-- Error Message: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
--
-- our table name that has this issue is XYZ
--
SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=ON;
ALTER TABLE XYZ ROW_FORMAT=COMPRESSED;
@namnv609
namnv609 / index.html
Created December 9, 2016 09:48
Remove the spaces in HTML
<ul>
<li>
one</li><li>
two</li><li>
three</li>
</ul>
<!-- or -->
<ul>
<li>one</li
><li>two</li
@namnv609
namnv609 / digital_ocean_setup.md
Created March 4, 2017 10:01 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

@namnv609
namnv609 / .manifest
Created March 10, 2017 04:12
chrome extension using a content script to access the `window` object
{
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["inject.js"],
"all_frames": true
}
],
"web_accessible_resources": [
"content.js"
@namnv609
namnv609 / vietnam-mobile-phone-classify.php
Created February 19, 2016 08:54
Vietnam mobile phone classify
<?php
$phones = [
"0987654321",
"0912345678",
"01234567890",
"01650930293",
"0992938392",
"01882938493",
"0902938292",
@namnv609
namnv609 / install-ror-on-centos-6.md
Created September 11, 2017 08:40
Install Ruby on Rails server on CentOS 6

Install system requirements

  • sudo yum install wget git vim

Installation

  • Install Ruby and Bundler
    • sudo yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel readline-devel
    • wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.3.tar.gz
    • tar -zxvf ruby-2.3.3.tar.gz
    • cd ruby-2.3.3
    • ./configure
@namnv609
namnv609 / gcc 5 on ubuntu 14.04
Created October 13, 2017 06:58 — forked from beci/gcc 5 on ubuntu 14.04
use gcc 5.x on ubuntu 14.04
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
@namnv609
namnv609 / docker-upstart-script
Created December 13, 2017 06:57
Docker custom upstart script
#!/bin/bash
# /root/upstart-script
# Add line bellow to /etc/bash.bashrc in Docker container
# cat /root/upstart-script | bash
is_sudoer() {
if [ $UID -ne 0 ]; then
echo "Please run this script with sudo permission"
exit 1
@namnv609
namnv609 / aws-ec2-meminfo.sh
Created January 11, 2018 07:05
Check server (Amazon EC2) meminfo
#!/bin/bash
# Created by NamNV609
read -p "Please enter host username (ec2-user): " ipUsername
read -p "Please enter host IP address: " ipAddr
ipUsername=${ipUsername:-"ec2-user"}
echo "Execute command: ssh $ipUsername@$ipAddr cat /proc/meminfo | awk 'NR < 3 {print}'"
@namnv609
namnv609 / logrotate-puma-sidekiq
Created July 24, 2018 03:47
Logrotate configuration for Puma and Sidekiq
/path/to/log/folder/*.log {
su deployer deployer
daily
rotate 7
missingok
dateext
compress
notifempty
olddir /path/to/old/folder
sharedscripts