Skip to content

Instantly share code, notes, and snippets.

View bwestergard's full-sized avatar

Björn Westergard bwestergard

  • Mt. Pleasant, Washington, D.C.
View GitHub Profile
@bwestergard
bwestergard / hourly-news.sh
Created February 17, 2021 18:14
NPR Hourly News Update
#!/bin/bash
# Checks to see if there is a new hourly news update, plays it if there is.
# Stores the last played newscast URL in last_newscast_url.txt
# Can be invoked with cron or: watch -n 30 ./hourly-news.sh
latest_newscast_url=$(curl -s https://feeds.npr.org/500005/podcast.xml | grep enclosure | cut -d \" -f2)
last_newscast_url=$(cat last_newscast_url.txt)
if [ "$latest_newscast_url" = "$last_newscast_url" ]; then
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title><![CDATA[PBS NewsHour - Full Show]]></title>
<link>https://www.pbs.org/newshour/video</link>
<atom:link href="https://www.pbs.org/newshour/feeds/rss/podcasts/show" rel="self" type="application/rss+xml" />
<language>en-US</language>
<copyright>2021 NewsHour Productions LLC. All Rights Reserved.</copyright>
<description><![CDATA[Listen to the complete PBS NewsHour, specially formatted as a podcast. Published each night by 9 p.m., our full show includes every news segment, every interview, and every bit of analysis as our television broadcast. Is this not what you're looking for? Don't miss our other podcasts for our individual segments, Brooks and Capehart, Politics Monday, Brief but Spectacular, and more. Find them in iTunes or in your favorite podcasting app. PBS NewsHour is sup
@bwestergard
bwestergard / example-feed.rss
Last active June 4, 2021 19:27
Websub Feed
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:npr="https://www.npr.org/rss/" xmlns:nprml="https://api.npr.org/nprml" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel>
<title>NPR News Now</title>
<atom:link href="https://gist.githubusercontent.com/bwestergard/146ec19a78d5616b497d074d4da00c44/raw/e99315314b902147f0b2a27a7db710e1e1e5971d/example-feed.rss" rel="self" type="application/rss+xml" />
<atom:link href="https://pubsubhubbub.appspot.com/" rel="hub" />
<link>http://www.npr.org/templates/topics/topic.php?topicId=1001</link>
<description><![CDATA[The latest news in five minutes. Updated hourly.]]></description>
<copyright>Copyright 2007-2019 NPR - For Personal Use Only</copyright>
<generator>NPR API RSS Generator 0.94</generator>
@bwestergard
bwestergard / machine.js
Created March 24, 2021 20:11
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@bwestergard
bwestergard / machine.js
Last active March 24, 2021 19:48
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@bwestergard
bwestergard / expand.ts
Created November 4, 2020 23:18
Expanding Record
const foo = {foo: 1}
const bar = {bar: 2}
const baz = {...foo, ...bar}
const merge = <X,Y>(a:X, b:Y): X&Y => ({...a, ...b})
class ExpandingRecord<A> {
record: A;
constructor(record: A) {
@bwestergard
bwestergard / json_populate_recordset.md
Created February 29, 2016 22:23
json_populate_recordset example
lanetix=# \d foo
           Table "scripting.foo"
 Column |         Type          | Modifiers 
--------+-----------------------+-----------
 id     | integer               | not null
 a      | character varying(40) | not null
 b      | character varying(40) | not null
 c      | character varying(40) | not null
@bwestergard
bwestergard / rotation.sc
Created August 27, 2019 18:09
Supercollider: Scale Rotations (Modes)
~scaleA = [0,2,4,5,7,9,11];
~scaleB = ~scaleA.rotate(3);
(
a = Pbind(*[
scale: Pn( Pstep([
~scaleA,
~scaleA.rotate(1),
~scaleA.rotate(2),
~scaleA.rotate(2),
MD5 (prediction.txt) = d37a6e0de93c9c909cacd5c3fe152aa2