Skip to content

Instantly share code, notes, and snippets.

@dshanske
dshanske / activitypub-xray.php
Created December 22, 2022 20:50
ActivityPub Xray Override
add_action( 'init', 'activitypub_xray_override_init', 11 );
function activitypub_xray_override_init() {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$accept_header = $_SERVER['HTTP_ACCEPT'];
if ( stristr( $accept_header, 'application/activity+json' ) && stristr( $user_agent, 'XRay' ) ) {
remove_filter( 'template_include', array( '\Activitypub\Activitypub', 'render_json_template' ), 99 );
}
}
@dshanske
dshanske / mqttstream2discover.yaml
Last active June 20, 2021 22:20 — forked from koying/mqttstream2discover.yaml
Home assistant MQTT Statestream to MQTT Discovery blueprint - Modified to use 2 different topics
blueprint:
name: MQTT Statestream to MQTT Discovery 2021.03
description: Creates an MQTT discovery entry for every entity streamed via MQTT Statestream.
domain: automation
input:
ha_stream:
name: HA stream
description: The HA statestream topic prefix used
mode: parallel
{
"checkin": {
"name": "Bishops Barbershop",
"location": "Portland, Oregon",
"latitude": "45.549709",
"longitude": "-122.675601",
"url": "https://foursquare.com/v/4f8f4403e4b04e1743c60e93",
"type": "card"
},
"photo": "https://aaronparecki.com/img/1240x0/2020/08/05/14/photo.jpg",
[{"class":"com.bluebird.web.notification.TravelNotificationResponse","eventType":"TRAVEL_NOTIFICATION_EVENT","message":null,"travelInforesponse":{"airplaneIconImagePath":null,"altitude":"34024","arrivalAirport":{"airportCode":"SFO","airportMobilesiteURL":"http://mobile.jetblue.com/mt/help.jetblue.com/SRVS/CGI-BIN/webisapi.dll?New,Kb=askBlue,case=obj(382909)","airportName":"San Francisco International Airport","airportWebsiteURL":"http://help.jetblue.com/SRVS/CGI-BIN/webisapi.dll?New,Kb=askBlue,case=obj(382909)","city":{"activities":{"activity":[],"class":"com.bluebird.core.valueobjects.travel.cities.Activities"},"airports":{"airport":[{"IATA":"SFO","ICAO":"KSFO","class":"com.bluebird.core.valueobjects.travel.cities.Airport","jbsitemoburl":"http://mobile.jetblue.com/mt/help.jetblue.com/SRVS/CGI-BIN/webisapi.dll?New,Kb=askBlue,case=obj(382909)","jbsiteurl":"http://help.jetblue.com/SRVS/CGI-BIN/webisapi.dll?New,Kb=askBlue,case=obj(382909)","name":"San Francisco International Airport"}],"class":"com.bluebird.core
services.inflightpanasonic.aero/inflight/services/flightdata/v2/flightdata
{ "decompression_state": false, "weight_on_wheels": false, "all_doors_closed": true, "ground_speed_knots": 477, "time_to_destination_minutes": 266, "wind_speed_knots": 20, "flight_speed_mach": 0.806, "true_heading_degree": 69, "current_utc_time": "00:01", "outside_air_temp_celsius": -49, "head_wind_speed_knots": 20, "current_utc_date": "2019-11-22", "distance_to_destination_nautical_miles": 2190, "altitude_feet": 35013, "destination_icao": "EIDW", "departure_icao": "KJFK", "flight_number": "EI104", "destination_iata": "DUB", "departure_iata": "JFK", "tail_number": "EI-DUZ", "flight_phase": "cruising", "departure_utc_offset_minutes": -300, "destination_utc_offset_minutes": 0, "route_id": 5, "time_at_origin": "19:01", "time_at_destination": "00:01", "distance_from_departure_nautical_miles": 564, "distance_traveled_nautical_miles": 557, "estimated_arrival_time_utc": "04:27", "ta
http://getconnected.southwestwifi.com/current.json
{"pcent_flt_complete": 0, "altVal": "-24", "lon": "-73.867", "satcomm_status": {"commlink": "active", "linkparams": "not-stale"}, "dtzone": "CDT", "within_us": true, "etad": "09:20 AM", "lat": "40.775", "gspdVal": "10", "ttgc": "2h 15m", "dist_remain": "888", "actime24": "07:05"}
[{"class":"com.bluebird.web.notification.TravelNotificationResponse","eventType":"TRAVEL_NOTIFICATION_EVENT","message":null,"travelInforesponse":{"airplaneIconImagePath":null,"altitude":"36031","arrivalAirport":{"airportCode":"FLL","airportMobilesiteURL":"http://mobile.jetblue.com/mt/help.jetblue.com/SRVS/CGI-BIN/webisapi.dll?New,Kb=askBlue,case=obj(3271)","airportName":"Fort Lauderdale Hollywood International Airport","airportWebsiteURL":"http://help.jetblue.com/SRVS/CGI-BIN/webisapi.dll?New,Kb=askBlue,case=obj(3271)","city":{"activities":{"activity":[{"class":"com.bluebird.core.valueobjects.travel.cities.Activity","name":"DO","section":[{"class":"com.bluebird.core.valueobjects.travel.cities.Section","description":"Waves or no waves, at Fort Lauderdale Kite Surfing Co. you can experience the fun of wakeboarding, paragliding and surfing.","title":"Surf's way up"},{"class":"com.bluebird.core.valueobjects.travel.cities.Section","description":"The best way to experience the Everglades, the one-hour Airboat Everg
@dshanske
dshanske / Guide to FlyFi data
Created January 7, 2019 02:37
How to Get FlyFi data
Url is http://www.flyfi.com/ajax/notification.do
POST to the url using parameter actionkey=TRAVEL_PAGE_REFERESH
For FlyFi status, use actionkey=WEB_HOME_PAGE
@dshanske
dshanske / 06jan18-b61472
Created January 7, 2019 02:30
FlyFi B6 1472 06jan18
[{"class":"com.bluebird.web.notification.TravelNotificationResponse","eventType":"TRAVEL_NOTIFICATION_EVENT","message":null,"travelInforesponse":{"airplaneIconImagePath":null,"altitude":"28920","arrivalAirport":{"airportCode":"LGA","airportMobilesiteURL":"http://mobile.jetblue.com/mt/help.jetblue.com/SRVS/CGI-BIN/webisapi.dll?New,Kb=askBlue,case=obj(10487)","airportName":"LaGuardia International Airport","airportWebsiteURL":"http://help.jetblue.com/SRVS/CGI-BIN/webisapi.dll?New,Kb=askBlue,case=obj(10487)","city":{"activities":{"activity":[{"class":"com.bluebird.core.valueobjects.travel.cities.Activity","name":"DO","section":[{"class":"com.bluebird.core.valueobjects.travel.cities.Section","description":"With 45 exhibition halls and more than 32 million artifacts and specimens, the American Museum of Natural History is the world's largest, most important and most innovative museum of its kind. Explore its famous dinosaur halls, which use real fossils; the life-size \"Dzanga-Sangha Rainforest,\" complete with th
@dshanske
dshanske / kind-register.php
Created December 14, 2018 00:59
Example Plugin for Registering Kinds(untested)
<?php
/**
* Plugin Name: Register Post Kind - Name
* Plugin URI: https://example.com
* Description: Register Post Kind
* Version: None
* Author:
* Author URI:
* Text Domain:
* Domain Path: