Skip to content

Instantly share code, notes, and snippets.

View alexdlaird's full-sized avatar

Alex Laird alexdlaird

View GitHub Profile
@alexdlaird
alexdlaird / AmazonOrdersIOWithTextPrompt.py
Last active June 5, 2025 16:20
amazon-orders with a Flask / Twilio implementation for 2FA
# Use Twilio in combination with the libraries `flask` and `pyngrok` to build a tiny server
# that uses a webhook to receive text responses when a prompt is initiated. The prompt will
# wait until a response text is received (via the webhook). You can find docs and a basic `flask`
# example for `pyngrok` here: https://pyngrok.readthedocs.io/en/latest/integrations.html#flask
import os
import time
from threading import Thread
from flask import Flask, Response
@alexdlaird
alexdlaird / JavaNgrokHTTPServerExample.java
Last active May 25, 2025 16:12
Simple HTTP server integration example for java-ngrok, full documentation found at https://alexdlaird.github.io/java-ngrok/integration
package com.github.alexdlaird;
import com.github.alexdlaird.ngrok.NgrokClient;
import com.github.alexdlaird.ngrok.protocol.CreateTunnel;
import com.github.alexdlaird.ngrok.protocol.Tunnel;
import com.sun.net.httpserver.HttpServer;
import java.net.InetSocketAddress;
import java.util.logging.Logger;
@alexdlaird
alexdlaird / hookee-colab-example.ipynb
Last active June 5, 2025 16:20
hookee - Colab Example.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexdlaird
alexdlaird / pyngrok-colab-ssh-example.ipynb
Last active December 27, 2023 17:04
pyngrok - Colab SSH Example.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexdlaird
alexdlaird / pyngrok-colab-http-example.ipynb
Last active December 27, 2023 17:19
pyngrok - Colab HTTP Example.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexdlaird
alexdlaird / 1_pyngrok_DjangoExample_apps.py
Last active June 5, 2025 16:21
Django integration example for pyngrok, full documentation found at https://pyngrok.readthedocs.io/en/latest/integrations.html
import os
import sys
from urllib.parse import urlparse
from django.apps import AppConfig
from django.conf import settings
class CommonConfig(AppConfig):
name = "myproject.common"
@alexdlaird
alexdlaird / pyngrok_FlaskExample_server.py
Last active June 5, 2025 16:21
Flask integration example for pyngrok, full documentation found at https://pyngrok.readthedocs.io/en/latest/integrations.html
# USE_NGROK=True FLASK_APP=server.py flask run
import os
import sys
from flask import Flask
def init_webhooks(base_url):
# Update inbound traffic via APIs to use the public-facing ngrok URL
pass
@alexdlaird
alexdlaird / pyngrok_FastApiExample_server.py
Last active June 5, 2025 16:21
Fast API integration example for pyngrok, full documentation found at https://pyngrok.readthedocs.io/en/latest/integrations.html
# USE_NGROK=True uvicorn server:app
import os
import sys
from fastapi import FastAPI
from fastapi.logger import logger
from pydantic import BaseSettings
import unittest
import threading
from flask import request
from pyngrok import ngrok
from urllib import request
from server import create_app
@alexdlaird
alexdlaird / pyngrok_AWSLambdaFlaskExample_server.py
Last active June 5, 2025 16:21
AWS Lambda Flask integration example for pyngrok, full documentation found at https://pyngrok.readthedocs.io/en/latest/integrations.html
import json
from flask import Blueprint, request
from lambdas.foo_GET import lambda_function as foo_GET
bp = Blueprint("lambda_routes", __name__)
@bp.route("/foo")
def route_foo():
# This becomes the event in the Lambda handler