Skip to content

Instantly share code, notes, and snippets.

View haseeb-heaven's full-sized avatar
🏠
Working from home

HeavenHM haseeb-heaven

🏠
Working from home
View GitHub Profile
@thomwolf
thomwolf / fast_speech_text_speech.py
Last active July 21, 2024 18:37
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
@haseeb-heaven
haseeb-heaven / CodeRunner.sh
Last active January 4, 2024 00:05
A universal script for compiling and running various programming languages. It supports C, C++, Java, Go, C#, Python, JavaScript, Swift, Scala, Ruby, and Kotlin, identifying the language by file extension and using the appropriate compiler or interpreter, usage: ./CodeRunner.sh program.cpp
#!/bin/bash
# Get the filename from the command line argument
filename=$1
debug=0
cpp_version="c++17"
# Determine the file extension, compiler, and language based on the filename
if [[ $filename == *.c ]]; then
extension=".c"
@haseeb-heaven
haseeb-heaven / MemorySizeDetector.c
Last active December 11, 2023 23:04
Cross-Platform Memory Size Detector in C portable way.
/*
Description: Cross-Platform Memory Size Detector in C
Author: HeavenHM
Language: C
Date: 12-12-2023
Compilers Tested: GCC, Clang, MSVC.
Platforms Tested: Unix,Linux, MacOS, Windows.
*/
// Includes for cross-platform compatibility.
@haseeb-heaven
haseeb-heaven / PyPiano.py
Created November 24, 2023 23:26
Turn your keyboard to Piano using Python.
import io
from pydub import AudioSegment
from pydub.generators import Sine
from pydub.playback import play
from pynput.keyboard import Key, Listener
import threading
from math import log2
# Function to generate a sine wave tone
def generate_tone(frequency, duration=500):
@haseeb-heaven
haseeb-heaven / PrintContainer.cpp
Last active November 22, 2023 00:14
C++ General way of printing data of container including List,Sets,Maps,Stack,Queues etc.
/*
Info: C++ General way of printing data of container including List, Sets, Maps, Stack, Queues, etc.
Author: Haseeb Mir @2022.
*/
#include <iostream> // For input/output operations
#include <map> // For std::map
#include <stack> // For std::stack
#include <queue> // For std::queue
@haseeb-heaven
haseeb-heaven / ResolveType.cpp
Created June 16, 2022 15:06
C++ Data type resolve in Compile-Time using T-Template and Runtime using TypeId.
/*
Info: C++ Data type resolve in Compile-Time using T-Template and RunTime using TypeId.
Author: Haseeb Mir @2022.
*/
#include <iostream>
#include <list>
#include <map>
#include <string>
#include <typeinfo>
#include <string_view>
@haseeb-heaven
haseeb-heaven / XMLParser.py
Created May 26, 2022 15:36
XML Parsers collection using Element Tree and BeautifulSoup.
"""
Info: XML Parser using Element Tree and BeautifulSoup.
Author: Haseeb Mir.
Date: 05/26/2022
"""
#Import the Package modules.
import xml.etree.ElementTree as xml
from bs4 import BeautifulSoup
@haseeb-heaven
haseeb-heaven / CSharp-Utils.cs
Last active May 26, 2022 15:05
CSharp Utilities for UI,File Operations Handles,Web Connectsions and more.
//UI-Dialogs and MessageBox.
internal static void ShowWarning(string warnMsg, string caption = "WARNING") {
DialogMsgBox.ShowBox(caption, warnMsg, MsgBoxButtons.Ok);
}
internal static void ShowError(string errMsg, string caption = "ERROR") {
DialogMsgBox.ShowBox(caption, errMsg, MsgBoxButtons.Ok);
}
internal static void LogException(string methodName, Exception ex) {
/**
* @description - Read any ASCII,BINARY or HEX file.
* @param - Source file name and file type.
* @return - Returns data in tuple format,use std::get<TUPLE_ID>(TUPLE_OBJ) to get data.
*/
/*Including STD-C++ libraries*/
#include <iostream> /*For basic I/O.*/
#include <fstream> /*For basic I/O.*/
#include <sstream> /*For basic I/O.*/
#include <vector> /*For STL vector.*/
/* AutoCloseMessageBox - C++ Implementation of original code of C# from CodeProject https://www.codeproject.com/Articles/7968/MessageBox-with-a-timeout-for-NET
By Artic Coder.
*/
#undef UNICODE
#include <iostream>
#include <Windows.h>
using std::string;
//Pointer to Hook functions.