all repos — site @ 406013c1eb247597f0d4911b7be3b1d9572f416d

source for my site, found at icyphox.sh

Openring!

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Tue, 26 May 2020 18:18:08 +0530
commit

406013c1eb247597f0d4911b7be3b1d9572f416d

parent

cbda424ba50e983141a5aedca8981be3e6d60684

A bin/openring.py

@@ -0,0 +1,53 @@

+#!/usr/bin/env python3 +# openring.py - generate a webring from rss feeds + +import feedparser +import arrow +import jinja2 +import random +import sys +from lxml import html +from jinja2 import DebugUndefined + +def jinja_render(html, tmpl): + template_loader = jinja2.FileSystemLoader("./") + env = jinja2.Environment(loader=template_loader, undefined=DebugUndefined) + try: + template = env.get_template(tmpl) + except jinja2.exceptions.TemplateNotFound: + print("error: template not found") + + out = template.render(feeds=html) + return out + + +with open("feeds.txt") as f: + feeds = f.readlines() + +html_out = [] + +for f in random.sample(feeds, 3): + fp = feedparser.parse(f) + feed_link = fp.feed.link + feed_title = fp.feed.title + print(feed_title) + full_summ = str(html.fromstring(fp.entries[0].summary).text_content()) + trunc_summ = full_summ[:256] + "…" + pub_date = fp.entries[0].published + pretty_date = arrow.get(pub_date, "ddd, DD MMM YYYY HH:mm:ss Z").format("MMM DD, YYYY") + post_link = fp.entries[0].link + post_title = fp.entries[0].title + + html_out.append(f"""<div class="openring-feed"> + <h4><a href="{post_link}">{post_title}</a></h4> + <p>{trunc_summ}</p> + + <p>via <a href="{feed_link}">{feed_title}</a></p> + {pretty_date} + </div> + """ + ) + +rendered = jinja_render(html_out, "templates/openring.html") +with open("templates/text.html", "w") as t: + t.write(rendered)
M config.pyconfig.py

@@ -54,4 +54,5 @@ </a>

</div> """ template = 'text.html' # default is index.html -post_build = ['./bin/rss.py', './bin/plaintext.sh', './bin/update_index.py'] +pre_build = ['./bin/openring.py'] +post_build = ['./bin/rss.py', './bin/update_index.py']
A feeds.txt

@@ -0,0 +1,7 @@

+https://peppe.rs/index.xml +https://drewdevault.com/feed.xml +https://bellingcat.com/feed/ +https://k1ss.org/blog/blog.xml +https://jcs.org/rss +https://blog.lukaszolejnik.com/rss/ +https://gru.gq/feed/
M pages/blog/feed.xmlpages/blog/feed.xml

@@ -1,13 +1,13 @@

<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"> <channel> <title>icyphox's blog</title> - <link>https://icyphox.sh/blog/</link> + <link>https://icyphox.sh/</link> <description>Computers, security and computer security.</description> <atom:link href="https://icyphox.sh/blog/feed.xml" rel="self" type="application/xml"/> <image> <title>icyphox logo</title> <url>https://icyphox.sh/icyphox.png</url> - <link>https://icyphox.sh/blog/</link> + <link>https://icyphox.sh/</link> </image> <language>en-us</language> <copyright>Creative Commons BY-NC-SA 4.0</copyright>
M static/style.cssstatic/style.css

@@ -242,7 +242,7 @@ color: var(--dark);

padding-bottom: 30px; } -h1, h2, h3 { +h1, h2, h3, h4 { font-weight: normal; }

@@ -265,7 +265,6 @@ font-style: italic;

margin: .8rem 0; padding: .5rem 1rem } - hr { width: 20%; }

@@ -290,3 +289,16 @@ max-width: 100%;

padding-bottom: 5px; cursor: pointer; } + +.openring { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + min-width: 0; + margin-bottom: 20px; +} + +.openring-feed { + grid-row: 1; + font-size: 16px; + padding: 4px 8px 4px; +}
M templates/feed.xmltemplates/feed.xml

@@ -2,13 +2,13 @@ <?xml version='1.0' encoding='UTF-8'?>

<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"> <channel> <title>icyphox's blog</title> - <link>https://icyphox.sh/blog/</link> + <link>https://icyphox.sh/</link> <description>Computers, security and computer security.</description> <atom:link href="https://icyphox.sh/blog/feed.xml" rel="self" type="application/xml"/> <image> <title>icyphox logo</title> <url>https://icyphox.sh/icyphox.png</url> - <link>https://icyphox.sh/blog/</link> + <link>https://icyphox.sh/</link> </image> <language>en-us</language> <copyright>Creative Commons BY-NC-SA 4.0</copyright>
A templates/openring.html

@@ -0,0 +1,60 @@

+<!DOCTYPE html> +<html lang=en> + <link rel="stylesheet" href="/static/style.css" type="text/css"> + <link rel="stylesheet" href="/static/syntax.css" type="text/css"> + <link rel="shortcut icon" type="images/x-icon" href="/static/favicon.ico"> + <meta charset="UTF-8"> + <meta name="description" content="{{ subtitle }}"> + <meta name="viewport" content="initial-scale=1"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <meta content="#151B1B" name="theme-color"> + <meta name="HandheldFriendly" content="true"> + <meta name="twitter:card" content="summary_large_image"> + <meta name="twitter:site" content="@icyphox"> + <meta name="twitter:title" content="{{ title }}"> + <meta name="twitter:description" content="{{ subtitle }}"> + <meta name="twitter:image" content="/static/icyphox.png"> + <meta property="og:title" content="{{ title }}"> + <meta property="og:type" content="website"> + <meta property="og:description" content="{{ subtitle }}"> + <meta property="og:url" content="https://icyphox.sh"> + <meta property="og:image" content="/static/icyphox.png"> + <title> + {{ title }} + </title> + <body> + <div class="container"> + <div class="pull-left"> + <div class="content"> + <header> + {{ header }} + </header> + <div style="float: right"> + view in <a href="/blog/{{ url }}.txt">plain-text</a> + </div> + <div style="float: left"> + {{ date }} + </div> + <div style="clear: both" align="left"> + <h1>{{ title }}</h1> + <h2 class="subtitle">{{ subtitle }}</h2> + {{ body }} + </div> + <p class="muted">Questions or comments? + Send an email to + <a href="mailto:~icyphox/x@lists.sr.ht?Subject=Re: {{ title }}">~icyphox/x@lists.sr.ht</a>—my <a href="https://lists.sr.ht/~icyphox/x">public inbox</a>.</p> + + <hr> + <div class="openring"> + {% for f in feeds %} + {{ f }} + {% endfor %} + </div> + </div> + </div> + <div class="pull-right"> + {{ footer }} + </div> + </div> + </body> +</html>
M templates/text.htmltemplates/text.html

@@ -43,6 +43,45 @@ </div>

<p class="muted">Questions or comments? Send an email to <a href="mailto:~icyphox/x@lists.sr.ht?Subject=Re: {{ title }}">~icyphox/x@lists.sr.ht</a>—my <a href="https://lists.sr.ht/~icyphox/x">public inbox</a>.</p> + + <hr> + <div class="openring"> + + <div class="openring-feed"> + <h4><a href="https://jcs.org/2020/05/15/surface_go2">OpenBSD on the Microsoft Surface Go 2 (notaweblog)</a></h4> + <p>I used OpenBSD on the +original Surface Go +back in 2018 and many things worked with the big exception of the internal +Atheros WiFi. +This meant I had to keep it tethered to a USB-C dock for Ethernet or use +a small USB-A WiFi dongle plugged into a less-than-…</p> + + <p>via <a href="https://jcs.org/">joshua stein</a></p> + May 15, 2020 + </div> + + + <div class="openring-feed"> + <h4><a href="https://www.bellingcat.com/resources/2020/05/25/investigate-tiktok-like-a-pro/">Investigate TikTok Like A Pro!</a></h4> + <p>TikTok videos have grown increasingly popular over the last few years, with short clips showing people dancing, lip syncing, doing viral challenges, and so on. This relatively new platform lets users share short video clips, and can be looped. It is simila…</p> + + <p>via <a href="https://www.bellingcat.com">bellingcat</a></p> + May 25, 2020 + </div> + + + <div class="openring-feed"> + <h4><a href="https://k1ss.org/blog/20200525a">25/05/2020: This month in KISS (#2)</a></h4> + <p>Welcome to the second monthly update for KISS. This post will be +quite a long one, we've seen some nice changes this month and some +great work by the Community.…</p> + + <p>via <a href="https://k1ss.org">KISS Linux Blog</a></p> + May 25, 2020 + </div> + + + </div> </div> </div> <div class="pull-right">

@@ -50,4 +89,4 @@ {{ footer }}

</div> </div> </body> -</html> +</html>