News for hackers. Stuff that matters.
Re:Show HN: #!/usr/bin/env docker run by pronoiac on Sunday January 14, 2024 @12:52PM (#38992540)
Ah. I think two leading spaces fix this? I'll try:

  #! /usr/bin/env nix-shell
  #! nix-shell -i python3 -p python3Packages.pillow python3Packages.ansicolor
  
  # scale image by 50%
  import sys, PIL.Image, ansicolor
  path = sys.argv[1]
  image = PIL.Image.open(path)
  factor = 0.5
  image = image.resize((round(image.width \* factor), round(image.height \* factor)))
  path = path + ".s50.jpg"
  image.save(path)
  print(ansicolor.green(f"done {path}"))

There are no comments on this comment yet.