Skip to content

Instantly share code, notes, and snippets.

View marsimaria's full-sized avatar

Maria Fang marsimaria

View GitHub Profile
@marsimaria
marsimaria / sunflower.py
Last active August 29, 2015 14:17
Sunflower Movement Declaration Extract
# Google transalte library
import goslate
gs = goslate.Goslate()
# Import sunflower.txt
with open('sunflower.txt', 'r') as f:
text = f.read()
# print text
# Make new list "l"
@marsimaria
marsimaria / network.R
Created April 1, 2015 13:55
Network Analysis
library(igraph)
library(plyr)
# load files into tables
orb.edge <- read.csv("/Users/mariafang/Desktop/NYU/2_AncientData/Week9 Network/orbis_edges_0514.csv")
orb.node <- read.csv("/users/mariafang/Desktop/NYU/2_AncientData/Week9 Network/orbis_nodes_0514.csv")
# merge tables in two
orb.tb1 <- merge(orb.edge, orb.node, by.x="source", by.y="id")
orb.tb2 <- merge(orb.edge, orb.node, by.x="target", by.y="id")
@marsimaria
marsimaria / spearsNYTimes.py
Last active August 29, 2015 14:18
Britney Spears feat. New York Times
import sys
import re
import json
import random
s = []
from nytimesarticle import articleAPI
for i in range(0, 100):
api = articleAPI('74548056debe1698254a3a07babc9f84:3:60371965')
@marsimaria
marsimaria / sunflowerM2.py
Last active August 29, 2015 14:18
Sunflower module 2 - Execute my midterm project in two lines of code
import goslate
def generate(text):
gs = goslate.Goslate()
with open(text, 'r') as f:
text = f.read()
l = []
for i in range(100):
@marsimaria
marsimaria / sunflowerM1.py
Created April 7, 2015 00:58
Sunflower Module 1 - A module with multiple functions
import goslate
def getText(text):
gs = goslate.Goslate()
with open('sunflower.txt', 'r') as f:
text = f.read()
l = []
l_array = []
@marsimaria
marsimaria / MDV10.R
Last active August 29, 2015 14:18
Mapping closest amphitheaters base on travel expense
#load libraries
library(igraph)
library(curl)
library(rgdal)
library(rgeos)
library(maptools)
library(ggplot2)
#load data sets
orbis_edges <-read.csv(curl("https://stacks.stanford.edu/file/druid:mn425tz9757/orbis_edges_0514.csv"),head=TRUE)
@marsimaria
marsimaria / sogdians.geojson
Last active August 29, 2015 14:19
Locations for Sogdian Map
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marsimaria
marsimaria / tombowners.json
Last active August 29, 2015 14:19
Sogdian Tomb Owners
[
{
"tombowner": "Kang Ye",
"period": "Northern Zhou",
"death_site": "",
"burial_site": "Xi'an",
"lived_site": "Ganzhou",
"origin": "Samarkand"
},
{