Skip to content

Instantly share code, notes, and snippets.

@maxcohn
maxcohn / download-internet-box.py
Last active February 6, 2019 05:42
Downloads all episodes of the Internet Box podcast straight from their website using Requests
# download internetbox episodes (2/6/2019)
#
# super quick script to download all episodes of the Internet Box podcast
import requests
# download function (this is a super useful function in general)
def download(url, file_name):
# open in binary mode
with open(file_name, "wb") as file:
@maxcohn
maxcohn / total-audio-time.py
Created February 6, 2019 05:32
Calculates the total amount of time of MP3 files in the current directory. Uses Mutagen library
# get total time of all mp3 files in the current directory (1/21/19)
import os
from mutagen.mp3 import MP3
total = 0
for file in os.listdir("."):
if not file.endswith(".mp3"): continue
audio = MP3(file)
total += audio.info.length
@maxcohn
maxcohn / cloudSettings
Last active August 25, 2020 20:10
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-08-25T20:10:56.456Z","extensionVersion":"v3.4.3"}
@maxcohn
maxcohn / download-pkn.py
Created March 18, 2019 00:55
Downloads episodes of PKN from the PKA Podbean account. Update 'numOfEps' when new episodes come out
# download all pkn episodes from podbean
from bs4 import BeautifulSoup
import requests
# download function (this is a super useful function in general)
def download(url, file_name):
# open in binary mode
with open(file_name, "wb") as file:
# get request
response = requests.get(url)
# Downloads all Project Euler problems and stores them in a file with their number
#
# These files can be changed to any language's file extension, and comment the text out
# to have a nicely formatted file
#
# Requirements: BeautifulSoup4 and requests
from bs4 import BeautifulSoup
import re
import requests