Small cleanup
This commit is contained in:
parent
4b6a250126
commit
56e43e1e16
@ -1,6 +1,6 @@
|
||||
bl_info = {
|
||||
"name": "Evan's Y-aligned Camera Creator",
|
||||
"author": "Evan Pratten <ewpratten@gmail.com>",
|
||||
"author": "Evan Pratten <evan@ewpratten.com>",
|
||||
"version": (1, 0),
|
||||
"blender": (3, 0, 0),
|
||||
"description": "Adds a camera that is aligned with the Y axis by default",
|
||||
|
@ -47,5 +47,6 @@
|
||||
[credential "https://gist.github.com"]
|
||||
helper =
|
||||
helper = !/usr/bin/gh auth git-credential
|
||||
|
||||
[push]
|
||||
autoSetupRemote = true
|
||||
|
@ -21,8 +21,8 @@ Host github.com gist.github.com
|
||||
Host unifi
|
||||
HostName dreammachinepro.local
|
||||
User root
|
||||
#PreferredAuthentications password
|
||||
# PubkeyAuthentication no
|
||||
PreferredAuthentications password
|
||||
PubkeyAuthentication no
|
||||
|
||||
Host ewpratten-steamdeck
|
||||
HostName ewpratten-steamdeck.local
|
||||
@ -36,9 +36,6 @@ Host 10.80.0.218
|
||||
PubkeyAcceptedKeyTypes +ssh-rsa
|
||||
HostKeyAlgorithms=+ssh-rsa
|
||||
|
||||
Host sniffr.home
|
||||
User pi
|
||||
|
||||
# Default hostnames I may encounter in the wild
|
||||
Host openrepeater.local
|
||||
HostName openrepeater.local
|
||||
@ -113,7 +110,7 @@ Host gianna-desktop
|
||||
|
||||
# Various Aliases
|
||||
Host desktop
|
||||
HostName desktop.evan.vpn.ewp.fyi
|
||||
HostName ewpratten-desktop.home
|
||||
|
||||
Host laptop
|
||||
HostName laptop.evan.vpn.ewp.fyi
|
||||
HostName ewpratten-laptop.home
|
||||
|
@ -1,58 +0,0 @@
|
||||
#! /usr/bin/env python3
|
||||
import sys
|
||||
import requests
|
||||
import json
|
||||
import argparse
|
||||
import os
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
import netrc
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("image", help="Image to upload")
|
||||
ap.add_argument("--no-compress", help="Don't compress the image", action="store_true")
|
||||
args = ap.parse_args()
|
||||
|
||||
# Load the API key from the .netrc file
|
||||
if "catto.pictures" not in netrc.netrc().hosts:
|
||||
print("No catto.pictures entry in .netrc file")
|
||||
return 1
|
||||
login, account, password = netrc.netrc().authenticators("catto.pictures")
|
||||
|
||||
# Parse the image to a path
|
||||
image_path = Path(args.image)
|
||||
|
||||
# Ensure the file actually exists
|
||||
if not image_path.exists():
|
||||
print("File not found", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
# Compress the image to a temporary file
|
||||
with tempfile.NamedTemporaryFile(suffix=image_path.suffix) as temp:
|
||||
# Compress
|
||||
if not args.no_compress:
|
||||
os.system(f"convert {image_path} -quality 25% {temp.name}")
|
||||
image_path = Path(temp.name)
|
||||
|
||||
# Strip all exif data
|
||||
os.system(f"exiftool -EXIF= {image_path}")
|
||||
|
||||
# Upload the image
|
||||
with open(image_path, "rb") as f:
|
||||
r = requests.post(
|
||||
"https://upload.catto.pictures",
|
||||
files={"image": (temp.name, f, f"image/{image_path.suffix[1:]}")},
|
||||
headers={
|
||||
"Authorization": password,
|
||||
"Domain": "img.ewpratten.com",
|
||||
}
|
||||
)
|
||||
if r.status_code != 200:
|
||||
print(f"Error uploading image:\n{r.text}", file=sys.stderr)
|
||||
return 1
|
||||
print(json.loads(r.text)["url"])
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
Loading…
x
Reference in New Issue
Block a user