Skip to content

Instantly share code, notes, and snippets.

@jasonsnell
jasonsnell / gist:5033421
Created February 25, 2013 21:19
Macworld/IDG Markdown to HTML AppleScript
--Macworld Markdown to HTML script
--by Jason Snell <jsnell@macworld.com>
--Markdown and SmartyPants by John Gruber <http://daringfireball.net/projects>
--Version 10: Added Euro support and forced Unicode for output file
--Version 11: Output now opens as new document in source window.
--Version 12: Makes sure the output document is set to source language of HTML
--Version 13: Support for [[jump]] tag
--Version 14: Rewrite iLife ‘09 style tags to proper ’09 style.
--Version 15: Support pound symbol
@jasonsnell
jasonsnell / aqmono.5m.php
Last active September 6, 2020 16:25
Monochrome Air Quality BitBar plugin
#!/usr/bin/env php
<?php
error_reporting( 0 );
// find a PurpleAir sensor ID on the PurpleAir map and put that ID in $show
$show = '6732';
$url = ( 'https://www.purpleair.com/json?show=' . $show );
// Get the sensor data via JSON
@jasonsnell
jasonsnell / purpleaqijsnell.js
Last active October 7, 2020 22:42
Purple AQI Widget
I've moved this to a proper GitHub project.
Check it out at:
https://github.com/jasonsnell/PurpleAir-AQI-Scriptable-Widget
@jasonsnell
jasonsnell / epaaq.5m.php
Last active December 18, 2020 18:07
Air quality from PurpleAir sensor but with EPA adjustments
#!/usr/bin/env php
<?php
error_reporting( 0 );
// This version requires SwiftBar, rather than BitBar. swiftbar.app
// <bitbar.title>EPA Air Quality</bitbar.title>
// <bitbar.version>v2.0</bitbar.version>
// <bitbar.author>Jason Snell</bitbar.author>
// <bitbar.author.github>jasonsnell</bitbar.author.github>
@jasonsnell
jasonsnell / airquality.scpt
Created August 26, 2020 17:50
Air Quality AppleScript
-- PurpleAir station ID
set theStationID to "6732"
tell application "JSON Helper"
set theWeather to (fetch JSON from ("https://www.purpleair.com/json?show=" & theStationID) with cleaning feed)
set theStatsA to (read JSON from (Stats of item 1 of results of theWeather))
set theStatsB to (read JSON from (Stats of item 2 of results of theWeather))
set theLocation to Label of item 1 of results of theWeather
set theLat to (Lat of item 1 of results of theWeather)
set theLon to (Lon of item 1 of results of theWeather)
@jasonsnell
jasonsnell / gist:1b728736c636272bc5da
Last active January 18, 2022 22:17
Use this in an Automator action set to accept file input from the command line
for i in "$@" ; do /Users/jsnell/ffmpeg -i "$i" -map 0:0 -acodec pcm_s16le -ac 1 -out_sample_rate 44100 "${i%.*}.wav" ; done
@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
@jasonsnell
jasonsnell / podcast-noter.scpt
Last active October 27, 2022 15:33
Podcast Noter AppleScript
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
# Sample Keyboard Maestro macros at
# <https://sixcolors.com/wp-content/uploads/2022/01/Podcast-Noter-Macros.kmmacros.zip>
on run argv
try
set theNote to (item 1 of argv)
on error
#! /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 / aq.5m.php
Last active January 31, 2023 12:50
BitBar plugin for air quality
#!/usr/bin/env php
<?php
error_reporting( 0 );
// This version is for SwiftBar. swiftbar.app
// <bitbar.title>EPA Air Quality</bitbar.title>
// <bitbar.version>v2.0</bitbar.version>
// <bitbar.author>Jason Snell</bitbar.author>
// <bitbar.author.github>jasonsnell</bitbar.author.github>