Skip to content

Instantly share code, notes, and snippets.

import evdev
from evdev import *
import time
#dev =evdev.InputDevice('/dev/input/by-id/usb-SM_SM-2D_PRODUCT_HID_KBW_APP-000000000-event-kbd')
dev =evdev.InputDevice('/dev/input/event1')
# for event in dev.read_loop():
# if event.type == ecodes.EV_KEY:
View test.txt
import struct
import time
import sys
infile_path = "/dev/input/event" + (sys.argv[1] if len(sys.argv) > 1 else "0")
FORMAT represents the format used by linux kernel input event struct
View gcloud.txt
echo "deb [signed-by=/usr/share/keyrings/] cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get install apt-transport-https ca-certificates gnupg
curl | sudo apt-key --keyring /usr/share/keyrings/ add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
gcloud init
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": "",
"match_text": [
"\t\t\t\tif( register_block_type( \"yith/{$block}\", $block_args ) ){"
dovy /
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.
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 /
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.
#!/usr/bin/env python
import json
import argparse
from beautifultable import BeautifulTable
import commands
import time
import os
def print_jobs(cluster_name):
dovy /
Last active Nov 8, 2017
A simple utility to help work with Hometeaching for district leaders. Now updated to work for Presidency members as well.

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.


  • Open Google Chrome (Should work on Firefox or Safari as well)
  • Go to this website:
  • 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 &gt; symbol, button of the window).
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 = "";
// ... give time for script to load, then type (or see below for non wait option)
var $columns = ""
dovy /
Last active Apr 28, 2017
Sickie button
import logging
logger = logging.get_logger(__name__)
import time
from subprocess import Popen, PIPE, STDOUT
import xmlrpclib