Skip to content

Instantly share code, notes, and snippets.

View tranphuoctien's full-sized avatar
🎯
Focusing

Tien Tran tranphuoctien

🎯
Focusing
View GitHub Profile
@tranphuoctien
tranphuoctien / index.html
Created March 8, 2018 07:04 — forked from anonymous/index.html
xhr.responseType='document' Test // source http://jsbin.com/bovetayuwu
<!DOCTYPE html>
<!--
Copyright 2012 Eric Bidelman
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
##########################################
# To run:
# wget https://gist.githubusercontent.com/tranphuoctien/d8af0bd4c22ce1497ad2ed459e1aa6ed/raw/53bfc9c513a9cbd346a8c464d45288b82e118845/install-docker-mint-linux.sh && sudo ./install-docker-mint-linux.sh
##########################################
# Kernel version http://stackoverflow.com/a/4024263
versionlte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
versionlt() {
@tranphuoctien
tranphuoctien / odoo_install.sh
Created March 21, 2018 18:13
Auto install Odoo version 11
#!/bin/bash
################################################################################
# Script for installing Odoo on Ubuntu 14.04, 15.04 and 16.04 (could be used for other version too)
# Author: Yenthe Van Ginneken
#-------------------------------------------------------------------------------
# This script will install Odoo on your Ubuntu 16.04 server. It can install multiple Odoo instances
# in one Ubuntu because of the different xmlrpc_ports
#-------------------------------------------------------------------------------
# Make a new file:
# sudo nano odoo-install.sh
#!/bin/bash
################################################################################
# Script for installing Odoo on Ubuntu 14.04, 15.04 and 16.04 (could be used for other version too)
# Author: Yenthe Van Ginneken
#-------------------------------------------------------------------------------
# This script will install Odoo on your Ubuntu 16.04 server. It can install multiple Odoo instances
# in one Ubuntu because of the different xmlrpc_ports
#-------------------------------------------------------------------------------
# Make a new file:
# sudo nano odoo-install.sh
@tranphuoctien
tranphuoctien / media_query.css
Created March 26, 2018 10:25
Query css for cross screen
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
// Scraping implementation using channels
// go run scrap.go
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"sync"

##Add aliases into our ~/.bash_profile Place these lines into your .bash_profile

alias psql='docker run --rm -it psql'
alias redis-cli='docker run --rm -it redis-cli'

##Restart your terminal and that's it You can test it by running this:

redis-cli --help
@tranphuoctien
tranphuoctien / FixEncodingUTF8.md
Last active May 12, 2018 11:44
PG::Error: ERROR: new encoding (UTF8) is incompatible

Some time we got error like this:

$ bin/rake db:create RAILS_ENV="test" PG::Error: 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 "verticals_test" ENCODING = 'unicode'

This how we can resolved

First, we need to drop template1. Templates can’t be dropped, so we first modify it so t’s an ordinary database:

sudo -u postgres psql
@tranphuoctien
tranphuoctien / consumer.go
Last active May 24, 2020 02:53
Auto reconnect rabbitMQ
package consumers
import (
"errors"
"fmt"
"os"
"runtime"
"sync/atomic"
"time"
@tranphuoctien
tranphuoctien / select_table_5yago.php
Created October 18, 2018 00:37
My code in 5 years ago
<?php
$tpt_demo="SELECT * FROM `news`"; // Lệnh select dữ liệu bảng news
$tpt_run_sql=mysql_query($tpt_demo); // Chạy câu lệnh
$tpt_get_columns=mysql_query("SHOW COLUMNS FROM `news`"); // chạy lệnh lấy columns
$tpt_array= array(); // khai báo mãng ( k làm cũng đc =))