Skip to content

Instantly share code, notes, and snippets.

@samiles
samiles / podcast.py
Last active November 22, 2023 15:49
Make a custom podcast stored in S3 from YouTube audio
"""
This script downloads the audio and thumbnail of a YouTube video, uploads them to Amazon S3, and updates a podcast RSS feed.
The script uses yt-dlp, boto3, feedgen, and other libraries for various tasks.
Args:
video_url (str): URL of the YouTube video to process.
Prints:
Video title
Thumbnail download status
@samiles
samiles / time_dilation.py
Last active February 26, 2023 23:41
Calculate Time Dilation on a Space Trip Using Python
"""
This script calculates the time dilation experienced during a space journey given the
velocity, acceleration, and duration of the journey.
The script uses the astropy package to handle units and time calculations.
Args:
velocity (float): Velocity of the spaceship as a fraction of the speed of light.
acceleration (float): Acceleration of the spaceship in units of g0.
duration (float): Duration of the journey in years (from the perspective of a clock on earth).