Skip to content

Instantly share code, notes, and snippets.


Dave Winer scripting

View GitHub Profile
View filter.js
const folder = "/root/Dropbox/Miami/littleoutliner/publicFiles/users/";
var url = options.httpRequest.url;
var splits = url.split ("?");
url = splits [0];
splits = url.split ("/");
var username = splits [1], fname = splits [2];
if ((username === undefined) || (fname === undefined)) { //tell pagePark we're not handling it
callback (undefined, {flNotHandled: true});
scripting / code.js
Created Sep 5, 2020
Reading BingeWorthy's RSS feed
View code.js
const urlfeed = "";
function httpRequest (url, timeout, headers, callback) {
timeout = (timeout === undefined) ? 30000 : timeout;
var jxhr = $.ajax ({
url: url,
dataType: "text",
scripting / gist:60669da00b3b49d49ce3f23543fd99d6
Created Jul 3, 2020
Les Orchard's low-level S3 code in Frontier, been running constantly since '06.
View gist:60669da00b3b49d49ce3f23543fd99d6
on httpClient(method="GET", resource="/", adrParams=nil, content=nil, adrMeta=nil, acl=nil, content_type="", idaccount="default", debug=false, flHttpMessages=false) {
«8/24/13; 10:50:08 AM by DW
«If the metadata key is website-redirect-location, then we special-case the addition of the header so as not to add the string "meta-" -- which causes it to break. Not sure if the setting metadata feature ever worked, but this is the most conservative approach to avoiding breakage.
«7/10/06; 8:38:52 PM by DW
«Added flHttpMessages optional param, default false. Determines if HTTP calls display messages in the About window.
«4/11/06; 7:11:53 AM by DW
«Changed name of the compiled xml structure to xstruct. It's generally not a good idea to use the names of built-in tables in naming data or code, although this naming couldn't have hurt anything because it's in a table.
«Fixed the error-handling code. If the server returns an error, we throw a scriptError, but before doing that, we set various
scripting / credentials
Created May 23, 2020
Example of an AWS credentials file (with random strings in place of actual values)
View credentials
scripting /
Created Apr 28, 2020
Run an AWS command line script from a Node app (demo)
aws s3 cp s3:// --acl public-read
scripting / runfilterscript.js
Created Apr 22, 2020
Chuck this is how I run filter scripts. I probably will convert to requireFromString.
View runfilterscript.js
function runFilterScript (host, callback) { //3/23/20 by DW
var f = getFullFilePath (domainsPath) + host + filterFname;
fs.readFile (f, function (err, data) {
if (err) {
callback (false); //file doesn't exist -- we didn't run the filter script
else {
try {
const options = {
View mymodule.js
exports.helloWorld = function () {
return ("hello world");
scripting / zipExample.js
Last active Apr 12, 2020
Psuedocode for how I'd like zip archivng to work. It gives me full JS to decide if a file belongs or doesn't.
View zipExample.js
const zip = require ("davezip");
const fs = require ("fs");
const theArchiveFile = zip.createArchive ('");
fs.fileloop ("/users/bullmancuso/publicfiles/", function (err, f) { //I made up fs.fileloop, it would be nice ;-)
if (f.hasExtension (".opml")) {
zip.addToArchive (f, theArchiveFile);
scripting / config.json
Created Apr 11, 2020
A PagePark config.json file demonstrating the use of mirrors
View config.json
"mirrors": {
"/": ""
scripting / filter.js
Last active Apr 2, 2020
Example of a PagePark plug-in
View filter.js
//translate a url in this form:
//to a file path like this: /root/apps/littleoutliner/publicFiles/users/davewiner/myOutlines/example.opml
exports.filter = filter;
const folder = "/root/apps/littleoutliner/publicFiles/users/";
function filter (options, callback) {
var url = options.httpRequest.url;
var splits = url.split ("?");
You can’t perform that action at this time.