Skip to content

Instantly share code, notes, and snippets.

View dyanamic_wp_plugin_block_registration.json
[
{
"slug": "yith-woocommerce-brands-add-on",
"name": "YITH WooCommerce Brands Add-On",
"version": "1.3.11",
"active_installs": 10000,
"url": "https://yithemes.com/themes/plugins/yith-woocommerce-brands-add-on/",
"match_text": [
"\t\t\t\tif( register_block_type( \"yith/{$block}\", $block_args ) ){"
]
@dovy
dovy / fetch_from_cloud_logging.sh
Created Nov 20, 2018
It's a REAL pain to figure out how to grab the data from Google cloud logging. This script lets you grab historic data and save locally so you can process since Cloud Logging Sync's won't do anything historic.
View fetch_from_cloud_logging.sh
gcloud beta logging read "resource.type=\"dataflow_step\" resource.labels.job_id=\"2018-11-13_09_13_59-6912497806535022683\" OR \"timestamp>=\\\"2018-11-12T00:00:00Z\" OR \"timing:\" timestamp<=\"2200-01-01T00:00:00.000000000Z\" timestamp<\"2018-11-20T20:20:01.065Z\"" --format=json --limit 100000 | jq -rnc --stream 'fromstream(1|truncate_stream(inputs)) | .jsonPayload.message' >> gcs.txt
@dovy
dovy / gcs_cluster_status.py
Last active Feb 16, 2018
Utility to make it easy to monitor a single cluster or a prefix name for multiple clusters using gcs dataproc. Be sure to run `pip install beautifultable` before running.
View gcs_cluster_status.py
#!/usr/bin/env python
import json
import argparse
from beautifultable import BeautifulTable
import commands
import time
import os
def print_jobs(cluster_name):
@dovy
dovy / README.md
Last active Nov 8, 2017
A simple utility to help work with LDS.org Hometeaching for district leaders. Now updated to work for Presidency members as well.
View README.md

What is this?

This is a utility to properly output all the assignments and teachers in a way that would allow easy email or text message generation.

Instructions

  • Open Google Chrome (Should work on Firefox or Safari as well)
  • Go to this website: https://www.lds.org/htvt/?lang=eng#/companionships
  • Right click on the page, and click on Inspect
  • Click on the Console tab at the top.
  • Copy the code above and paste it in the console (starts with a > symbol, button of the window).
@dovy
dovy / get_table_query.js
Last active Jul 25, 2017
Use this to get a SQL statement for a BigQuery table. You can run use this in the console of chrome/firefox when the desired BigQuery table is selected. Great for casting specific columns.
View get_table_query.js
if (typeof jQuery == 'undefined') {
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type (or see below for non wait option)
jQuery.noConflict();
}
var $columns = ""
$('.schema-table-field').each(function(e){
@dovy
dovy / README.md
Last active Apr 28, 2017
Sickie button
View README.md
View supervisor_health.py
#!/usr/bin/python
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.get_logger(__name__)
import time
from subprocess import Popen, PIPE, STDOUT
import xmlrpclib
View cv2_python_capture.py
import cv2
import time
import multiprocessing
import os
start_time = time.time()
# Used when trying to thread
def process_thread(ports):
for i in ports:
@dovy
dovy / gist:b98c2668a40822d1328b
Created Aug 11, 2015 — forked from ultimatemember/gist:48bf0a269af5d182ad9b
EDD Open Metrics: Show various sale stats
View gist:b98c2668a40822d1328b
// Avg downloads per customer
function sc_edd_avg_downloads_per_customer( $atts ) {
$amount = 0;
$query = new WP_Query( array( 'post_type' => 'download' ) );
foreach( $query->posts as $post ) {
$amount = $amount + edd_get_download_sales_stats( $post->ID );
}
$amount = $amount / edd_count_total_customers();
return number_format( $amount, 2 );
}