Skip to content

Instantly share code, notes, and snippets.

View tzmartin's full-sized avatar
🏴‍☠️
ahoy!

tz ✨ tzmartin

🏴‍☠️
ahoy!
View GitHub Profile
@Cortexelus
Cortexelus / udio.py
Last active May 10, 2024 12:59
Automate Udio (2024-04-13)
# AUTOMATE UDIO
# by DADABOTS dadabots.com
# was working on 2024-04-13
# tldr; get your login cookie, use it to automate udio from python
import requests
import json
from time import sleep
import re
@thomwolf
thomwolf / fast_speech_text_speech.py
Last active May 9, 2024 11:05
speech to text to speech
""" To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .
pip install whisper pynput pyaudio
"""
from openai import OpenAI
import time
#pip install git+https://github.com/huggingface/transformers.git
import datetime
import sys
from transformers import pipeline
from transformers.pipelines.audio_utils import ffmpeg_microphone_live
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=0)
sampling_rate = pipe.feature_extractor.sampling_rate
@taskylizard
taskylizard / fmhy.md
Last active June 1, 2024 14:35
/r/freemediaheckyeah, in one single file (view raw)
@dievardump
dievardump / README.md
Last active January 25, 2023 14:55
Base file I used to use for my mainnet contracts to be compatible with OpenSea

Warning !!!

Recent events have shown that the auto-approval for user proxies is way too dangerous.

Security of users' NFTs should come before the convenience of auto approving collection for trading.

This is why I decided to remove the files in this gist.

Security risk

@dbieber
dbieber / fastbook.py
Last active August 10, 2023 18:13
fastbook speeds up the silence in audiobooks, and can speed up the non-silence too
"""Performs automatic speed edits to audio books.
Example usage:
Assuming you have an audiobook book.aax on your Desktop:
1. Convert it to wav:
ffmpeg -i ~/Desktop/book.aax ~/Desktop/book.wav
2. Adjust the speed:
@keijiro
keijiro / KlakHap.md
Last active February 25, 2019 01:17

KlakHAP

Gif

KlakHAP is a Unity plugin that allows playing back a video stream encoded with the [HAP video codecs].

HAP is a fast and high-quality video codec often used in real-time interactive applications. From the HAP Codecs website:

@campoy
campoy / sum.c
Created January 12, 2018 21:54
C function called from BigQuery
int sum(int a, int b)
{
return a + b;
}
@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.