Skip to content

Instantly share code, notes, and snippets.

View aaronpk's full-sized avatar

Aaron Parecki aaronpk

View GitHub Profile

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
class MF2Object {
protected $_data;
protected $_parent;
public function __construct($data, $parent=null) {
if(is_array($data))
$this->_data = json_decode(json_encode($data));
else
$this->_data = $data;
@aaronpk
aaronpk / gist:5846789
Last active October 10, 2025 15:42
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 / gist:6040998
Last active December 20, 2015 00:19
flickr doing scheduled maintenance

We see that you own an active API key for the Flickr API, and wanted to let you know that Flickr is scheduling a maintenance outage for Thursday, July 25th, from 4 to 10pm PDT. During the outage window, the Flickr API will be unavailable. As such, you may want to adjust your app to gracefully handle the error that will result when it calls our API during the outage. (If your app is not yet public, this will only impact your personal use of the API.)

Specifically, a call to the Flickr API will result in the following error: 105: Service currently unavailable (Site Disabled). Here are example responses to expect:

XML (REST):

sub microformats_server_start {
my $kernel = $_[KERNEL];
my $socket = IO::Socket::INET->new(
Proto => 'udp',
LocalPort => $conf->{UDP_LISTEN_MF},
);
die "Couldn't create server socket: $!" unless $socket;
$kernel->select_read( $socket, "get_datagram" );
# My setup of Terminal-Notifier
# https://github.com/alloy/terminal-notifier
cd ~/scripts
curl -O http://cloud.github.com/downloads/alloy/terminal-notifier/terminal-notifier_1.4.2.zip
unzip terminal-notifier_1.4.2.zip
mv terminal-notifier_1.4.2/terminal-notifier.app ./
# in .bash_profile, add:
alias notify="/Users/aaronpk/scripts/terminal-notifier.app/Contents/MacOS/terminal-notifier"
me:
ifeq ($(USER), root)
@echo "\c"
else
@echo "make \c"
endif
a:
ifeq ($(USER), root)
@echo "\c"
@aaronpk
aaronpk / Makefile
Last active December 20, 2015 10:39
me:
ifeq ($(USER), root)
@echo "\c"
else
@echo "make \c"
endif
a:
ifeq ($(USER), root)
@echo "\c"
class NilClass
def [](key)
nil
end
end
payload = nil
puts payload['pull_request']['base']['ref'].inspect
$ ruby test.rb
@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>