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
======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
bin/rake:16:in `load'
@namnv609
namnv609 / resumable-download.php
Created September 12, 2016 10:43 — forked from kosinix/resumable-download.php
PHP - resumable download
<?php
class ResumeDownload {
private $file;
private $name;
private $boundary;
private $delay = 0;
private $size = 0;
function __construct($file, $delay = 0) {
if (! is_file($file)) {
@namnv609
namnv609 / laravel-nginx
Created November 25, 2016 09:15
NginX and PHP7 with Laravel config
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root <Path to project folder>/public;
index index.php index.html index.htm;
server_name <Server name or IP address>;
location / {
@namnv609
namnv609 / pre-push
Created December 1, 2016 03:08
CI local for Git client
#!/usr/bin/env bash
redColor="\033[0;31m"
noColor="\033[0m"
function exitCodeToText() {
text="${redColor}NG${noColor}"
if [[ "$1" == "0" ]]; then
text="OK"
fi
@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 / 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