Post here in this thread the best Python scripts you have

Post here in this thread the best Python scripts you have.

I'll start:
import os
import sys
from PIL import Image

if len(sys.argv) > 1:
if os.path.exists(sys.argv[1]):
im = Image.open(sys.argv[1])
target_name = sys.argv[1] + ".jpg"
rgb_im = im.convert('RGB')
rgb_im.save(target_name)
print("Saved as " + target_name)
else:
print(sys.argv[1] + " not found")
else:
print("Usage: 2jpg.py ")

Attached: py.jpg (1920x1080, 53.81K)

Other urls found in this thread:

voca.ro/1ormezH9j4bd
pastebin.com/t5EQNqyV
github.com/KOLANICH-libs
github.com/KOLANICH-tools
github.com/KOLANICH-tools/WindowsTelemetryViewer.py
twitter.com/NSFWRedditGif

OP is a FAGGOT

Attached: pic-selected-220622-1553-51.png (528x411, 25.93K)

def is_faggot(user):
return True if user == "op" else False

How?

how do you post code in a container

python truly does attract the best and brightest.

nigger

Wow, not even 10 minutes, I stand corrected. Now lurk more faggot.

[c0de]put your code here[/c0de]

voca.ro/1ormezH9j4bd

rss reader for keeping track of content on youtube, odysee, twitch without an account

some of the features such as threading (slow odysee rss) were added later, it was added this way because i didn't want to rewrite (lazy)

pastebin.com/t5EQNqyV

Attached: Screenshot_20220623_004639.png (418x150, 7.39K)

C'mon bros... Post something.

Attached: 1655940186316.png (217x313, 37.36K)

I have 0 python files on my computer, what do you want me to post?

github.com/KOLANICH-libs
github.com/KOLANICH-tools

Do you have AutoHotkey scripts?

Attached: xerin.png (295x524, 159.44K)

No, I use Linux.
This is the worst thing about python
>here are these libraries that use libraries that use libraries that use libraries
Where only the first libraries were made by somebody semi-competent.

github.com/KOLANICH-tools/WindowsTelemetryViewer.py
Good stuff. Tbank you!

if (!(user.hasWritten(COMPILER) || user.hasWritten(IR))) {
user.faggot = true;
suggest(user, "write an interrupt routine, faggot");
pascal();
}

Just started studying python and studying automate.

Attached: gg.png (387x372, 8.32K)

from argparse import ArgumentParser, Namespace
import json
import subprocess
from pathlib import Path
from sys import stderr

def get_args() -> Namespace:
argParser = ArgumentParser()
argParser.add_argument("-n", "--name", action="store_true",
help="Show comma delimited filenames with the url in the output.")
argParser.add_argument(
"-s", "--single_line", action="store_true", help="Print output on a single line.")
argParser.add_argument("files", help="File to upload.",
nargs="+", action="extend")
pargs = argParser.parse_args()
pargs.files = list(map(lambda f: Path(f).resolve(), pargs.files))
return pargs

def format_response_links(name: str, path: str, with_name: bool) -> str:
if with_name:
return f"{name}, {path}"
else:
return f"{path}"

def uguu_upload(ps: list[Path], pargs: Namespace) -> None:
print("Uploading...", file=stderr)
errors = []
for p in ps:
try:
curl_complete_process = subprocess.run(
["curl", "-F",
f"files[]=@{str(p)}", "uguu.se/upload.php"],
capture_output=True)
curl_complete_process.check_returncode()
file_responses: list[dict[str, str]] = json.loads(
curl_complete_process.stdout)["files"]
except Exception as e:
errors.append(str(e))
continue
[print(format_response_links(f["name"], f["url"], pargs.name),
sep=" " if pargs.single_line else "\n",
end=" " if pargs.single_line else "\n")
for f in file_responses]
print("Done.", file=stderr)
print()
if len(errors) > 0:
[print(e, file=stderr) for e in errors]

pargs = get_args()
uguu_upload(pargs.files, pargs)

it uploads to uguu, had to take some stuff out to fit the size requirements but this should be functional.

neat

import cv2
import numpy as np
import imageio.v3 as iio
import imageio.v2 as iio2


def staticize(image):
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
w, h = grayscale.shape

probabilities = np.asarray(grayscale) / 255.0
bright = np.less_equal(np.random.rand(w, h), probabilities).astype(np.uint8) * 255
return bright

filename = "inputs/earth3.gif"
output_name = "outputs/poop.gif"
framerate = 12

output_frames = []
reader = iio.imiter(filename)
for frame in reader:
output_frames.append(staticize(frame))

iio2.mimwrite(output_name, output_frames, fps=framerate)


Turns gifs into B&W versions

Attached: poop.gif (400x400, 276.94K)

The concept can also be modified for still images and come up with various neat effects

Attached: test.gif (600x600, 650.65K)

interesting