Skip to content

Instantly share code, notes, and snippets.

View dhavalgshah's full-sized avatar
🏠
Working from home

Dhaval Shah dhavalgshah

🏠
Working from home
View GitHub Profile
@dhavalgshah
dhavalgshah / disable-ipv6.sh
Created October 8, 2020 18:05 — forked from kwilczynski/disable-ipv6.sh
Amazon Linux OS tweaks
#!/bin/bash
set -u
set -e
set -o pipefail
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
cat <<'EOF' > /etc/modprobe.d/blacklist-ipv6.conf
@dhavalgshah
dhavalgshah / class-wc-admin-duplicate-order.php
Created May 21, 2018 18:39 — forked from gerdneuman/class-wc-admin-duplicate-order.php
Duplicate Order functionality for WooCommerce
<?php
/**
* Duplicate order functionality
*
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin
* @version 2.7.0
*/
@dhavalgshah
dhavalgshah / functions.php
Created May 9, 2018 06:09 — forked from jnlsn/functions.php
WP Query Orderby Taxonomy Term Name
add_filter('posts_clauses', 'posts_clauses_with_tax', 10, 2);
function posts_clauses_with_tax( $clauses, $wp_query ) {
global $wpdb;
//array of sortable taxonomies
$taxonomies = array('example-taxonomy', 'other-taxonomy');
if (isset($wp_query-&gt;query['orderby']) &amp;&amp; in_array($wp_query-&gt;query['orderby'], $taxonomies)) {
$clauses['join'] .= "
LEFT OUTER JOIN {$wpdb-&gt;term_relationships} AS rel2 ON {$wpdb-&gt;posts}.ID = rel2.object_id
LEFT OUTER JOIN {$wpdb-&gt;term_taxonomy} AS tax2 ON rel2.term_taxonomy_id = tax2.term_taxonomy_id
LEFT OUTER JOIN {$wpdb-&gt;terms} USING (term_id)
@dhavalgshah
dhavalgshah / ICS.php
Created April 4, 2018 21:18 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):
@dhavalgshah
dhavalgshah / patch-xorg-ubuntu-16.04.4.sh
Last active March 6, 2018 04:57
How to patch xorg in ubuntu 16.04.4 (bug of keyboard layout change)
# Bug https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1683383
# Original article https://habrahabr.ru/post/87408/
# @Todo- Automate the version detection
# @Todo- Use version variable in commands below so script don't break when new major or minor versions are released
# create directory
mkdir xorg-server
cd xorg-server
# get sources of required package