Skip to content

Instantly share code, notes, and snippets.

View rudiejd's full-sized avatar
☢️
ZQ

JD rudiejd

☢️
ZQ
  • cookin
  • Boston, MA
View GitHub Profile
@rudiejd
rudiejd / build.ps1
Last active April 23, 2020 05:38
Build script for CSE 201 PlantPro project
# TODO: Edit user's Homestead.yaml file for them,
# start vagrant box and ssh into it to set things up.
# To install all required components: just download and run this powershell script from anywhere on your computer.
function isInstalled {
param (
[string]$name
)
$32BitPrograms = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*
$64BitPrograms = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*
@rudiejd
rudiejd / init.sh
Last active May 7, 2020 14:08
Build script for CSE201 project, but in bash
apt-get update -y && sudo apt-get upgrade -y;
apt-get install curl -y;
apt-get install git -y;
apt install software-properties-common -y;
add-apt-repository ppa:ondrej/ph -y;
apt install php7.4 php7.4-gd php7.4-mbstring php7.4-xml -y;
apt install apache2 libapache2-mod-php7.4 -y;
apt install mysql-server php7.4-mysql -y;
curl -sS https://getcomposer.org/installer | php;
mv composer.phar /usr/local/bin/composer;
@rudiejd
rudiejd / get_random_rec.py
Last active July 20, 2020 03:03
get_random_rec method
import spotipy
from spotipy.ouath2 import SpotifyClientCredentials
from random import randrange
spotify = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials(client_id='MY_CLIENT_ID', client_secret='MY_CLIENT_SECRET'))
MAX_TRACKS = 10
def get_random_rec(query):
artist = spotify.search(query, limit=1, offset=0, type="artist", market=None)
if len(artist["artists"]["items"]) == 0:
return None
artist_name = artist["artists"]["items"][0]["name"]
def make_graph(query, depth, children):
return _make_graph(query, depth, children, dict())
def _make_graph(query, depth, children, d):
for i in range(children):
rand_artist = get_random_rec(query)
if rand_artist == None:
break
if depth == 0:
d[query] = {rand_artist};
from rec import make_graph
import networkx as nx
from matplotlib import pyplot as plt
graph_dict = make_graph('fiona apple', 3, 3)
walk_graph = nx.DiGraph(graph_dict)
nx.draw_planar(walk_graph, with_labels=True)
plt.title('Random Walk through Spotify')
plt.draw()