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 | |
# idiotproofing, "lol" | |
echo "bad human/entity! this isn't inteded to be run!" | |
tail --lines=+8 ./parsers.sh | |
exit 1 | |
# =============================================================================== | |
# 1. SPLIT A LARGE FILE WITH GPT-2'S <|endoftext|> DELIMITER AS THE SPLIT POINT. | |
# =============================================================================== |
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 will download and install the 'linux-modules-extra-raspi' package if: | |
# | |
# 1. the Linux distribution is detected as Ubuntu, and | |
# 2. the mentioned package is not installed on the system according to dpkg. | |
# | |
# The packages are: | |
# On the Raspberry Pi: apt package 'linux-modules-extra[-raspi]', or: | |
# on x86_64 (amd64) environments, named according to the kernel that's in use. | |
# is required starting from Ubuntu Impish to install zram-swap |
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
-- WebcamReload v1.1 | |
-- A simple Lua script to reload your OBS Studio video source (webcam, other UVC sources...) every x minutes. | |
-- From FlyingFathead (https://github.com/FlyingFathead) | |
-- For years, OBS has had a problem where UVC video sources (such as USB webcams) are freezing up intermittently. | |
-- This is "somewhat-of-a-workaround" script to reload a USB video source such as a UVC webcam to prevent freezes. | |
-- I've ran this in Ubuntu 22.04 & OBS Studio 29.0.2, and it's been working well with a dual webcam setup. | |
-- Note that you need one script per video source that needs to be reloaded. |
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 | |
# print a terminal-wide horizontal line with '-' characters | |
function hr_prn(){ | |
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - | |
} | |
# Get the list of connected displays and their resolutions | |
DISPLAYS=($(xrandr | grep " connected" | awk '{print $1}')) | |
CURRENT_PRIMARY=$(xrandr --query | grep " connected primary" | awk '{print $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
# 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" && |
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
# 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 `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
# 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 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: |
OlderNewer