Skip to content

Instantly share code, notes, and snippets.

View askmeegs's full-sized avatar
💭
🦎

Megan O'Keefe askmeegs

💭
🦎
View GitHub Profile
import json, urllib, os, re
from collections import Counter,defaultdict
import matplotlib.pyplot as plt
import numpy
from pandas import *
import json
import networkx as nx
import text_utils as tu
filename = raw_input("Enter a file name, json: ")
{
"metadata": {
"name": "process_tweets"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": "Word-Bigram Freq and Co-Occurrence"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
function getPosts(){
query = "moonrise kingdom";
var tumblr = require('tumblr.js');
var client = tumblr.createClient({ consumer_key: '5AePbGS74iGUh2v1vIaLfxOeDAyS2X8sRPpnOPczwtFzGXEvz7' });
initialize data structure
client.tagged(query, function (err, data) {
//put 1000 image urls into a list
});
setInterval(function(){changeImage()},3000); //once posts are gotten, start changing background
}
@askmeegs
askmeegs / gist:8261189
Last active January 2, 2016 06:08
Flashcards excerpt
//Piece of Flashcards.java
//Final Project, CS 230 Fall '12
//Megan O'Keefe
//Last Modified: December 20th, 2012
/*Takes what has been entered in the userEntry JTextField and does a .equalsIgnoreCase()
with what is stored in the back of the current card. If it returns true, modifies the
correctLabel to "Correct!", otherwise modifies the correctLabel to "Incorrect."
Retabulates accuracy and modifies the percentAccuracy label accordingly.
/*nytbookfolio.js
by Megan O'Keefe
project: BOOKFOLIO
began 3/27/13, completed 4/8/13
Summary: nytscript handles the scripting for the main page of Bookfolio. This file
accomplishes three main tasks on loading the index.html page:
1) Grabs a local json file from the NYT Bestseller API and extracts title, author
and ISBN data from the results[] array (20 items) and places them in separate
title, author and isbn arrays.
@askmeegs
askmeegs / searchhandler.py
Created January 4, 2014 22:36
search handler for TVNewsPulse
class SearchHandler(webapp2.RequestHandler):
def post(self): #not the same post as jquery $.post
searchterm = self.request.get("searchterm")
modifiedToken = cleanToken(searchterm)
user = users.get_current_user()
s=""
results=""
if user:
#Burstiness.py
#by Megan O'Keefe
import json, os, bisect
from sets import Set
from datetime import datetime, timedelta
from collections import Counter,defaultdict
from numpy import *
from pandas import *
from pandas.tseries.offsets import Hour, Minute
@askmeegs
askmeegs / storymaker.py
Created August 25, 2015 18:42
storymaker demo
#storymaker.py
#by megan o'keefe
#created: July 31st, 2015
#last modified: 7/31/2015
#has WordsApi definitions, also working on: wikipedia articles.
import json
import unirest
import wikipedia
//KMeans_Clustering.java
//Megan O'Keefe
//Completed: 10/25/15
//CS313, Wellesley College (Assignment #5)
//USES EXISTING CLUSTERING CLASSES, NOT INCLUDED
/*
Overview of KMeans algorithm:
- randomly assign each Gene to a cluster (Math.random... for range = # desired clusters)
- Then until you have no shuffling changes in the iteration...