Skip to content

Instantly share code, notes, and snippets.

@jasonsnell
jasonsnell / countduplicates.py
Created January 15, 2025 21:34
Count duplicates (2023 version)
#!/usr/bin/env python3
import collections
import subprocess
import re
theFinal = ""
def getClipboardData():
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE)
@jasonsnell
jasonsnell / countdupes.py
Last active February 8, 2025 22:02
Count Duplicates in List
import subprocess
import re
import sys
from Levenshtein import ratio
from collections import defaultdict, Counter
# Configuration: Adjust as needed
INCLUDE_PARENTHESES = False # Set to True to include parentheticals, False to exclude them
OUTPUT_TO_CLIPBOARD = True # Set to True to copy output to clipboard, False to print to console
@jasonsnell
jasonsnell / enphase_average.5m.py
Last active January 20, 2025 08:11
Enphase Envoy Local Data - SwiftBar/xBar Menu Bar Script
#! /usr/bin/env python3
# This script is explained here: <https://sixcolors.com/post/2024/10/putting-my-solar-system-in-my-menu-bar/>
# Adapted from grzegorz914@icloud.com <https://github.com/grzegorz914/homebridge-enphase-envoy>
# <xbar.title>Enphase Solar (Averages)</bitbar.title>
# <xbar.version>v1.2</xbar.version>
# <xbar.author>Jason Snell</xbar.author>
# <xbar.author.github>jasonsnell</xbar.author.github>
# <xbar.desc>Display local Enphase solar stats.</xbar.desc>
@jasonsnell
jasonsnell / weather graph.js
Created July 4, 2024 19:45
Weather graph widget for Scriptable
// Based on code by Efrén Gámez <https://gist.github.com/ImGamez/a8f9d77bf660d7703cc96fee87cdc4b0>
// and modified by Max Zeryck <https://talk.automators.fm/t/widget-examples/7994/217>
// this version by Jason Snell. parsing weatherkit data directly is beyond the scope of this widget;
// it loads a dumped weatherkit JSON from a remote server. Supply your own.
// This widget also loads live data from a weather station, again in a custom format.
// You will need to replace both of these data sources in order to get weather other than mine.
const highTemps = [ ]
const dailyConditions = [ ]
@jasonsnell
jasonsnell / sportinggreen.py
Last active May 20, 2023 02:08
Yet Another Web to RSS Scraper
#! /usr/bin/env python3
import os
import requests
from bs4 import BeautifulSoup
import hashlib
import PyRSS2Gen
import datetime
import html.entities
from urllib.parse import urljoin
@jasonsnell
jasonsnell / networkquality.30m.py
Created February 10, 2023 21:37
NetworkQuality for SwiftBar
#! /usr/bin/python3
# <xbar.title>Network Quality</xbar.title>
# <xbar.version>v1.1</xbar.version>
# <xbar.author>Jason Snell</xbar.author>
# <xbar.author.github>jasonsnell</xbar.author.github>
# <xbar.desc>Display current network quality from networkQuality binary.</xbar.desc>
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
import json
@jasonsnell
jasonsnell / echo.1m.py
Last active February 4, 2023 08:02
Echo Shortcut Notifier
#! /usr/bin/env python3
# <xbar.title>Echo Shortcut Notifier</xbar.title>
# <xbar.version>v1.01</xbar.version>
# <xbar.author>Jason Snell</xbar.author>
# <xbar.author.github>jasonsnell</xbar.author.github>
# <xbar.desc>Display status from Shortcuts.</xbar.desc>
import os
import datetime
#! /usr/local/bin/python3
# Recent daily rain script
# For WeatherCat - https://trixology.com
# By Jason Snell <jsnell@sixcolors.com>
import re
import matplotlib.pyplot as plt
from collections import defaultdict
from datetime import date
@jasonsnell
jasonsnell / weatherkit-sampleproject.py
Last active January 10, 2025 05:47
WeatherKit API sample
#! /usr/bin/env python3
import time
import jwt
import json
import requests
from datetime import datetime
from collections import defaultdict
import matplotlib.pyplot as plt
@jasonsnell
jasonsnell / stormlog.py
Last active March 29, 2022 22:26
WeatherCat storm log generator
#! /usr/local/bin/python3
# Storm Log script
# For WeatherCat - https://trixology.com
# By Jason Snell <jsnell@sixcolors.com>
import re
from collections import defaultdict
import datetime