Skip to content

Instantly share code, notes, and snippets.

@secemp9
secemp9 / flux.py
Created August 17, 2024 12:28
Flux inference
import numpy as np
import torch
from diffusers import DiffusionPipeline
from transformers import BitsAndBytesConfig
# Set up device
device = "cuda" if torch.cuda.is_available() else "cpu"
# Configure 4-bit quantization
quantization_config = BitsAndBytesConfig(
@secemp9
secemp9 / lulu_gpt.md
Created August 9, 2024 06:34
system prompt lulugpt

Requirements are:

  • High IQ, high EQ
  • Love for tech and capitalism
  • High agency and low ego
  • Taste
  • Discretion
  • A working cringe detector
  • Instinct for narrative
  • Strong writing ability
@secemp9
secemp9 / verbose_assert.py
Created August 7, 2024 09:12
Verbose assertion
import ast
import astor
# Sample Python code with assert statements outside a function
code = """
x = 5
assert x == 5
assert x < 3
assert x > 0
"""
@secemp9
secemp9 / stream_multi3.sh
Created July 14, 2024 17:19
Stream test again
#!/bin/bash
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2/KEY"
TWITTER_URL="rtmp://va.pscp.tv:80/x/KEY"
TWITCH_URL="rtmp://live.twitch.tv/app/KEY"
YOUTUBE_BITRATE="9M"
TWITTER_BITRATE="9M"
TWITCH_BITRATE="7M"
LOCAL_RTMP="rtmp://0.0.0.0:1935"
PIPE_PATH_BASE="/tmp/live_stream"
PLATFORMS=("youtube" "twitter" "twitch")
#!/bin/bash
# Set up variables
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2/KEY"
TWITTER_URL="rtmp://va.pscp.tv:80/x/KEY"
TWITCH_URL="rtmp://live.twitch.tv/app/KEY"
YOUTUBE_BITRATE="9M"
TWITTER_BITRATE="9M"
TWITCH_BITRATE="7M"
LOCAL_RTMP="rtmp://0.0.0.0:1935"
@secemp9
secemp9 / stream_multi.sh
Created July 12, 2024 13:04
Stream test
#!/bin/bash
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2/KEY"
TWITTER_URL="rtmp://va.pscp.tv:80/x/KEY"
TWITCH_URL="rtmp://live.twitch.tv/app/KEY"
YOUTUBE_BITRATE="9M"
TWITTER_BITRATE="9M"
TWITCH_BITRATE="7M"
LOCAL_RTMP="rtmp://0.0.0.0:1935"
SOCKET_PATH="/tmp/live_stream.sock"
@secemp9
secemp9 / lattice_triplets.py
Created July 3, 2024 22:46
Generate triplets within lattice
import random
import time
def rolling_hash(rect, prev_hash=0):
base = 256
mod = 2 ** 64 # Large prime to reduce collisions
h = prev_hash
for val in rect:
import numpy as np
import matplotlib.pyplot as plt
# Define the parametric equations
def X(t):
return (4 / 9) * np.sin(2 * t) + (1 / 3) * (np.sin(t) ** 8) * np.cos(3 * t) + (1 / 8) * np.sin(2 * t) * (
np.cos(247 * t) ** 4)
@secemp9
secemp9 / reset_gpu.sh
Created June 29, 2024 10:30
Resetting gpu
#!/bin/bash
unbind_gpu() {
echo "Unbinding NVIDIA driver..."
GPU_PCI=$(lspci | grep -i nvidia | cut -d ' ' -f 1)
for gpu in $GPU_PCI; do
echo -n "0000:$gpu" > /sys/bus/pci/drivers/nvidia/unbind
done
}
@secemp9
secemp9 / is_sorted.py
Created June 19, 2024 14:38
Testing different algorithm for checking if a list is sorted
import itertools
import time
import random
import math
import pandas as pd
def is_sorted_permutation(perm):
for i in range(len(perm)):
for j in range(i, len(perm)):