Skip to content

Instantly share code, notes, and snippets.

anhduc.bkhn anhducbkhn

Block or report user

Report or block anhducbkhn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:0b814a4b3ad64a0fc3286ed0a7b652a8
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);
}
View gist:c772f011292966596ad1f24a573caed6
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 Aug 1, 2017
Install nginx passenger on ubuntu 16.04
View gist:c91cd56d2ccc7b45fc3aca0b4bf108b3
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 Jun 26, 2017
Configure SSH Key Authentication on a linux server
View gist:3e14b47103c4cc48086fd2562d776117
# 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 Jun 20, 2017
Force user to redirect to cart page in woocommerce
View gist:fddaea578e3163fe4e6df4e042b6524d
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)
View Cogilo_test
<?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);
View nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
View MyScene.js
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,
}
View gist:b3a52348c91e2f4534be78cae3927314
/**
* 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 Jan 18, 2016 — forked from vxnick/gist:380904
Array of country codes (ISO 3166-1 alpha-2) and corresponding names
View gist:d136f5a53950eac1a6e6
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
You can’t perform that action at this time.