Skip to content

Instantly share code, notes, and snippets.

@thomwolf
thomwolf / fast_speech_text_speech.py
Last active April 26, 2024 10:03
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
@dannguyen
dannguyen / tx-dp-regex-religion.py
Last active April 26, 2024 10:03
Scraping and parsing the last words of Texas executed inmates for religious words; an exercise in webscraping and regexes
"""
Filter Texas executed inmates by whether any of their last words fit in a
list of words commonly associated with religion.
A quick demonstration of the overall patterns in web-scraping, including
using a HTML parser to navigate the DOM and the use of Regex for
hand-entered values. Does none of the file-caching/management that you should
be doing for such a task
"""

Merging git repositories, putting one of them into a subdirectory

For this you need git-filter-repo installed (filter-branch is discouraged).

cd a
git filter-repo --to-subdirectory-filter a
@Strus
Strus / clangd.md
Last active April 26, 2024 10:02
How to use clangd C/C++ LSP in any project

How to use clangd C/C++ LSP in any project

tl;dr: If you want to just know the method, skip to How to section

Clangd is a state-of-the-art C/C++ LSP that can be used in every popular text editors like Neovim, Emacs or VS Code. Even CLion uses clangd under the hood. Unfortunately, clangd requires compile_commands.json to work, and the only way to painlessly generate it is to use CMake.

But what if I tell you you can quickly hack your way around that, and generate compile_commands.json for any project, no matter how compilcated? I have used that way at work for years, originaly because I used CLion which supported only CMake projects - but now I use that method succesfully with clangd and Neovim.

Method summary

Basically what we need to achieve is to create a CMake file that will generate a compile_commands.json file with information about:

@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active April 26, 2024 10:02
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

# No Power Wasted 2500 V0.321 ONLY FOR TESTING !!!!
# ESPHome Software für alle gängigen Versionen des Balkonspeichers xy2500.
# Diese Version ist speziell für Verwendung mit dem Home Assistant ausgelegt und
# inkludiert die Kommunikation mit diesem, Regelung für Nulleinspeisung
# und in Zukunft einiges mehr.
# Die Kommunikation mit dem Balkonspeichers xy2500 basiert auf der Arbeit von noone2K.
# Die Hauptseite für neue Entwicklungen, Integration MQTT, openhab usw. findet ihr unter:
# https://gist.github.com/noone2k/2ddea4c9bf116aaaefb8626b064d9a41
#
# Mögen euch die Bits gnädig sein,
@noone2k
noone2k / bc2500-ble-idf.yaml
Last active April 26, 2024 10:00
bc2500 info/control with esphome
esphome:
name: bc2500-ble-idf
friendly_name: bc2500-ble-idf
esp32:
board: az-delivery-devkit-v4
framework:
type: esp-idf
sdkconfig_options:
CONFIG_FREERTOS_UNICORE: y
List of ImageNet class numbers and names as used in Keras' pre-trained models.
Extracted from https://s3.amazonaws.com/deep-learning-models/image-models/imagenet_class_index.json
0, tench
1, goldfish
2, great_white_shark
3, tiger_shark
4, hammerhead
5, electric_ray
@ijleesw
ijleesw / install-openmp-macos.sh
Created December 4, 2018 14:45
Install OpenMP on MacOS
#!/bin/bash
# Install
brew install llvm
brew install libomp
# Compile
# clang++ test.cpp -o test -Xpreprocessor -fopenmp -lomp
@slavnycoder
slavnycoder / ton_client.py
Last active April 26, 2024 10:00
TON http api python client
## API class for https://toncenter.com/
## requirements:
# tonsdk https://github.com/tonfactory/tonsdk/
# requests
# Donate (TON): EQCZG0qnpnNK2dCYoLCiLMCuP-QviaFvWiVDQja1vgMXn7uD
from typing import Optional, Literal, List, Coroutine
import aiohttp
import requests