Skip to content

Instantly share code, notes, and snippets.

Aaron Parecki aaronpk

Block or report user

Report or block aaronpk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View install-composer.sh
#!/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 Dec 27, 2018
Make previews for a folder of .mov or .mp4 files that MacOS can open. Normalizes to 480x270 at 30fps and 96kbps audio.
View make-video-previews.sh
#!/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() {
View gogo.json
{
"Response": {
"status": 200,
"flightInfo": {
"logo": null,
"airlineName": null,
"airlineCode": "ASA",
"airlineCodeIata": null,
"tailNumber": "N248AK",
View is_valid_mf2_json.php
<?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 Jun 2, 2018
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!
View indieweb-summit-rsvp.html
<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 Feb 7, 2018
IndieAuth Client Quickstart
View index.php
<form action="/login.php" method="post">
<input type="url" name="url">
<input type="submit" value="Log In">
</form>
View watchtower.conf
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
View mp-config.json
{
"media-endpoint": "...",
"types": {
"h-entry": {
"properties": ["like-of","bookmark-of","photo","name","content"]
},
"h-event": {
"properties": [...]
},
"h-review": {
View media-endpoint.php
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Authorization');
if(isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/plain') !== false) {
$format = 'text';
} else {
header('Content-Type: application/json');
$format = 'json';
}
You can’t perform that action at this time.