Skip to content

Instantly share code, notes, and snippets.

View JayGoldberg's full-sized avatar

Jay Goldberg JayGoldberg

  • Google
  • San Francisco, CA, USA
View GitHub Profile
@JayGoldberg
JayGoldberg / ptt_audio_download.html
Created August 6, 2025 17:43
A "push-to-talk" app. This example uses plain HTML and JavaScript, leveraging the MediaDevices API for microphone access and the MediaRecorder API to handle the recording. Handles all the logic: requesting microphone access, starting and stopping the recording based on button presses, and creating a downloadable link for the final audio file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Push-to-Talk Recorder</title>
<style>
body {
font-family: sans-serif;
display: flex;
@JayGoldberg
JayGoldberg / whelen.html
Last active August 5, 2025 04:26
Whelen/Whelan airhorn emulator in a webpage. Modulates a square wave with a sine wave (FM synthesis)
<!DOCTYPE html>
<!-- https://www.youtube.com/watch?v=6JO1F9xD3rU -->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FM Synthesis</title>
<style>
body {
font-family: 'Inter', sans-serif;
@JayGoldberg
JayGoldberg / streams-generator-i2s.ino
Last active August 3, 2025 17:36
generates a square wave using the AudioTools library and outputs it as an I2S audio stream, likely for an ESP32 or similar microcontroller with I2S capabilities.
/**
* @file streams-generator-i2s.ino
* @author Phil Schatzmann
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-stream/streams-generator-i2s/README.md
* @copyright GPLv3
*/
#include "AudioTools.h"
AudioInfo info(44100, 1, 16);
@JayGoldberg
JayGoldberg / esp_wavplay.ino
Last active August 4, 2025 00:01
Play WAV files from SPIFFS to i2s using arduino-audio-tools (e.g. ESP8266 & ESP32)
// using https://github.com/pschatzmann/arduino-audio-tools
// upload to SPIFFS with https://github.com/espx-cz/arduino-spiffs-upload for Arduino 2.x (non-JAR),
// place your WAV files in data/ in the sketch folder
#include "AudioTools.h"
#include "AudioTools/Disk/AudioSourceSPIFFS.h"
#include "AudioTools/AudioCodecs/CodecWAV.h"
// Define your custom I2S pins for ESP32
// IMPORTANT: These are GPIO numbers.
const int I2S_BCLK_PIN = 2;
@JayGoldberg
JayGoldberg / cam1.conf
Last active May 31, 2025 20:11
Camhi patrol automation for PTZ cameras
# ~/.config/ptz/cam1.conf
# Configuration for camhi camera patrol (CGI API)
# This file contains sensitive information and configuration.
# DO NOT COMMIT THIS FILE TO GIT!
# Camera Credentials
CAMERA_HOST="cam1.lan"
CAMERA_USER="admin"
CAMERA_PASS="mypass" # <--- CHANGE THIS TO YOUR REAL PASSWORD
@JayGoldberg
JayGoldberg / GCPmakeSpeech.sh
Last active August 6, 2025 00:43
Script to generate audio output from Google Text-to-Speech API
#!/bin/bash
# GCPmakeSpeech.sh
# run in Google Cloud Shell in the Cloud Console
# adapted from https://cloud.google.com/text-to-speech/docs/create-audio-text-command-line
# Check if text argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 \"TEXT_TO_SYNTHESIZE\" [OUTPUT_FILE.mp3]"
exit 1
fi
@JayGoldberg
JayGoldberg / README.md
Last active January 18, 2025 18:55
Apps Script email Google form responses automatically, with the responses inside the email

When someone submits a response to a Google Form, you get an email telling you that someone submitted a response but not what they actually submitted

That suuuucks.

So this project is meant to send you the actual response the person entered, and if you capture their email, the Reply feature in your email client will go back to the respondent.

  1. Insert this code into the Script editor of the Google Form.
  2. Copy the template into an HTML file in the script editor
  3. Install a From form - On form submit trigger to call sendFormResponseByEmail() when someone submits the form.
@JayGoldberg
JayGoldberg / circuitFinder.html
Last active December 24, 2024 00:58
Circuit finder using ESP devices (ESP8266 or ESP32)
<!DOCTYPE html>
<html>
<head>
<title>ESPHome Circuit finder</title>
<style>
.status-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
grid-gap: 10px;
}
@JayGoldberg
JayGoldberg / ytAnalytics.py
Created October 23, 2024 18:19
Accessing youtubeanalytics.googleapis.com API using python
import os
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
API_SERVICE_NAME = 'youtubeAnalytics'
API_VERSION = 'v2'
CLIENT_SECRETS_FILE='ytsecret.json'
@JayGoldberg
JayGoldberg / genAI_noise.sh
Last active October 23, 2024 01:59
adds organic noise to AI generated images
# adds organic noise to AI generated images
# requires ImageMagick `convert` command
function makenoise {
# Get the input extension and use the same one for output
imageName="$1"
basename=$(basename "$imageName")
extension="${imageName##*.}"
# Split the image into channels
convert "$imageName" -separate "channel_%d.png"