+/config
my dotfiles and nix configuration
git clone https://git.julia.blue/+/config
cb20c48
main
1#!/usr/bin/env bash 2 3shopt -s lastpipe 4 5user=$1 6title=$2 7homepage=${3-https://gist.github.com/$1} 8 9feed=$(cat <<EOF 10<?xml version="1.0" encoding="utf-8"?> 11<rss version="2.0"> 12 <channel> 13 <title>$title</title> 14 <link>$homepage</link> 15 <description></description> 16 <generator>julia's silly script</generator> 17EOF 18) 19 20function escape { 21 sd \& "&"| 22 sd \" """ | 23 sd \' "'" | 24 sd \< "<" | 25 sd \> ">" 26} 27 28gh api --paginate users/$user/gists | jq '.[] | [.created_at, .html_url, .description, (.files | keys | first)]' -c | while read line; do 29 # ew... but how would i do this better? 30 date="$(jq -r '.[0]'<<<"$line")" 31 link="$(jq -r '.[1]'<<<"$line")" 32 desc="$(jq -r '.[2]'<<<"$line" | escape)" 33 file="$(jq -r '.[3]'<<<"$line" | escape)" 34 title="${desc:-"$file"}" 35 feed+="<item> 36 <title>$title</title> 37 <link>$link</link> 38 <guid isPermaLink=\"false\">$link</guid> 39 <pubDate>$(date -d "$date" -R)</pubDate> 40 </item>" 41done 42 43feed+=" 44 </channel> 45</rss>" 46 47echo "$feed"