Skip to content

Instantly share code, notes, and snippets.

@ketanshah79
ketanshah79 / update_diviframework_faq_post_type_args.php
Created April 22, 2019 03:39
WordPress filter to change diviframework faq post type args
<?php
// Add this to your child theme's function.php file.
// Make sure you flush the rewrite rules.
// On wp cli you can 'wp rewrite flush'
// Or goto WordPress Admin > Settings > Permalink and save the settings which will flush the rules.
add_filter(
'df_faq_post_type_args', function ($args) {
$args['public'] = true;
$args['exclude_from_search'] = false;
@ketanshah79
ketanshah79 / sample-nginx.conf
Created February 21, 2019 07:27 — forked from dimitardanailov/sample-nginx.conf
Configuration for Laravel 5 application and Nginx
server {
listen 80 default deferred;
server_name laravel-application.com;
# http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
access_log /var/www/laravel-app/access.log;
error_log /var/www/laravel-app/error.log;
root /var/www/laravel-app/public/;
{
"autocomplete": true,
"autoimport": true,
"enable_auto_align": true,
"engine": "fmt.phar",
"format_on_save": true,
"indent_with_space": 4,
"options":
[
"-n"
@ketanshah79
ketanshah79 / monitor-dns-update.sh
Created September 20, 2018 05:26
Monitor changes to DNS entries with this script. Use it with crontab to have a peace of mind
#!/bin/bash
#
# What should we monitor
#
DNS=$1
DOMAIN=$2
KEYWORD=$3
OUTPUT=$(dig ${DNS} ${DOMAIN} +short 2>&1)
# Enable this for testing if needed
@ketanshah79
ketanshah79 / nginx-wp-uploads-redirect.conf
Created September 18, 2018 07:33
nginx config to redirect wordpress uploads url requests to production server
# Matches any URL containing /wp-content/uploads/
location ~ "^(.*)/wp-content/uploads/(.*)$" {
try_files $uri @prod_serv;
}
# Will redirect requests to your production server
location @prod_serv {
rewrite "^(.*)/wp-content/uploads/(.*)$" "https://production.com/wp-content/uploads/$2" redirect;
}
@ketanshah79
ketanshah79 / letsencrypt-hostname.sh
Created September 28, 2016 05:58 — forked from xgin/letsencrypt-hostname.sh
Secure plesk clean installation with hostname certificate by Let's Encrypt
#!/bin/bash -e
### Copyright 1999-2015. Parallels IP Holdings GmbH. All Rights Reserved.
### Secure plesk clean installation with hostname certificate by Let's Encrypt
export PYTHONWARNINGS="ignore:Non-standard path"
LE_HOME=${LE_HOME:-"/usr/local/psa/var/modules/letsencrypt"}
HOSTNAME=$(hostname)
# Use staging server for testing
# --server https://acme-staging.api.letsencrypt.org/directory
@ketanshah79
ketanshah79 / 0_reuse_code.js
Created September 27, 2016 03:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ketanshah79
ketanshah79 / host-manager
Created May 1, 2016 17:56 — forked from nddrylliog/host-manager
A command-line utility to manage the /etc/hosts file.
#!/bin/bash
# Idea and interface taken from https://github.com/macmade/host-manager
path="/etc/hosts"
addusage="Usage: `basename $0` -add host address"
remusage="Usage: `basename $0` -remove host"
case "$1" in
-add)
if [ $# -eq 3 ]; then
if [[ -n $(grep "^$3.*[^A-Za-z0-9\.]$2$" ${path}) ]]; then