This file contains hidden or 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 | |
| set -euo pipefail | |
| WF_TITLE="Compress images (10 MB)" | |
| WF_DIR="$HOME/Library/Services/${WF_TITLE}.workflow" | |
| WF_CONTENTS="$WF_DIR/Contents" | |
| SCRIPT="$HOME/.local/bin/compress_to_10mb.py" | |
| RAW_URL="https://gist.githubusercontent.com/jorgensandhaug/05c3066a4878497cc3718cd3233af02c/raw/compress_to_10mb.py" | |
| echo "Installing Quick Action: ${WF_TITLE}" | 
  
    
      This file contains hidden or 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 | |
| set -euo pipefail | |
| WF_TITLE="Compress images (10 MB)" | |
| WF_DIR="$HOME/Library/Services/${WF_TITLE}.workflow" | |
| WF_CONTENTS="$WF_DIR/Contents" | |
| SCRIPT="$HOME/.local/bin/compress_to_10mb.py" | |
| RAW_URL="https://gist.githubusercontent.com/jorgensandhaug/05c3066a4878497cc3718cd3233af02c/raw/compress_to_10mb.py" | |
| echo "Installing Quick Action: ${WF_TITLE}" | 
  
    
      This file contains hidden or 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 | |
| set -e -o pipefail | |
| WF_TITLE="Compress images (10 MB)" | |
| WF_DIR="/Users/jorgensandhaug/Library/Services/.workflow" | |
| WF_CONTENTS="/Contents" | |
| SCRIPT="/Users/jorgensandhaug/.local/bin/compress_to_10mb.py" | |
| RAW_URL="https://gist.github.com/jorgensandhaug/05c3066a4878497cc3718cd3233af02c/raw/compress_to_10mb.py" | |
| echo "Installing Quick Action: " | 
  
    
      This file contains hidden or 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
    
  
  
    
  | #!/usr/bin/env python3 | |
| import argparse, os, shutil, subprocess, sys, tempfile, time, unicodedata | |
| from pathlib import Path | |
| TARGET_BYTES = 10 * 1024 * 1024 | |
| RUN_TS = time.strftime("%Y%m%d-%H%M%S") | |
| os.environ["PATH"] = os.environ.get("PATH", "") + ":/opt/homebrew/bin:/usr/local/bin" | |
| MOZ = Path("/opt/homebrew/opt/mozjpeg/bin") | |
| CJPEG = str(MOZ / "cjpeg") if (MOZ / "cjpeg").exists() else "cjpeg" | |
| DJPEG = str(MOZ / "djpeg") if (MOZ / "djpeg").exists() else "djpeg" | |
| JPEGTRAN = str(MOZ / "jpegtran") if (MOZ / "jpegtran").exists() else "jpegtran" |