Skip to content

Instantly share code, notes, and snippets.

View aaronpk's full-sized avatar

Aaron Parecki aaronpk

View GitHub Profile
<?php
function aqiFromPM($pm) {
if($pm >= 350.5)
return scale($pm, 500, 401, 500, 350.5);
if($pm >= 250.5)
return scale($pm, 400, 301, 350.4, 250.5);
if($pm >= 150.5)
return scale($pm, 300, 201, 250.4, 150.5);
if($pm >= 55.5)
moved to
https://github.com/aaronpk/youtube-chat-overlay
#!/bin/sh
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
@aaronpk
aaronpk / make-video-previews.sh
Created December 27, 2018 00:38
Make previews for a folder of .mov or .mp4 files that MacOS can open. Normalizes to 480x270 at 30fps and 96kbps audio.
#!/bin/bash
# Make previews for a folder of .mov or .mp4 files that MacOS can open.
# Normalizes to 480x270 at 30fps and 96kbps audio.
current_file=none
# Catch ctrl-c and stop the whole batch, otherwise ctrl-c just stops ffmpeg and the loop continues
trap ctrl_c INT
function ctrl_c() {
{
"Response": {
"status": 200,
"flightInfo": {
"logo": null,
"airlineName": null,
"airlineCode": "ASA",
"airlineCodeIata": null,
"tailNumber": "N248AK",
<?php
function is_valid_mf2_json($input) {
// Input to this function must be an array
if(!is_array($input))
return false;
// Keys type and properties are required at a minimum and must be arrays
if(!isset($input['type']) || !is_array($input['type']))
return false;
@aaronpk
aaronpk / indieweb-summit-rsvp.html
Last active June 2, 2018 19:33
Create an HTML page on your website and copy the below HTML into it. Replace the example URL and photo, and add your name. Then visit https://2018.indieweb.org/webmention and paste the link to your page!
<div class="h-entry">
<a class="p-author h-card" href="http://example.org">
<img src="http://example.org/photo.jpg" alt=""/>
Your Name Here</a>:
RSVP <span class="p-rsvp">yes</span>
to <a href="https://2018.indieweb.org/" class="u-in-reply-to">IndieWeb Summit</a>
</div>
@aaronpk
aaronpk / index.php
Last active February 7, 2018 19:37
IndieAuth Client Quickstart
<form action="/login.php" method="post">
<input type="url" name="url">
<input type="submit" value="Log In">
</form>
description "watchtower worker"
start on runlevel [2345]
stop on runlevel [016]
respawn
exec sudo -u ubuntu /usr/bin/php7.1 /web/sites/watchtower/scripts/watchtower.php >> /web/sites/watchtower/scripts/logs/init.log 2>&1
{
"media-endpoint": "...",
"types": {
"h-entry": {
"properties": ["like-of","bookmark-of","photo","name","content"]
},
"h-event": {
"properties": [...]
},
"h-review": {