Skip to content

Instantly share code, notes, and snippets.

Avatar

Max Cohn maxcohn

View GitHub Profile
View project-euler-dl.py
# 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
@maxcohn
maxcohn / download-pkn.py
Created Mar 18, 2019
Downloads episodes of PKN from the PKA Podbean account. Update 'numOfEps' when new episodes come out
View download-pkn.py
# 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)
@maxcohn
maxcohn / cloudSettings
Last active Aug 25, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2020-08-25T20:10:56.456Z","extensionVersion":"v3.4.3"}
@maxcohn
maxcohn / total-audio-time.py
Created Feb 6, 2019
Calculates the total amount of time of MP3 files in the current directory. Uses Mutagen library
View total-audio-time.py
# 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 / download-internet-box.py
Last active Feb 6, 2019
Downloads all episodes of the Internet Box podcast straight from their website using Requests
View download-internet-box.py
# 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: