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 | |
# This script is designed to identify and list all USB cameras and audio devices connected to a system. | |
# It provides detailed information about each device, including vendor ID, product ID, serial number, | |
# device description, and supported video modes for cameras. It also identifies audio devices and | |
# lists their card and device numbers, names, and descriptions. | |
# Required Packages: | |
# - udevadm: Provides information about device attributes. | |
# - v4l2-ctl: A utility to control video4linux devices and list video formats. |
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
# async_tts.py, for `TTS` pypi package (also requires `pydub`) | |
# $ pip install -U tts pydub | |
# | |
# v0.02 | |
# changes: | |
# - now uses pydub, normalizes audio | |
# | |
# performs a staggered execution / playback of the audio, | |
# where the next chunk is being processed while the previous is still playing | |
# |
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 | |
# | |
# >>> SCANLAN <<< | |
# | |
# this script can used for i.e. checking out what's on your LAN | |
# requires `nmap`, `xmlstarlet` and `lolcat` (just because) | |
# adjust to your own ip range as needed. | |
# NO WARRANTIES, use only for your own LAN diagnostics and at your own risk | |
# | |
# |
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
# v0.03 // added preformat sanitizer for hyphenation and other text formatting | |
import shutil | |
import sys | |
import os | |
import re | |
# print term width horizontal line | |
def hz_line(character='-'): | |
terminal_width = shutil.get_terminal_size().columns |
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
# requires the `transformers` package; please install with `pip -U install transformers` | |
import sys | |
from transformers import GPT2Tokenizer | |
def count_tokens(file_path): | |
print(f"Counting the token count estimate for: {inputfile} ...", flush=True) | |
tokenizer = GPT2Tokenizer.from_pretrained("gpt2") | |
try: | |
with open(file_path, 'r', encoding='utf-8') as file: |
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
# requires `pdfminer.six`; install with `pip install -U pdfminer.six` | |
import sys | |
import os | |
from pdfminer.high_level import extract_text | |
def extract_pdf_text(pdf_file, output_file): | |
if os.path.exists(output_file): | |
print(f"File {output_file} already exists. Aborting to prevent overwriting.") | |
return False |
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
# requires `pyttsx3` -- install with: | |
# pip install -U pyttsx3 | |
import tkinter as tk | |
from tkinter.scrolledtext import ScrolledText | |
import pyttsx3 | |
import threading | |
class SpeechManager: | |
def __init__(self): |
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
# file under: laziness check, December 2023... | |
import torch | |
from torch.utils.data import Dataset | |
from numba import cuda | |
import numpy as np | |
# CPU function to generate Fibonacci numbers within uint64 range | |
def generate_fibonacci_numbers(max_length): | |
fib_numbers = np.zeros(max_length, dtype=np.uint64) |
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
# requires the pip `pycuda` package | |
# install it with: `pip install pycuda` | |
import pycuda.driver as cuda | |
cuda.init() | |
# Assuming you want to check the first GPU | |
device = cuda.Device(0) | |
compute_capability = device.compute_capability() |
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
# print term-width horizontal line | |
function viivo() { | |
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - | lolcat -f ; | |
} | |
# find nvidia related troubles | |
function nvidiatroubleshoot() { | |
sudo echo "" | |
viivo && | |
sudo dmesg | grep -i -e "nv-" -e "nvidia" -e "drm" && |
NewerOlder