Skip to content

Instantly share code, notes, and snippets.

{
"eventId": "b6df5fac-6e32-4d17-837d-e7e647d49fc1",
"createdAt": "2024-03-23T19:01:36.309Z",
"data": {
"responseId": "qYe9WG",
"submissionId": "qYe9WG",
"respondentId": "oBypZV",
"formId": "3yPpb4",
"formName": "Ankieta po zakupie w markecie TEST TEST",
"createdAt": "2024-03-23T13:37:58.000Z",
// Check if the passed hash matches the expected one
if ( !$this->IsWebhookTrusted( $encryption_key, $signature_header, $data['data'] ) ) {
// Hash is not valid
// Prepare response message
$response_data = array(
'status' => 'error',
'response' => array(
'code' => 403,
'message' => 'Hash invalid. Bey, Bey...',
private function IsWebhookTrusted($tallyKeyFromSettings, $receivedSignature, $payLoadBody) : bool {
// Obliczamy oczekiwany podpis HMAC na podstawie klucza Tally i payloadu
$payLoadBodyString = json_encode($payLoadBody);
$expectedSignature = hash_hmac('sha256', $payLoadBodyString, $tallyKeyFromSettings);
error_log("Hash coming from request: " . $receivedSignature);
error_log("Hash saved in settings: " . $tallyKeyFromSettings);
@smiell
smiell / gist:66badaa658cf0e01cc77a015f9106673
Created November 16, 2023 21:57
check3GConnection.sh
#!/bin/bash
# Sprawdź stan połączenia 3G
status=$(sudo sakis3g status)
# Sprawdź, czy połączenie jest aktywne
if [[ "$status" == "E3131 connected to Orange (26003)" ]]; then
echo "Połączenie 3G jest aktywne. Sprawdzanie dostępności internetu..."
# Sprawdź dostępność internetu przez ping
version: "3"
services:
# WireGuard VPN service
wireguard:
image: linuxserver/wireguard:latest
restart: always
container_name: wireguard
cap_add:
- NET_ADMIN