Skip to content

Instantly share code, notes, and snippets.

nasser eledroos

View GitHub Profile
@eledroos
eledroos / police.js
Created Oct 3, 2017
Test Visualization
View police.js
// set the dimensions and margins of the graph
var margin = {top: 20, right: 20, bottom: 30, left: 50},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
// parse the date / time
var parseTime = d3.timeParse("%d-%b-%y");
// set the ranges
var x = d3.scaleTime().range([0, width]);
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@eledroos
eledroos / civicInfoScript.py
Created Jul 10, 2017
A script to take a list of addresses from NationBuilder and find their State Senator and Representative using the Google Civic API.
View civicInfoScript.py
import pandas as pd
import json, requests, logging, pprint
# Setup logging
lfh = logging.FileHandler('civicInfoScript.log')
lfh.setFormatter(logging.Formatter('%(levelname)s %(asctime)s %(message)s'))
log = logging.getLogger('civicInfoScript')
log.setLevel(logging.INFO)
log.addHandler(lfh)
@eledroos
eledroos / TrumpTweetAnalysis.py
Created May 11, 2017
Using TextBlob, return, clean and analyze @RealDonaldTrump's tweets from a particular date range. Needs config.py.
View TrumpTweetAnalysis.py
import re
import tweepy
import config
import sys
import datetime
import csv
from tweepy import OAuthHandler
from textblob import TextBlob
class TwitterClient(object):
@eledroos
eledroos / PDFtoText.py
Last active May 11, 2017
I had a folder hundreds of emails in the form of PDFs, and I needed to be able to parse them. So, the goal in this gist is to convert all of the PDFs into text files which I could then parse using Regex into a CSV file.
View PDFtoText.py
from cStringIO import StringIO
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
import os
import sys, getopt
def convert(fname, pages=None):
if not pages:
You can’t perform that action at this time.