Skip to content

Instantly share code, notes, and snippets.

View patrick-samy's full-sized avatar

Patrick Samy patrick-samy

View GitHub Profile
@patrick-samy
patrick-samy / transcribe.py
Last active August 27, 2024 18:13
Split large audio file and transcribe it using the Whisper API from OpenAI
import os
import sys
import openai
import os.path
from dotenv import load_dotenv
from pydub import AudioSegment
load_dotenv()
openai.api_key = os.getenv('OPENAI_API_KEY')
import smbus
bus = smbus.SMBus(1)
v = bus.read_byte_data(0x57, 0xff)
if v != 17:
print "wrong part ID"
exit(1)
bus.write_byte_data(0x57, 0x06, 0x03)
@patrick-samy
patrick-samy / cms50dplus.py
Last active May 12, 2017 15:13
Read live data from a CMS50D+ pulse oximeter with firmware v4.6
#!/usr/bin/env python2
# Copyright (c) 2016 Tommi Airikka <[email protected]>
# License: GPLv2
import sys, struct, serial, argparse
from dateutil.parser import parse
#####################
##### Variables #####
error: linking with `arm-none-eabi-gcc` failed: exit code: 1
note: "arm-none-eabi-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/pasamy/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "/home/pasamy/projects/misc/wit/target/armv7-unknown-linux-gnueabihf/debug/wit.0.o" "-o" "/home/pasamy/projects/misc/wit/target/armv7-unknown-linux-gnueabihf/debug/wit" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/pasamy/projects/misc/wit/target/armv7-unknown-linux-gnueabihf/debug" "-L" "/home/pasamy/projects/misc/wit/target/armv7-unknown-linux-gnueabihf/debug/deps" "-L" "/home/pasamy/projects/misc/wit/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-5464f8f6e728c35a/out" "-L" "/home/pasamy/projects/misc/wit/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-extras-5c7e4d8925825f00/out" "-L" "/home/pasamy/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/ho