Skip to content

Instantly share code, notes, and snippets.

View dmasad's full-sized avatar

David Masad dmasad

View GitHub Profile
@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 / 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 / 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 / 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 / GarbageCan.py
Last active August 29, 2015 13:55
Work-in-progress to replicate the 1972 Garbage Can Model of Organizational Choice.
'''
GARBAGE CAN MODEL OF ORGANIZATIONAL CHOICE
Replicating Cohen et al., 1972
Note: Choices are actually *opportunities* for decisions.
'''
import numpy as np
@dmasad
dmasad / Aldich_Zimmer.ipynb
Created March 24, 2014 19:42
Simple model of network entrepreneurship based on Aldrich and Zimmer, 1986.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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.
@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 / 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 / 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.