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 datetime | |
import requests | |
import json | |
from msal import PublicClientApplication | |
# Replace with your client ID from Azure App Registration | |
CLIENT_ID = "a9641399-2aad-43f8-aac1-5bcccbcc004b" # No need for client secret | |
AUTHORITY = "https://login.microsoftonline.com/common" # Supports personal and work accounts | |
SCOPES = ["https://graph.microsoft.com/Mail.Read"] |
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
*.log | |
*.csv | |
__pycache__ |
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 | |
import socket | |
import time | |
# Step 1: Set Up AP Mode | |
def access_point(ssid, password = None): | |
import network | |
wlan = network.WLAN(network.AP_IF) | |
wlan.config(essid=ssid) |
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
# scan for temp sensors in area. | |
import aioble | |
import uasyncio as asyncio | |
from ubluetooth import UUID | |
import bluetooth | |
import struct | |
__TIMEOUT_MS = 30000 | |
__SCAN_TIM_MS = 20000 |
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
@staticmethod | |
def mark_for_deletions(from_email_to_delete: str): | |
client = __get_client() | |
client.select_folder("INBOX") | |
action_on_uids = [] | |
for i in range(1, 3): | |
start = (datetime.now() + timedelta(days=-(30 * i)) | |
).strftime('%d-%b-%Y') | |
end = (datetime.now() + timedelta(days=-((30 * i)-30)) | |
).strftime('%d-%b-%Y') |
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 utime as time | |
from machine import UART,Pin | |
gps_module = UART(1, baudrate=9600, tx=Pin(4), rx=Pin(5)) | |
time_zone = -7 | |
def read_until_char(uart, target_char='$'): | |
received_data = b'' # Initialize an empty byte string to store received data | |
while True: | |
if uart.any(): # Check if there's data available to read |
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 wsl_shell | |
import simpleaudio as sa | |
import os | |
class GenerativeAudioService: | |
""" | |
Create and manage playback with text to speech audio files | |
""" |
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
from bs4 import BeautifulSoup | |
import requests | |
import re | |
if __name__ == '__main__': | |
html = requests.get(r'https://news.ycombinator.com/item?id=37351667&p=1') | |
soup = BeautifulSoup(html.text,'html.parser') | |
all_spans = soup.find_all('span', class_='commtext') | |
for span in all_spans: | |
comment_content = span.text.strip() |
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
public static async Task RecordAsync(Stream stream, string microphone, CancellationToken cancellationToken, Action<double> detectedSilenceCallback = null) | |
{ | |
// do this to get audio device with a mic | |
// ffmpeg -list_devices true -f dshow -i dummy | |
// pick one then add it to the audio device | |
// ffmpeg -f dshow -i audio="Microphone (HD Pro Webcam C920)" -ar 16000 output.wav | |
using var gracefulCts = new CancellationTokenSource(); | |
try | |
{ | |
// ffmpeg -f dshow -i audio="Microphone Array (Intel® Smart Sound Technology for Digital Microphones)" -ar 16000 -preset ultrafast -tune zerolatency -b 900k -f mpegts udp://127.0.0.1:9876 |
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 shutil | |
import wmi | |
import os | |
from time import strftime, localtime | |
def copy(device_id): | |
""" Copy all files in camera directory to users directoy for human processing | |
""" | |
# bug only works for Windows | |
src = os.path.join(device_id, "\\", "DCIM", "100MSDCF") |
NewerOlder