Skip to content

Instantly share code, notes, and snippets.

View aparrish's full-sized avatar

Allison Parrish aparrish

View GitHub Profile
@aparrish
aparrish / genetic_deck.txt
Created October 25, 2016 19:29
an example of a rewordable deck produced by genetic algorithm
a p om dis ity r ifi
b r sc cat ers exp ine
c s ing tio rep ly nc
d t ans p ul fu n
e u w sio ons ce ty
f v nte pe ass era for
g w ous k ch v nta
h x sh tal rea et ib
i y sa ion men res con
j z ic tat g act an
@aparrish
aparrish / rewordable_sim_output.txt
Created October 25, 2016 19:51
sample output from rewordable simulation/deck evaluation program
Card usage:
e 148
r 129
t 119
a 118
o 107
i 87
n 80
p 78
l 69
@aparrish
aparrish / corporapaths.json
Created November 1, 2016 20:15
Helpful JSONPath paths for getting lists of strings from Corpora Project data files with unusual structures. More info about JSONPath: http://goessner.net/articles/JsonPath/
{
"description": "Helpful JSONPath paths for getting lists of strings from Corpora Project data files with unusual structures",
"paths": [
{
"name": "animals.birds_antarctica.families",
"desc": "Families of Antarctic birds",
"src": "animals/birds_antarctica.json",
"query": "$.birds[*].family"
},
{
@aparrish
aparrish / corporapaths.json
Created November 1, 2016 20:15
Helpful JSONPath paths for getting lists of strings from Corpora Project data files with unusual structures. More info about JSONPath: http://goessner.net/articles/JsonPath/
{
"description": "Helpful JSONPath paths for getting lists of strings from Corpora Project data files with unusual structures",
"paths": [
{
"name": "animals.birds_antarctica.families",
"desc": "Families of Antarctic birds",
"src": "animals/birds_antarctica.json",
"query": "$.birds[*].family"
},
{
@aparrish
aparrish / bot_basics_in_node.ipynb
Created February 1, 2017 02:50
Bot Basics in Node
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / twitter-search-api.ipynb
Created February 15, 2017 04:04
A quick overview of the Twitter Search API.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / simple-express.js
Created February 21, 2017 22:39
Simplest possible Express application
// simplest possible express app
var http = require('http');
var express = require('express');
var app = express();
// while your program is running, requests to "/test" will trigger this
// callback function.
app.get("/test", function(req, res) {
// the "req" parameter is an object that gives you access to data in the
@aparrish
aparrish / index.md
Last active May 6, 2023 14:29
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/

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 / spacy_intro.ipynb
Last active August 9, 2023 01:41
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/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / word_counts_with_counter.ipynb
Last active October 23, 2020 10:33
Quick word counts with Counter. 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/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.