Skip to content

Instantly share code, notes, and snippets.

View scotthansonde's full-sized avatar

Scott Hanson scotthansonde

View GitHub Profile
@scotthansonde
scotthansonde / rsscloud-ping.php
Created November 21, 2025 17:31
A short WordPress plugin to ping rpc.rsscloud.io on new posts and updates
<?php
/**
* Plugin Name: RSSCloud External Ping
* Description: Adds <cloud> to RSS2 and pings an external rssCloud server on post publish/update.
* Version: 0.0.1
* Author: Scott Hanson
* Author URI: https://wordland.shanson.de
* License: GNU General Public License v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
@scotthansonde
scotthansonde / import-feed.php
Last active July 7, 2025 06:35
One-off php script to import a linkblog RSS feed into WordPress, putting the <link> item into a custom field
<?php
// Load WordPress
require_once(dirname(__FILE__) . '/../../../../wp-load.php');
// URL to the RSS feed
$feed_url = 'https://dave.linkblog.org/'; // Replace with your actual feed URL
$rss = simplexml_load_file($feed_url);
if (! $rss) {
@scotthansonde
scotthansonde / Caddyfile
Last active February 9, 2023 08:23
Caddyfile for secure websockets with PagePark
# If you are running myfeedland.io behind PagePark in config.json set
# "urlWebsocketServerForClient": "wss://myfeedland.io/"
# so Caddy can catch the websocket requests
{
on_demand_tls {
ask http://localhost:1339/isdomainvalid
interval 2m
burst 5
}
select * from items where flDeleted=false and feedurl in ('http://nytimes.com/timeswire/feeds/','http://rss.nytimes.com/services/xml/rss/nyt/Baseball.xml','http://rss.nytimes.com/services/xml/rss/nyt/ProBasketball.xml','http://www.nytimes.com/svc/collections/v1/publish/www.nytimes.com/column/bret-stephens/rss.xml','http://www.nytimes.com/svc/collections/v1/publish/www.nytimes.com/column/charles-m-blow/rss.xml','http://www.nytimes.com/svc/collections/v1/publish/www.nytimes.com/column/david-brooks/rss.xml','http://www.nytimes.com/svc/collections/v1/publish/www.nytimes.com/column/ezra-klein/rss.xml','http://www.nytimes.com/svc/collections/v1/publish/www.nytimes.com/column/farhad-manjoo/rss.xml','http://www.nytimes.com/svc/collections/v1/publish/www.nytimes.com/column/frank-bruni/rss.xml','http://www.nytimes.com/svc/collections/v1/publish/www.nytimes.com/column/gail-collins/rss.xml','http://www.nytimes.com/svc/collections/v1/publish/www.nytimes.com/column/jamelle-bouie/rss.xml','http://www.nytimes.com/svc/collect
// using mysql2 so I can use promises
async function main() {
var mysql = require('mysql2/promise')
const connection = await mysql.createConnection({
host: 'xxx',
user: 'xxx',
password: 'xxx',
database: 'feedland',
charset: 'utf8mb4',
@scotthansonde
scotthansonde / gist:2591e47060e1258a2c288a19b66297f9
Created June 23, 2022 05:44
GL Error Electron 7 in Crostini
[1099:0622/183029.555480:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command
[1099:0622/183035.435877:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command
{
"semi": false,
"singleQuote": true,
"printWidth": 80
}
{
"productName": "Electric Drummer",
"electronVersion": "7.1.10",
"mac": {
"target": "dmg",
"identity": null,
"icon": "../drummer.icns"
},
"dmg": {
"sign": false
@scotthansonde
scotthansonde / decode.js
Created March 30, 2018 21:53
Setting encode to latin1 and skipping iconv
const request = require("request");
const urlTestFeed = "https://www.presseportal.de/rss/dienststelle_110972.rss2";
request({
uri: urlTestFeed, encoding: "latin1"
},
function (err, response, theString) {
// var iconv = new Iconv("ISO-8859-1", "UTF-8");
// theString = iconv.convert(theString.toString()).toString();
@scotthansonde
scotthansonde / decode.js
Last active March 30, 2018 22:00
decode.js passing encoding option to request
// This answer is wrong, see https://gist.github.com/papascott/d81264223a5d492af040ea6f0277e041
const Iconv = require("iconv").Iconv;
const request = require("request");
const urlTestFeed = "https://www.presseportal.de/rss/dienststelle_110972.rss2";
request({
uri: urlTestFeed,
encoding: "latin1"