Skip to content

Instantly share code, notes, and snippets.

View JayCuthrell's full-sized avatar
☁️
GOTO 10

Jay Cuthrell JayCuthrell

☁️
GOTO 10
View GitHub Profile
@JayCuthrell
JayCuthrell / crontab.sh
Last active December 27, 2023 20:54
crontab for mastodon as of Dec 2023
SHELL=/bin/bash
05 */3 * * * RAILS_ENV=production /home/mastodon/.rbenv/shims/ruby /home/mastodon/live/bin/tootctl accounts prune
15 */3 * * * RAILS_ENV=production /home/mastodon/.rbenv/shims/ruby /home/mastodon/live/bin/tootctl statuses remove --days 1
25 */3 * * * RAILS_ENV=production /home/mastodon/.rbenv/shims/ruby /home/mastodon/live/bin/tootctl media remove --days 1
35 */3 * * * RAILS_ENV=production /home/mastodon/.rbenv/shims/ruby /home/mastodon/live/bin/tootctl media remove --remove-headers --include-follows --days 0
45 */3 * * * RAILS_ENV=production /home/mastodon/.rbenv/shims/ruby /home/mastodon/live/bin/tootctl preview_cards remove --days 1
55 */3 * * * RAILS_ENV=production /home/mastodon/.rbenv/shims/ruby /home/mastodon/live/bin/tootctl media remove-orphans
@JayCuthrell
JayCuthrell / tags.py
Created October 21, 2023 23:45
Create frontmatter tags from a blog post using rake-nltk and stopwords
import re
import sys
import rake_nltk
from rake_nltk import Metric, Rake
def get_text_from_markdown(file_path):
with open(file_path, 'r') as f:
text = f.read()
# Remove markdown tags
@JayCuthrell
JayCuthrell / rehydrateButtondownExport.py
Last active September 4, 2023 02:50
Buttondown offers export of all your emails as a CSV file 'emails.csv' and a folder 'emails' with all your emails. Since you can import to Buttondown, some of those emails might be HTML imports from other newsletter services.
import csv
import os
from markdownify import markdownify
# Define the variables for the columns of the CSV file
id = "id"
secondary_id = "secondary_id"
subject = "subject"
publish_date = "publish_date"
source = "source"
@JayCuthrell
JayCuthrell / revue_rss_to_substack_markdown.py
Last active June 21, 2022 14:28
Pull my old Revue RSS feed before/after migration to Substack and replace with the proper vanity domain until it's gone
#!/usr/bin/python3
import feedparser
import time
# before...
# feed = feedparser.parse('https://sunday.fudge.org/?format=rss')
# after...
feed = feedparser.parse('https://sunday.fudge.org/feed')
for pub_date in feed.entries:
link = pub_date.link
# just in case...
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
brew install wget
wget --mirror --page-requisites --adjust-extension --span-hosts --convert-links --domains sunday.fudge.org --no-parent --no-clobber https://jaycuthrell.com/newsletter/
@JayCuthrell
JayCuthrell / feedparser2markdown.py
Created September 12, 2020 21:13
Use python feedparser and time to parse an RSS feed and output a simple markdown unordered list of links
import feedparser
import time
# grab the feed
feed = feedparser.parse('https://fudge.org/rss.xml')
# for each entry print a markdown unordered list item of links using using title, link, and the parsed publishing time
for pub_date in feed.entries:
v4l2rtspserver-master -W640 -H360 -E MP3:16000:44100 -r 2 -F 25 -P 8554
avconv -rtsp_transport tcp -y -i rtsp://192.168.1.XXX:8554/unicast -c:v copy -profile:v high -coder 1 -pix_fmt yuv420p -g 30 -bf 2 -c:a copy -strict experimental -aspect 16:9 -f flv "rtmp://live-ams.twitch.tv/app/live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
#!/usr/bin/env python3
from __future__ import print_function
import sys
import twitter
from keys import ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET, CONSUMER_KEY, CONSUMER_SECRET
api = twitter.Api(
CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET
)
$ grep -v "^#" /etc/systemd/logind.conf
[Login]
HandleHibernateKey=suspend
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend
HandleLidSwitchDocked=suspend
LidSwitchIgnoreInhibited=yes
$ grep -v "^#" /etc/systemd/sleep.conf
[Sleep]