Skip to content

Instantly share code, notes, and snippets.

@gabriserra
gabriserra / driver.c
Created October 12, 2022 12:44
Get HW IRQ number from Linux IRQ
static long long irq_to_hwirq(unsigned int irq)
{
struct irq_data *irq_data;
irq_data = irq_get_irq_data(irq);
if (irq_data == NULL)
{
pr_err("driver: unable to find irq %u descriptor.\n", irq);
return -EINVAL;
#!/bin/bash
cd /var/www/wordpress
for site in $(wp site list --field=url)
do
echo "Checking" $site
wp wc --url=$site shop_coupon list --user=<your-admin-email> | grep <"coupon-code"> > /dev/null
@gabriserra
gabriserra / googlecloud-text-to-speech.sh
Last active July 8, 2020 13:24
Allows to generate an mp3 audio track of specified text. Uses Google Cloud service and need Google Cloud CLI
# export Google Credentials service account path
export GOOGLE_APPLICATION_CREDENTIALS=~/Keys/da-service-account.json
curl \
-vX POST https://texttospeech.googleapis.com/v1/text:synthesize \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @ttsbody.json > synthesize-text.txt # specify your json file
# get response and encode as mp3
@gabriserra
gabriserra / woo-close-store.php
Created March 24, 2019 21:13
Permit to close a Woocommerce store, enabling the use of a message to warn users.
<?php
/*
Plugin Name: Woo Close Store
Plugin URI: https://github.com/gabriserra/woo-close-store
Description: Woo Close Store handle store closing phase.
Version: 0.1
Author: Gabriele Serra
Author URI: https://gabripr0.altervista.org
Text Domain: woo-close-store
License: MIT