This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket # Doesn't need installation | |
| import pyaudio # Requires another package | |
| import audioop # Doesn't need installation until python 3.13 | |
| import time | |
| # Constants for the UDP socket | |
| UDP_IP = "192.168.0.194" # Listen on all local IPs | |
| UDP_PORT = 9444 # Port number to listen on | |
| SUBSCRIBE_INTERVAL = 15 # in seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Network | |
| class NetworkMonitor: ObservableObject { | |
| @Published var isInternetAvailable = false | |
| init() { | |
| startMonitoring() | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function doGet(request){ | |
| var result = processRequest(request); | |
| return ContentService | |
| .createTextOutput(result) | |
| .setMimeType(ContentService.MimeType.TEXT); | |
| } | |
| function processRequest(e) | |
| { | |
| // Open Google Sheet using ID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # N.B. When changing this file, run this in the Terminal to load the updated values: 'npm run start -- --reset-cache' | |
| NODE_ENV=development | |
| # the URL to the GraphQL api | |
| API_URL=https://sonesta-gateway-test.azure-api.net/member/graphql | |
| API_URL_GUEST=https://sonesta-gateway-test.azure-api.net/guest/graphql | |
| API_URL_HEALTHCHECK=https://sonesta-gateway-test.azure-api.net/healthcheck/v1.1/heartbeat | |
| API_SUBSCRIPTION_KEY=5e60f927beb2407195a1ca72583c1507 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function doPost(request){ | |
| var resultObject = JSON.parse(request.postData.contents); | |
| var result = processResult(resultObject); | |
| return ContentService | |
| .createTextOutput(JSON.stringify(result)) | |
| .setMimeType(ContentService.MimeType.JSON); | |
| } | |
| function processResult(resultObject) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"v":"5.7.1","fr":15,"ip":10,"op":45,"w":500,"h":500,"nm":"Comp 2","ddd":0,"assets":[{"id":"image_0","w":844,"h":821,"u":"","p":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA0wAAAM1CAMAAAB0boGMAAAAJHpUWHRDcmVhdG9yAAAImXNMyU9KVXBMK0ktUnBNS0tNLikGAEF6Bs5qehXFAAAACXBIWXMAAAABAAAAAQBPJcTWAAAARVBMVEVHcEz4t6j3ppT4r5770sn/9vP/8O3+4tz62tP/6eX5v7H7zMH2nYnzf2XzinH1lH7////xc1b5xbnwZ0fvWzntQhzuTys7zAZPAAAAF3RSTlMAYXdsPAwUJzIdVkWDrJ6QBbxOzd397XBBxq0AACAASURBVHja7J3Lduu4DkQ1MClx9UT//7X3nkQiUUCBpF+JHQNW/La7B96ngAJILUtERERERERExGzs5CoiImIGG31hV+r1iIgIjsbXvX/Hflyrq51C9fVkkBXxgRrUfv9f9/dvgvYDo6V3tezmrXulC744IuJTlKjJzyKwOAMemFjk3QpYxS2YivgAjBalPpagPkXyrerTS8sGBVUBVcSfgkhK0QLlz4NDyp2ANmQq4q/kdI2jqRTuMUxptEKmIt4/pavF0FwOl/4dc1dXSFVzOZbgKeKdSLJytPT5OfA47uz1ilEkX03qYz2lEkVWiFTEu1RHO5h1XQFKp8YkT5PIE/i0+PyUaIVIRbyHHi3GoKM6dCDAGEn/j3q1J/XE8exxl6hTArEbOoFLeBMRL1chLVj3OwglyZDC5zzasy5OxxvUQfK+QQKIvamIiNcQpN11vFvmJSESpNSH53VKQpkSQQnfKzkySDaoko/TEhIV8Qok+RSpZA5+7iA4CIcESjzeyWv2W/D7sSzrVVPLHnOzEb+b3PkoqVpIZ2RCeHYC0I2xI31WqByRWhCpUKiIn8Ooz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Sample using CoreMotion and SwiftUI to help understand how to use CMMotionManager and CoreMotion to get values of gravity, user acceleration, heading (2), attitude (pitch, roll, yaw), magnetic field | |
| // based on this beautiful example https://github.com/gsachin/DynamicFontRandD/blob/e4f7cc611d1d23573b4026bcc291bee60bf60e91/FontTextStrok/WaveView.swift | |
| // that uses BAFluidView https://github.com/antiguab/BAFluidView | |
| import SwiftUI | |
| import CoreMotion | |
| let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() | |
| struct WaveView: View { | |
| var motionManager = CMMotionManager() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // BackgroundNoiseAlert.swift | |
| // | |
| // Created by Saamer Mansoor on 2/2/22. | |
| // | |
| import AVFoundation | |
| import UserNotifications | |
| import SwiftUI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import SwiftUI | |
| struct ContentView: View { | |
| @State private var joke: String = "" | |
| var body: some View { | |
| Text(joke) | |
| Button { | |
| Task { | |
| let (data, _) = try await URLSession.shared.data(from: URL(string:"https://api.chucknorris.io/jokes/random")!) | |
| let decodedResponse = try? JSONDecoder().decode(Joke.self, from: data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| private actor JokeServiceStore { | |
| func load() async throws -> String { | |
| let (data, _) = try await URLSession.shared.data(from: URL(string:"https://api.chucknorris.io/jokes/random")!) | |
| let decodedResponse = try? JSONDecoder().decode(Joke.self, from: data) | |
| return decodedResponse?.value ?? "" | |
| } | |
| } | |
| class JokeService: ObservableObject { |