Skip to content

Instantly share code, notes, and snippets.

View madkote's full-sized avatar
🤖
reboot

RES madkote

🤖
reboot
View GitHub Profile
@madkote
madkote / cpp.std.coroutines.draft.md
Created July 16, 2025 09:11 — forked from MattPD/cpp.std.coroutines.draft.md
C++ links: Coroutines (WIP draft)
@madkote
madkote / whisper_transcribe.py
Created March 19, 2025 17:21 — forked from arctic-hen7/whisper_transcribe.py
A Python script that records audio from the microphone into a temporary file until the user presses Enter, and that then transcribes that audio using Whisper. A plug-and-play way of adding voice non-real-time voice command to Python apps!
import whisper
import pyaudio
import wave
import sys
import tempfile
from ctypes import *
# Load the Whisper model once
model = whisper.load_model("base.en")
@madkote
madkote / wav-riff-reader.py
Created February 13, 2025 13:13 — forked from JonathanThorpe/wav-riff-reader.py
Python WAV File RIFF Header Reader
import struct
import io
class WAVFile:
def __init__(self, filename):
self.filename = filename
def read(self):
with io.open(self.filename, 'rb') as fh:
@madkote
madkote / asyncio_loop_in_thread.py
Created November 24, 2022 15:33 — forked from dmfigol/asyncio_loop_in_thread.py
Python asyncio event loop in a separate thread
"""
This gist shows how to run asyncio loop in a separate thread.
It could be useful if you want to mix sync and async code together.
Python 3.7+
"""
import asyncio
from datetime import datetime
from threading import Thread
from typing import Tuple, List, Iterable
@madkote
madkote / installkeyringhelper.sh
Created February 9, 2022 06:55 — forked from keirlawson/installkeyringhelper.sh
Install gnome-keyring git credential helper in Ubuntu
sudo apt-get install libgnome-keyring-dev
cd /usr/share/doc/git/contrib/credential/gnome-keyring
sudo make
sudo ln -s /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring /usr/lib/git-core/
@madkote
madkote / git_submodules.md
Created January 11, 2022 17:55 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@madkote
madkote / bytes_to_wav.py
Created July 8, 2021 12:38 — forked from hadware/bytes_to_wav.py
Convert wav in bytes for to numpy ndarray, then back to bytes
from scipy.io.wavfile import read, write
import io
## This may look a bit intricate/useless, considering the fact that scipy's read() and write() function already return a
## numpy ndarray, but the BytesIO "hack" may be useful in case you get the wav not through a file, but trough some websocket or
## HTTP Post request. This should obviously work with any other sound format, as long as you have the proper decoding function
with open("input_wav.wav", "rb") as wavfile:
input_wav = wavfile.read()
@madkote
madkote / example_starlette_app.py
Created January 14, 2021 10:55 — forked from fgshun/example_starlette_app.py
An example Starlette, Websocket and GraphQL app.
import asyncio
import itertools
import json
import logging
import time
import graphene
import uvicorn
from graphql.execution.executors.asyncio import AsyncioExecutor
from starlette.applications import Starlette
@madkote
madkote / log.py
Created May 30, 2019 18:52 — forked from djlambert/log.py
import asyncio
import json
import logging
from uuid import UUID
import aio_pika
import websockets.exceptions as ws_exc
from fastapi import APIRouter, Path
from starlette import status
from starlette.websockets import WebSocket