Skip to content

Instantly share code, notes, and snippets.

View r0yfire's full-sized avatar

Roy Firestein r0yfire

View GitHub Profile
@r0yfire
r0yfire / adyen-to-autohost.ts
Created January 20, 2025 11:52
Adyen webhook event to the Autohost Payment Event expected format
/** https://docs.autohost.ai/api#operation/reservations-payment-event **/
/**
* Map 3DS status from Adyen to our format
* @param additionalData Additional data from Adyen notification
* @returns Mapped 3DS status
*/
function map3DSStatus(additionalData: Record<string, any>): string | undefined {
// Check 3DS2 status first (preferred)
const threeDSVersion = additionalData.threeDSVersion;
@r0yfire
r0yfire / stripe-to-autohost.ts
Last active January 21, 2025 12:52
Convert Stripe webhook event to the Autohost Payment Event expected format
/** https://docs.autohost.ai/api#operation/reservations-payment-event **/
/**
* Get the event type and status from a Stripe event
* @param {any} event - The Stripe event
* @returns {{event_type: string, event_status: string}} - The event type and status
*/
const stripeEventType = (
event: any
): { event_type: string; event_status: string } => {
AWSTemplateFormatVersion: '2010-09-09'
Description: CloudFormation template for Flagsmith Platform
Parameters:
ApexDomain:
Description: The domain name for the Flagsmith Platform (e.g., "example.com")
Type: String
Default: example.com
StageName:
Description: The environment for the Flagsmith Platform (e.g., "prod")
@r0yfire
r0yfire / chat.py
Last active March 4, 2024 19:15
Voice Chat with LLMs
"""
Originally posted on:
https://royfirestein.com/blog/real-time-voice-chat-with-ai
"""
import os
import wave
from pydub import AudioSegment
from groq import Groq
@r0yfire
r0yfire / README.md
Created January 24, 2024 14:25
Using `crewai` to build an automated marketing content team using LLM Agents

Marketing Content Team using crewai

An experiment using crewai.

Setup

  1. Setup a virtual environment using virtualenv
    virtualenv -p python3 venv
@r0yfire
r0yfire / validate.js
Last active December 14, 2021 16:00
Validate email domains of prospects to ensure they are deliverable using Autohost API
const csv = require('@fast-csv/parse');
const https = require('https');
// Autohost API client
const client = (path, data, method = 'GET') => {
return new Promise((resolve, reject) => {
const options = {
method,
hostname: 'data.autohost.ai',
port: 443,
@r0yfire
r0yfire / smsToEmail.js
Created July 26, 2021 18:56
Twilio serverless function to forward incoming SMS to Email
const got = require('got');
exports.handler = function(context, event, callback) {
const requestBody = {
to: context.TO_EMAIL_ADDRESS,
from: context.FROM_EMAIL_ADDRESS,
subject: `New SMS message from: ${event.From}`,
text: event.Body,
};
@r0yfire
r0yfire / dockerclean.sh
Created July 17, 2018 13:56
Docker Cleanup Script
#!/bin/bash
#
# Cleanup Docker
#
if [ ! $(command -v docker) ]; then
echo "Docker is not installed."
exit 1
fi
@r0yfire
r0yfire / daemon.json
Last active May 11, 2018 11:31
Disable seccomp on Docker daemon
{
"seccomp-profile": "/etc/docker/seccomp.json"
}
@r0yfire
r0yfire / cymon_api_example.js
Created September 15, 2017 21:26
Node.js v8 authenticated Cymon API example
const request = require('request-promise');
// change these values
const USER = 'username';
const PASS = 'password';
const API = 'https://api.cymon.io/v2';
async function login() {
try {
const res = await request.post({