Skip to content

Instantly share code, notes, and snippets.

View troutcolor's full-sized avatar

John Johnston troutcolor

View GitHub Profile
@troutcolor
troutcolor / photo-location.scpt
Created October 23, 2026 21:36
Get the location of a photo selected in the finder and opens OpenStreetMap with a pin on the location.
--needs exiftool, I use homebrew to install that
--15 is the zoom
tell application "Finder" to set imgpath to quoted form of POSIX path of first item of (selection as alias list)
set theloc to every text item of (do shell script "/opt/homebrew/bin/exiftool -n -p '$GPSLatitude,$GPSLongitude' " & imgpath) as string
if theloc is "" then
return
@troutcolor
troutcolor / quoteSelToRSSChat.scpt
Created August 9, 2026 16:00
AppleScript to grap selection from safari and post it and link to rss.chat see https://github.com/scripting/rss.chat/blob/main/server/docs/api.md
--for posting a link with selected text from Safari to rss.chat
-- I use FastScripts
--needs jq, I installed that with homebrew
property rssChatUrl : "https://example.com/newpost"
property emailAddress : "email@example.com"
property emailCode : "rsschatemailcode"
tell application "Safari"
@troutcolor
troutcolor / feedlandRiverInclude.php
Created May 6, 2026 18:53
‘urlfeedlandserver’ defaults to ‘https://feedland.com/’, ‘screenname’ defaults to => ‘davewiner’, ‘catname’ defaults to => ‘All’ Example: Example shortcode: [feedlandriverinclude screenname="johnjohnston" cat="blogroll"]
<?php
/**
* Plugin Name: FeedLand River Include
* Description: Embeds a FeedLand river viewer via shortcode [feedlandriverinclude].
* Version: 1.0.0
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
if ( ! defined( 'ABSPATH' ) ) {
@troutcolor
troutcolor / gif_frame_reduction.sh
Last active February 18, 2026 09:43
takes an input gif, deletes every second frame, sets the delay to each frame plus the delay of the frame after it. Good for shrinking the size of gifs.
#!/bin/bash
# Usage: ./reduce_gif_frames.sh input.gif output.gif
if [ $# -ne 2 ]; then
echo "Usage: $0 input.gif output.gif"
exit 1
fi
INPUT_GIF="$1"
@troutcolor
troutcolor / app-and-system.sh
Created November 23, 2024 17:20
Script to get mac and os, current app and version info and put it on the clipboard
#!/bin/bash
# Get computer model
MODEL=$(sysctl -n hw.model)
# Get OS version
OS_VERSION=$(sw_vers -productVersion)
# Get frontmost app and its version
FRONT_APP=$(lsappinfo info -only name `lsappinfo front | sed 's/-/-0x/'` | cut -d '"' -f 4)
@troutcolor
troutcolor / gpx2geojson.js
Last active March 8, 2026 17:12
makes 9x9 montages of photos the middle image is a map where the photos are taken and a gpx track. photos need to be geotagged.
#!/usr/bin/env node
// gpx2geojson.js — Convert a GPX track to a URL-encoded GeoJSON string (≤1024 chars)
//
// Usage:
// node gpx2geojson.js [options] <file.gpx>
//
// Options:
// --max-len <n> Max URL-encoded output length (default: 1024)
// --tolerance <n> Starting RDP epsilon in degrees (default: 0.0001)
// --linecolor <hex> Line colour (default: #0099ff)
@troutcolor
troutcolor / montage-tabs-2.scpt
Created October 21, 2023 14:30
Make a montage of screenshots of the tabs open in Safari's top window
set URLs to windowOneTabs()
set mytempFolder to do shell script "mktemp -d "
set c to 0
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "New Window" of menu "File" of menu bar 1
@troutcolor
troutcolor / montage-tabs.scpt
Last active September 9, 2023 10:19
make a montage of screenshots from Safari tabs in top window. appleScript needs imageMagick & shot-scraper
--needs imageMagick & shot-scraper paths below refere to homebrew installs of both (guessing from the path)
--https://shot-scraper.datasette.io/en/stable/
set mytempFolder to do shell script "mktemp -d "
--just to watch things happening
do shell script "open " & mytempFolder
tell application "Safari"
set themax to number of tabs of window 1
@troutcolor
troutcolor / flickr-montage.sh
Last active August 14, 2024 18:17
#script to download pile of flickr images and make a montage #needs montage command which comes with imagemagick I install that with homebrew #some notes at the end of the file
#!/bin/bash
#ToDOs
# find how how many photos and work out pages automatically
# use parameters in terminal rather than in script
#2024 additions
# Added Morning audio choice, gentler added a fade to the audio
# only use sox if the audio is not long enough
body { background-image: linear-gradient(to right, #00b09b, #96c93d); }
#idProductLogo img{ border-radius:25%; }
@media screen and (max-width: 1200px) {
.divRiverDisplay { width: 95%; }
.divRiverContent{ width:98%; }
.divMoreButton { display:block; }
.divPageBody { width:94%; }
}
.divPageBody { margin-top: 30px; }