Skip to content

Instantly share code, notes, and snippets.

View mjdargen's full-sized avatar

Michael D'Argenio mjdargen

View GitHub Profile

Pull Google Sheet Data into Python

Shows how to use pull data from a Google Sheet into Python without the use of an API.

Publishing Google Sheet

  1. Go to "File -> Publish to the web"
  2. This will bring up the window shown below. Select the "Link" tab.
  3. Select the specific page that you want to publish.
  4. Then select to publish it as "Comma-separated values (.csv)"
  5. Once you are ready, click Publish. A pop-up will appear asking if you are sure. Click "OK".
import os
import re
import random
import requests
from nltk import word_tokenize
from nltk import pos_tag
from nltk.tokenize import SyllableTokenizer
from random_word import RandomWords
rw = RandomWords()
<!DOCTYPE html>
<html lang="en">
<head>
<title>Nate Example</title>
<meta charset="utf-8">
<style>
button>span {
display: none;
}
from random import choice
import os
with open("./bilingual/anagrams.txt", "r") as f:
words = f.read().splitlines()
word = choice(words)
while len(word) < 4 or len(word) > 6:
word = choice(words)
words.remove(word)
@mjdargen
mjdargen / webdev_zip_grader.py
Last active September 28, 2022 16:18
Unzips all zip Canvas submissions for webdev, reorganizes file structure, and validates all HTML & CSS files.
# 1. Download the submissions.zip file from Canvas.
# 2. Place it in an empty folder for the specific assignment. Make sure it is called submissions.zip.
# 3. Copy the webdev_zip_grader.py script into the folder.
# 4. Make sure the folder is empty except for webdev_zip_grader.py and submissions.zip because it will delete everything else.
# 5. Double-click the script to run.
# 6. Hit the enter key in the script window to advance it to the next page.
import os
import shutil
@mjdargen
mjdargen / zipit.py
Last active September 6, 2022 14:37
import os
import shutil
from zipfile import ZipFile
def main():
# remove everything
for root, subdirs, _files in os.walk(os.getcwd()):
for d in subdirs:
shutil.rmtree(os.path.join(os.getcwd(), d))
@mjdargen
mjdargen / install_ffmpeg.sh
Created May 10, 2022 15:53
Installs ffmpeg with libaom and libx265 enabled for av1 and hevc encoding
#!/usr/bin/env bash
# Copied from sparrc: https://gist.github.com/sparrc/026ed9958502072dda749ba4e5879ee3
# Installs ffmpeg from source (HEAD) with libaom and libx265, as well as a few
# other common libraries
# binary will be at ~/bin/ffmpeg
sudo apt update && sudo apt upgrade -y
@mjdargen
mjdargen / spotipy_starter.py
Last active April 21, 2022 15:14
spotipy starter
import os
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
from dotenv import load_dotenv
load_dotenv()
artist = 'Taylor Swift'
# load credentials
credentials = SpotifyClientCredentials(
@mjdargen
mjdargen / nc_ftc_scouting.py
Created February 7, 2022 15:35
collects scores across NC FTC tournaments
import os
import requests
import pandas as pd
from bs4 import BeautifulSoup as bs
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
# retrieve soup for a page
def retrieve_soup(url):
aa
aah
aahed
aahing
aahs
aal
aalii
aaliis
aals
aardvark