Skip to content

Instantly share code, notes, and snippets.

@LucaTNT
LucaTNT / apritiSesamo.py
Last active July 26, 2017 18:00
Script that triggers a relay connected to GPIO 25 on a Raspberry Pi in order to open a garage door
#!/usr/bin/env python
from gpiozero import LED, Button
from time import sleep
from flask import Flask
import datetime
portone = LED(25)
app = Flask(__name__)
@LucaTNT
LucaTNT / azure-text-to-speech.py
Last active April 20, 2022 15:53
Script that synthesizes EasyApple intros with Azure's text-to-speech APIs
import requests
def getToken():
req = requests.post("https://westeurope.api.cognitive.microsoft.com/sts/v1.0/issuetoken",
headers={"Ocp-Apim-Subscription-Key": "YOUR_AZURE_API_KEY_HERE"},
)
return req.text
def textToMp3(text, voice="it-IT-ElsaNeural"):
@LucaTNT
LucaTNT / sign-stripe-webhook-request.sh
Created June 26, 2022 15:45
Shell script to sign a Stripe webhook event
#!/usr/bin/env bash
WEBHOOK_DESTINATION="http://localhost:3000/stripe/webhook"
WEBHOOK_SECRET="whsec_ENTER_YOURS_HERE"
if [[ ! "$#" -eq 1 ]]; then
echo "USAGE: $0 /path/to/event.json";
exit 1;
fi
timestamp="$(date +%s)."