Skip to content

Instantly share code, notes, and snippets.

View kungfu321's full-sized avatar
🎯
Focusing

Vo Manh Kien kungfu321

🎯
Focusing
View GitHub Profile
@kungfu321
kungfu321 / default.conf
Last active October 16, 2018 16:03
nginx config sample
# The default server
#
server {
listen 80;
server_name example.com;
location / {
root /var/www/html;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
@kungfu321
kungfu321 / www.conf
Created October 15, 2018 14:50
PHP-FPM config
; Start a new pool named 'www'.
[www]
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
@kungfu321
kungfu321 / lemp-setup.sh
Last active October 17, 2018 01:14
lemp setup
#!/bin/bash
cd ~
sudo yum update -y
sudo yum install epel-release -y
# install php and nginx
sudo yum --enablerepo=remi,remi-php70 install -y nginx php-fpm php-common -y
sudo yum --enablerepo=remi,remi-php56 install -y php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-pecl-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml - y
sudo systemctl stop httpd.service
@kungfu321
kungfu321 / wp-setup.sh
Last active October 23, 2018 09:52
./wp-setup.sh -d _domain -s _ssh-key
#!/bin/bash
# get params
while getopts s:d: option
do
case "${option}"
in
s) SSH_KEY=${OPTARG};;
d) DOMAIN=${OPTARG};;
esac
@kungfu321
kungfu321 / wp.sh
Created November 21, 2018 01:20
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@kungfu321
kungfu321 / install.sh
Last active February 24, 2022 02:38
install vps and wordpress. curl -sO
#!/bin/bash
#######################################################
# HocVPS Script v2.0.4 for CentOS 7
# To install type:
# curl -sO https://hocvps.com/install && bash install
# or
# curl -sO https://hocvps.com/scripts/$(rpm -E %centos)/install && bash install
#######################################################
hocvps_version="2.0.4"
phpmyadmin_version="4.8.0.1" # Released 2018-04-19. Future version compatible with PHP 5.5 to 7.2 and MySQL 5.5 and newer.
@kungfu321
kungfu321 / countries.json
Created July 27, 2019 03:56 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
npm i -s @zeit/next-sass @zeit/next-less node-sass
next.config.js
const withSass = require('@zeit/next-sass')
const withLess = require('@zeit/next-less')
const isProd = process.env.NODE_ENV === 'production'
// fix: prevents error when .less files are required by node
if (typeof require !== 'undefined') {
require.extensions['.less'] = file => { }
@kungfu321
kungfu321 / error_msg.php
Created July 22, 2020 02:19 — forked from sudar/error_msg.php
Creating single select WordPress taxonomies. Explanation at http://sudarmuthu.com/blog/creating-single-select-wordpress-taxonomies/
<?php
/**
* Display an error message at the top of the post edit screen explaining that ratings is required.
*
* Doing this prevents users from getting confused when their new posts aren't published, as we
* require a valid rating custom taxonomy.
*
* @param WP_Post The current post object.
*/
function show_required_field_error_msg( $post ) {
@kungfu321
kungfu321 / gist:2df2c2ab8bd1b2876d415d621e7e9eee
Created September 26, 2020 06:13 — forked from thachpham92/gist:d57b18cf02e3550acdb5
Tất cả các tham số trong WP_Query
// Source: https://gist.github.com/luetkemj/2023628
// Xem hướng dẫn WP_Query toàn tập: http://goo.gl/kRpzTz
<?php
$args = array(
//////Author Parameters - Tham số lấy bài viết theo tác giả
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters
'author' => '1,2,3,', //(int) - Các ID tác giả cần lấy bài viết (thêm dấu - vào để loại trừ tác giả, ví dụ: -14, -20)
'author_name' => 'luetkemj', //(string) - Lấy bài viết dựa theo tên nick name của tác giả
'author__in' => array( 2, 6 ), //(array) - Lấy bài dựa theo ID của tác giả