Skip to content

Instantly share code, notes, and snippets.

View aaronpk's full-sized avatar

Aaron Parecki aaronpk

View GitHub Profile
@aaronpk
aaronpk / _howto.md
Last active May 2, 2024 01:11
How to compile and install spatialite on iOS

Spatialite for iOS

Install compiler dependencies

brew install automake autoconf libtool libxml2 pkg-config
brew link libxml2

Build libspatialite

@aaronpk
aaronpk / json format for geo data
Created April 30, 2010 16:47
A JSON protocol for sharing and storing real-time data streams. Common use would be for sharing location data.
Common minimal format for sending just lat/long data
[
{
uuid: "550e8400-e29b-41d4-a716-446655440000",
date: "2010-04-30T16:50:00Z",
location: {
position: {
latitude: 45.5118,
longitude: -122.6433
}
@aaronpk
aaronpk / gist:5846789
Last active January 2, 2024 22:47
Added WebFinger support to my email address using one rewrite rule and one static file.
[aaron@parecki.com www]$ cat .htaccess
RewriteEngine on
RewriteCond %{QUERY_STRING} resource=acct:(.+)
RewriteRule ^\.well-known/webfinger /profile/%1? [L]
[aaron@parecki.com www]$ cat profile/aaron@parecki.com
{
"subject": "acct:aaron@parecki.com",
"links": [
{
@aaronpk
aaronpk / payload.json
Created September 11, 2012 00:27
Example payload sent to callback URL
{
"layer":{
"bounds":{
"center":{
"latitude":45.521740823313,
"longitude":-122.68043538074
},
"map":"http://map.geoloqi.com/45.521752557438,-122.68041864527?radius=546.45073462403",
"ne":{
"latitude":45.524569933375,
@aaronpk
aaronpk / media-endpoint.php
Last active March 6, 2021 23:47
an example of a Micropub Media Endpoint https://www.w3.org/TR/micropub/#media-endpoint
<?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';
}
@aaronpk
aaronpk / README.md
Last active February 16, 2021 18:02

Swap out the two URLs (first is source, second is target) then run with curl:

curl -X POST -d @pingback.xml http://example.com/xmlrpc
<?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
@aaronpk
aaronpk / canonical.php
Created December 20, 2016 01:47
Given an input URL, find the canonical URL after following redirects and looking at rel=canonical
<?php
if(!isset($_GET['url'])) {
?>
<form action="" method="get">
<input type="url" name="url">
<input type="submit" value="Go">
</form>
<?
die();
}
@aaronpk
aaronpk / webmention.html
Last active March 17, 2019 14:06
Display webmention count with no jQuery or external Javascript libraries
<span id="webmention-count"></span>
<script type="text/javascript">
function loadWebmentions(data){
document.getElementById("webmention-count").innerHTML = data.count + " mentions";
}
</script>
<script type="text/javascript" src="http://webmention.io/api/count?jsonp=loadWebmentions&amp;target=http://example.com/page/100"></script>