This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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\* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |