Skip to content

Instantly share code, notes, and snippets.

@guillermo-carrasco
Last active July 8, 2020 06:58
Show Gist options
  • Save guillermo-carrasco/f95cf9148e5673b6bfa2c9fbe997309a to your computer and use it in GitHub Desktop.
Save guillermo-carrasco/f95cf9148e5673b6bfa2c9fbe997309a to your computer and use it in GitHub Desktop.
Select a random Machine Learning card
import glob
import os
import random
if not os.path.exists('selected.txt'):
open('selected.txt', 'a').close()
with open('selected.txt', 'r') as f:
selected = f.read().splitlines()
cards = glob.glob('*.png')
n_cards = len(cards)
while True:
card_index = random.randint(0, n_cards)
card = cards[card_index]
if not card in selected:
with open('selected.txt', 'a') as f:
f.writelines(card.strip() + '\n')
print(card)
break
@guillermo-carrasco
Copy link
Author

I bought a set of Machine Learning Flash Cards from Chris Albon. A very much worth piece of art and knowledge!

This very simple script will print out the name of a random card every time you run it for you to study.

How

  1. Buy the cards, support Chris
  2. Unzip the cards and go to the png_web directory
  3. Copy this script there
  4. python select_random_card.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment