Skip to content

Instantly share code, notes, and snippets.

View skittleson's full-sized avatar

Spencer Kittleson skittleson

View GitHub Profile
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"]
*.log
*.csv
__pycache__
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)
# 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
@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')
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
import wsl_shell
import simpleaudio as sa
import os
class GenerativeAudioService:
"""
Create and manage playback with text to speech audio files
"""
@skittleson
skittleson / scrape_who_is_hiring.py
Created September 29, 2023 05:23
Who Is Hiring
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()
@skittleson
skittleson / record.cs
Created July 6, 2023 16:55
Record ffmpeg
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
@skittleson
skittleson / dslr_process_files.py
Created April 16, 2023 21:15
Process files from a DSLR camera
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")