Skip to content

Instantly share code, notes, and snippets.

View ryan-mooore's full-sized avatar
🤓
coding

Ryan Moore ryan-mooore

🤓
coding
View GitHub Profile
@ryan-mooore
ryan-mooore / notion-playlist.py
Created May 12, 2022 09:38
Program that converts a notion database to spotify playlist
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials, SpotifyOAuth
from os import environ
from pprint import pprint
from notion_client import Client
notion = Client(auth=environ["NOTION_TOKEN"])
spotify = spotipy.Spotify(
client_credentials_manager=SpotifyClientCredentials(),
auth_manager=SpotifyOAuth(
@ryan-mooore
ryan-mooore / .skhdrc
Last active May 2, 2024 14:16 — forked from pkazmier/.skhdrc
# Updated from https://gist.github.com/pkazmier to support yabai
#
# The following configuration heavily leverages modal keymaps to minimize the
# pollution of global keybindings. In addition, the modal keymaps facilitate
# the consistent use of the same keybindings across different modes. For
# example, this configuration uses 'h', 'l', 'j', and 'k' to represent west,
# east, south, and north when: changing focus, warping windows, resizing
# windows, swapping windows, and moving floating windows. Those four keys are
# mapped differently depending on the current mode to provide a consistent user
# experience.
@ryan-mooore
ryan-mooore / table_to_dict.py
Created August 20, 2021 07:20
Dictionary comprehension to convert an HTML <table> element to a python dictionary using BeautifulSoup
from bs4 import BeautifulSoup
soup = BeautifulSoup("https://github.com")
table = soup.table
result_dict = {
header.text: {
row.find_all("td")[0].text: row.find_all("td")[index].text
for row in table.tbody.find_all("tr")
}
@ryan-mooore
ryan-mooore / earthview.sh
Created August 2, 2021 12:58
One-liner to download and use a random Google Earth View (earthview.withgoogle.com) satellite image as your macOS wallpaper. Must have jq installed.
#!/bin/bash
rint=$(($RANDOM % 2608)) && curl -s "https://www.gstatic.com/prettyearth/assets/full/"$(curl -s https://earthview.withgoogle.com/_api/photos.json | jq --arg i $rint '.[$i | tonumber].slug' | sed 's/[^0-9]*//g')".jpg" -o earthview.jpg --output-dir $TMPDIR && osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \""$TMPDIR"earthview.jpg\"" && killall Dock
import math
p = []
s_num = 0
not_visited = []
class Star:
def __init__(self, pos):
self.x, self.y = pos[0], pos[1]
self.neighbors = []
from collections import namedtuple
from math import floor
Coords = namedtuple("Coords", "x y")
Mirror = namedtuple("Mirror", "coords direction")
lightx, lighty, intensity, plantmax = [int(num) for num in input().split(" ")]
plant = range(plantmax + 1)
light = Coords(lightx, lighty)
mirrors = []
function You(param) {
if (param == 1) {
height = 30.48*document.running.heightf.value + 2.54*document.running.heighti.value
document.running.heightm.value = height
shoulder = 2.54*document.running.shoulderi.value
document.running.shoulderm.value = shoulder
chest = 2.54*document.running.chesti.value
document.running.chestm.value = chest
}
if (param == 2) {