Skip to content

Instantly share code, notes, and snippets.

View PatelUtkarsh's full-sized avatar
🧘

Utkarsh Patel PatelUtkarsh

🧘
View GitHub Profile
@westonruter
westonruter / .gitignore
Last active June 8, 2020 17:02
Now available on the WordPress.org plugin directory: https://wordpress.org/plugins/lazy-loading-oembed-iframes/
.svn
@SeanChristopherConway
SeanChristopherConway / docker-compose.yaml
Last active June 15, 2022 00:30
Docker Pihole with unbound for authoritative, validating, recursive caching DNS
version: "3.7"
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
dns: 127.0.0.1
restart: unless-stopped
links:
- unbound
@imyelo
imyelo / frpc.service
Last active April 7, 2024 11:06
run frp client as a service on windows and ubuntu / debian
# 1. put frpc and frpc.ini under /usr/local/frpc/
# 2. put this file (frpc.service) at /etc/systemd/system
# 3. run `sudo systemctl daemon-reload && sudo systemctl enable frpc && sudo systemctl start frpc`
# Then we can manage frpc with `sudo service frpc {start|stop|restart|status}`
# See also: https://nosame.net/use-frp-to-reverse-proxy-your-nas/
# Alternative for server:
# - Offical: https://github.com/fatedier/frp/blob/a4cfab6/conf/systemd/frpc%40.service
[Unit]
@mort3za
mort3za / git-auto-sign-commits.sh
Last active January 30, 2024 10:31
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@PatelUtkarsh
PatelUtkarsh / index.js
Last active January 14, 2020 06:01
Send pushbullet msg on website hit.
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Respond to the request
* @param {Request} request
*/
async function handleRequest(request) {
<?php
/**
* Plugin Name: Customize Changesets Admin UI
* Description: Enable revisions for customize changeset posts and enable admin screens.
* Author: Weston Ruter, XWP
*
* @package Customize_Changesets_Admin_UI
*/
namespace Customize_Changesets_Admin_UI;
@kasparsd
kasparsd / clone-popular.sh
Last active January 3, 2024 16:06
Get the top 1000 most popular plugins on WordPress.org
@faishal
faishal / wpdb-in-query-prepare.php
Last active April 11, 2016 13:07
WPDB In Query Prepare
<?php
global $wpdb;
if ( is_array( $ids ) ) {
$in_str_arr = array_fill( 0, count( $ids ), '%d' );
$in_str = join( ',', $in_str_arr );
$form_id_where = $wpdb->prepare( "ID IN ($in_str)", $ids );
} else {
$form_id_where = $ids> 0 ? $wpdb->prepare( 'ID=%d', $ids ) : '';
}
@danielbachhuber
danielbachhuber / collection-filter.js
Last active April 18, 2023 20:30
Add a custom taxonomy dropdown filter to the WordPress Media Library
(function(){
/**
* Create a new MediaLibraryTaxonomyFilter we later will instantiate
*/
var MediaLibraryTaxonomyFilter = wp.media.view.AttachmentFilters.extend({
id: 'media-attachment-taxonomy-filter',
createFilters: function() {
var filters = {};
// Formats the 'terms' we've included via wp_localize_script()
@faishal
faishal / wp-mu-cron.sh
Created October 23, 2015 08:13
Wordpress Multisite Crontab using WP-CLI
WP_PATH="/var/www/site_path"
for SITE_URL in = $(wp site list --fields=domain,path,archived,deleted --format=csv --path="$WP_PATH" | grep ",0,0$" | awk -F ',' '{print $1 $2}')
do
echo $SITE_URL
for EVENT_HOOK in $(wp cron event list --format=csv --fields=hook,next_run_relative --url="$SITE_URL" --path="$WP_PATH" | grep 'now$' | awk -F ',' '{print $1}')
do
echo $EVENT_HOOK
wp cron event run "$EVENT_HOOK" --url="$SITE_URL" --path="$WP_PATH" > /dev/null 2>&1
done
done