Skip to content

Instantly share code, notes, and snippets.

Allison Parrish aparrish

Block or report user

Report or block aparrish

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active Dec 13, 2019
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View understanding-word-vectors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / predictive-models.ipynb
Created Jul 9, 2018
Predictive text and text generation notebook. Written for Code Societies at SFPC, summer 2018. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View predictive-models.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / from-plain-text.ipynb
Created Jul 18, 2018
Semantic similarity chatbots from plain-text files. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View from-plain-text.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / predictive-text-concatenated-word-vectors.ipynb
Created Jul 18, 2018
Predictive text with concatenated word vectors. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View predictive-text-concatenated-word-vectors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / moby-dick-minimalist-synonym.txt
Created Nov 18, 2019
Moby Dick with every word replaced at random by another word that occurred in the same 1-word context window
View moby-dick-minimalist-synonym.txt
This file has been truncated, but you can view the full file.
MOBY DICK;
OR THE WHALE
by Herman Melville
@aparrish
aparrish / spacy_intro.ipynb
Last active Nov 4, 2019
NLP Concepts with spaCy. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View spacy_intro.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / csv-intro.ipynb
Last active Oct 25, 2019
Quick intro to CSVs. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View csv-intro.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / enough-python.ipynb
Last active Oct 24, 2019
Just enough Python!
View enough-python.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / index.md
Last active Oct 17, 2019
Getting credentials for the Mastodon API with Mastodon.py. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View index.md

Getting credentials for the Mastodon API with Mastodon.py, step by step

Making a bot? Making a bot in Python? Making a bot in Python that uses the Mastodon API? If so, chances are you need to get some credentials. Here's how I did it!

(The following tutorial uses Python 2.7, but if you're using Python 3+ everything should work substantially the same.)

Mastodon.py authentication

I just started using it, but it looks like Mastodon.py is a pretty great library for working with the Mastodon API! However, all of the authentication examples use static files to store credentials, which I don't like—I'm afraid I'll accidentally push them to Github. I like to keep my authentication as close to the actual command that runs the program as possible, so usually I pass them on the command line to the script running my bot. To do this, I need to get the appropriate credentials on their own, as separate strings that I can cut and paste.

@aparrish
aparrish / inform7_assertions.txt
Created Jul 9, 2014
"Inform 7 Assertions," a series of prose poems generated from "Writing with Inform" (http://inform7.com/learn/man/WritingWithInform.txt). I found every indented code snippet in the book that contained the phrase "is a(n)" and sorted them in alphabetical order.
View inform7_assertions.txt
A Bee Chamber is a kind of room. The printed name of a Bee
Chamber is usually "Hexagonal Room". The description of a
Bee Chamber is usually "Waxy, translucent walls surround
you on six sides; the floor and ceiling are made of the
same material, gently uneven. There are exits in every
direction, cut into the faces or the corners."
A Bengal tiger is a kind of animal.
A DVD is a kind of artwork.
You can’t perform that action at this time.