This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <bitset> | |
#include <stdexcept> | |
#include <iomanip> | |
// Function to check if the system is little endian | |
bool isSystemLittleEndian() { | |
int testNumber = 1; | |
return *(char*)&testNumber == 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> // Include header for standard input/output functions | |
#include <assert.h> // Include header for the assert function | |
#define NOB_ASSERT assert // Define NOB_ASSERT as an alias for assert | |
// Function to shift the first argument from argv and update argc | |
char *nob_shift_args(int *argc, char ***argv) { | |
NOB_ASSERT(*argc > 0); // Assert that there's at least one argument | |
char *result = **argv; // Store the first argument in result | |
(*argv) += 1; // Increment argv to point to the next argument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import logging | |
from litellm import completion | |
## set ENV variables | |
os.environ["OPENAI_API_KEY"] = "set anything here - key is not used for proxy" | |
logging.basicConfig(filename='app.log', filemode='w', format='%(name)s - %(levelname)s - %(message)s',level=logging.INFO) | |
def get_chat_completion(messages,model, api_base, custom_llm_provider, temperature, max_tokens, stream): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Description: This is ChatGPT Plugin for [YOUR_APP_NAME] | |
Server API : FastAPI. | |
Language: Python. | |
Date: 26/05/2023. | |
Author : HeavenHM | |
""" | |
# Importing the required libraries. | |
from fastapi import FastAPI, Request, Depends,Response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <ctype.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <string.h> | |
bool IsValidNumber(char *p_input, int base); | |
int DetectBase(char *p_input); | |
int main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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> |
NewerOlder