Skip to content

Instantly share code, notes, and snippets.

@dovy
dovy / Sendy.md
Last active January 12, 2022 19:50 — forked from danielepolencic/Sendy.md

Sendy

Sendy is a self hosted email newsletter application that lets you send trackable emails via Amazon Simple Email Service (SES).

Heroku

You can deploy Sendy on Heroku using the following instructions (I assume you've already installed the heroku toolbelt).

  1. On Heroku, create a new app.
  2. Clone that app to your desktop
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')
dev.grab()
print(dev)
# for event in dev.read_loop():
# if event.type == ecodes.EV_KEY:
@dovy
dovy / test.txt
Last active November 1, 2021 14:25
#!/usr/bin/python
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
See https://github.com/torvalds/linux/blob/v5.5-rc5/include/uapi/linux/input.h#L28
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt 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 https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
gcloud init
@dovy
dovy / Redux-required-arg-exampes.php
Last active March 4, 2021 14:16
Example of the required attribute for the Redux Framework.
<?php
$options = array(
'required' => array('id','equals',array( 1,3 ) ) // Multiple values
);
$options = array(
'required' => array('id','equals', array( 1 ) ) // Single value
);
@dovy
dovy / fetch_from_cloud_logging.sh
Created November 20, 2018 21:47
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
[
{
"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 ) ){"
]
<?php
if ( !function_exists( "redux_add_metaboxes" ) ):
function redux_add_metaboxes($metaboxes) {
$boxSections = array();
$boxSections[] = array(
'title' => __('Colors', 'redux-framework-demo'),
'icon' => 'el-icon-home',
'fields' => array(

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

<?php
$boxSections = array();
$boxSections[] = array(
'title' => __('Home Settings', 'redux-framework-demo'),
'header' => __('Welcome to the Simple Options Framework Demo', 'redux-framework-demo'),
'desc' => __('Redux Framework was created with the developer in mind. It allows for any theme developer to have an advanced theme panel with most of the features a developer would need. For more information check out the Github repo at: <a href="https://github.com/ReduxFramework/Redux-Framework">https://github.com/ReduxFramework/Redux-Framework</a>', 'redux-framework-demo'),
'icon_class' => 'icon-large',
'icon' => 'el-icon-home',
// 'submenu' => false, // Setting submenu to false on a given section will hide it from the WordPress sidebar menu!
'fields' => array(