Skip to content

Instantly share code, notes, and snippets.

View anhducbkhn's full-sized avatar

anhduc.bkhn anhducbkhn

View GitHub Profile
Remove Data Go Pricing (https://www.go-pricing.com/) plugin
global $wpdb;
$rows = $wpdb->get_results( "SELECT * FROM wp_posts where `post_type` = 'go_pricing_tables'");
foreach ( $rows as $row )
{
wp_delete_post( $row->ID, true);
}
@anhducbkhn
anhducbkhn / gist:c772f011292966596ad1f24a573caed6
Created March 6, 2018 08:05
Install MySQL 5.6 on CentOS 6.x
1. Install the MySQL Community repository
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
rpm -Uvh mysql-community-release-el6-5.noarch.rpm
2. Installing MySQL 5.6
yum -y install mysql mysql-server
3. Verify the correct packages were installed
rpm -qa | grep mysql
it should be:
mysql-community-release-el6-5.noarch
@anhducbkhn
anhducbkhn / gist:c91cd56d2ccc7b45fc3aca0b4bf108b3
Last active August 1, 2017 10:32
Install nginx passenger on ubuntu 16.04
Create user deploy
sudo useradd deploy
sudo usermod -a -G sudo deploy
Login as deploy user
su deploy
Install RVM
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
@anhducbkhn
anhducbkhn / gist:3e14b47103c4cc48086fd2562d776117
Created June 26, 2017 08:31
Configure SSH Key Authentication on a linux server
# Client, generate a ssh key pair if needed
ssh-keygen
# Copy public key to server
ssh-copy-id username@IP
# Disable the Password for Root Login on server
sudo nano /etc/ssh/sshd_config
--> PermitRootLogin without-password
reload ssh
@anhducbkhn
anhducbkhn / gist:fddaea578e3163fe4e6df4e042b6524d
Last active June 20, 2017 09:49
Force user to redirect to cart page in woocommerce
add_action('template_redirect', 'redirect_to_cart_page');
function redirect_to_cart_page()
{
if (is_checkout() and !is_user_logged_in()) {
$carts = WC()->cart->get_cart();
if (!empty($carts)) {
foreach ( $carts as $cart)
<?php
$serverName = 'localhost';
$userName = 'root';
$password = 'a';
$dbName = 'test';
$conn = new mysqli($serverName, $userName, $password, $dbName);
if ($conn->connect_error) {
die ('Connection failed' . $conn->connect_error);
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
import React, { Component, PropTypes } from 'react';
import { View, Text, TouchableHighlight } from 'react-native';
export default class MyScene extends Component
{
static propTypes = {
title: PropTypes.string.isRequired,
onForward: PropTypes.func.isRequired,
onBack: PropTypes.func.isRequired,
}
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component, PropTypes } from 'react';
import {
AppRegistry,
StyleSheet,
@anhducbkhn
anhducbkhn / gist:d136f5a53950eac1a6e6
Created January 18, 2016 06:39 — forked from vxnick/gist:380904
Array of country codes (ISO 3166-1 alpha-2) and corresponding names
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',