endpoint.php

<?php
if ($_GET['action'] == 'channels') {
$channels = array(
array('uid' => 'notifications', 'name' => 'Notifications'),
array('uid' => 'home', 'name' => 'Home'),
);
header('Content-Type: application/json');
echo json_encode(array('channels' => $channels));
}
elseif ($_GET['action'] == 'timeline') {
$uid = $_GET['channel'];
$items = array();
if ($uid == 'notifications') {
$items[] = array(
'type' => 'entry',
'name' => 'Notification',
'content' => array(
'text' => 'simple text version',
'html' => 'simple <b>HTML</b> version',
),
'url' => 'https://example.com/1',
'published' => '2018-07-22T13:11:00+02:00',
'_id' => '1',
'_read'=> false,
);
} elseif ($uid == 'home') {
// add items to $items array ...
}
header('Content-Type: application/json');
echo json_encode(array('items' => $items, 'paging'=>array()));
}

microsub-protocol.go

type Microsub interface {
ChannelsGetList() []Channel
ChannelsCreate(name string) Channel
ChannelsUpdate(uid, name string) Channel
ChannelsDelete(uid string)

TimelineGet(before, after, channel string) Timeline

MarkRead(channel string, entry []string)

FollowGetList(uid string) []Feed
FollowURL(uid string, url string) Feed

UnfollowURL(uid string, url string)

Search(query string) []Feed
PreviewURL(url string) Timeline
}

.htaccess


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

config.json

{
"syndicate-to": [
{
"uid": "https://pinboard.in/pstuifzand",
"name": "pstuifzand on Pinboard"
},
{
"uid": "https://twitter.com/pstuifzand",
"name": "pstuifzand on Twitter"
}
],
"destination": [
{
"uid": "https://p83.nl/",
"name": "P83"
},
{
"uid": "https://example.com/",
"name": "Other blog"
}
],
"media-endpoint": "https://publog.stuifzandapp.com/media"
}

SXG.pm

# Simplest conversion from PHP to Perl.
# Based on PHP code from http://tantek.pbworks.com/w/page/19402946/NewBase60
# PHP code by Tantek Çelik http://tantek.com

sub num_to_sxg {
my ($n) = @_;
my $s = "";
my @m = split//,"0123456789ABCDEFGHJKLMNPQRSTUVWXYZ_abcdefghijkmnopqrstuvwxyz";
if (!$n) { return 0; }
while ($n>0) {
my $d = $n % 60;
$s = $m[$d].$s;
$n = ($n-$d)/60;
}
return $s;
}

sub num_to_sxgf {
my ($n, $f) = @_;
my $s = num_to_sxg($n);
if (!$f) {
$f=1;
}
$f -= length($s);
while ($f > 0) {
$s = "0".$s;
--$f;
}
return $s;
}

sub sxg_to_num {
my ($s) = @_;
my $n = 0;
my @s = split//,$s;
my $j = length($s);
for (my $i=0;$i<$j;$i++) {
my $c = ord($s[$i]);
if ($c>=48 && $c<=57) { $c=$c-48; }
elsif ($c>=65 && $c<=72) { $c-=55; }
elsif ($c==73 || $c==108) { $c=1; }
elsif ($c>=74 && $c<=78) { $c-=56; }
elsif ($c==79) { $c=0; }
elsif ($c>=80 && $c<=90) { $c-=57; }
elsif ($c==95) { $c=34; }
elsif ($c>=97 && $c<=107) { $c-=62; }
elsif ($c>=109 && $c<=122) { $c-=63; }
else { $c = 0; }
$n = 60*$n + $c;
}
return $n;
}

screenshot.sh

#!/bin/bash
bkdest=$HOME/Desktop/Screenshots/
target=${bkdest}/$(date +%Y_%m_%d_%H_%M_%S).png
mkdir -p $bkdest
/usr/bin/gnome-screenshot -f $target -a
/usr/bin/pinta "$target"
MEDIA=`shpub -d -s $SHPUB_SERVER upload $target | tail -n 1`
shpub -d -s $SHPUB_SERVER note -c screenshots -f $MEDIA --json Screenshot

helloworld.php

<?php

echo "hello, world\n";

Load more