Skip to content

Instantly share code, notes, and snippets.

View dmasad's full-sized avatar

David Masad dmasad

View GitHub Profile
@dmasad
dmasad / Grey's Anatomy ERGM with Python.ipynb
Created June 29, 2015 14:08
Replicating the Grey's Anatomy Hookup ERGM with PyMC
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmasad
dmasad / DeviantArt.py
Created February 3, 2011 04:09
DeviantArt Scraper v0.1
# DeviantArt Friend Scraper
# Uses BeautifulSoup to scrape Friends pages recursively and writes edges to a CSV file.
from urllib2 import urlopen, URLError
from BeautifulSoup import BeautifulSoup
import csv
def get_friends(username):
#Return a list of the named user's friends.
friends_list = [] #The list of the friends.
@dmasad
dmasad / Mesa data collection profiling.ipynb
Created August 4, 2018 14:36
Mesa data collection profiling
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmasad
dmasad / spatial_sir_model.py
Created November 4, 2021 16:05
Mesa spatial SIR model with visualization server
from mesa import Agent, Model
from mesa.time import RandomActivation
from mesa.space import MultiGrid
from mesa.datacollection import DataCollector
from mesa.visualization.ModularVisualization import ModularServer
from mesa.visualization.modules import CanvasGrid, ChartModule
from mesa.visualization.UserParam import UserSettableParameter
# Model
@dmasad
dmasad / ERGM_from_scratch
Last active August 10, 2021 17:47
Implementing an ERGM from scratch
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@dmasad
dmasad / Face Generation.ipynb
Created March 5, 2017 18:53
Face generation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmasad
dmasad / Intro_to_ICEWS.ipynb
Last active February 4, 2017 18:12
Intro to ICEWS in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmasad
dmasad / ZI_Jungle.ipynb
Created January 22, 2014 01:16
Code for Zero Intelligence Traders in the Jungle. http://davidmasad.com/blog/zi-traders-in-the-jungle/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmasad
dmasad / Aleppo_points.R
Created August 12, 2013 17:20
GDELT geocoded points for violent events in Aleppo, 2011-2013.
library(ggmap)
# Load data:
Aleppo_points <- read.delim("Aleppo_points.csv")
Aleppo_points$LogCount = log(Aleppo_points$Count)
# Load map:
aleppo.map <- get_map(location="aleppo", zoom=12, source="google", maptype="terrain", color="bw")
aleppo.map <- ggmap(aleppo.map)
@dmasad
dmasad / TFC_Initial_Analysis.ipynb
Created March 19, 2015 14:55
#TFC15 Analytics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.