Skip to content

Instantly share code, notes, and snippets.

Matthew Wigginton Conway mattwigway

Block or report user

Report or block mattwigway

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View data
#!/bin/bash
# Load the file referenced in the first argument into a Jupyter QtConsole as df
# change to appropriate conda environment
source activate py37
tempscript=`mktemp`
tee "$tempscript" <<EOF
import pandas as pd
View OSMnx Test.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Explore Incorrect Number of HH Members on Trips.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View namedzip.py
# similar to Python's built in zip function, but yielding named tuples instead of tuples.
# i.e. list(namedzip(a=[1, 2], b=[3, 4])) => [namedzipitem(a=1, b=3), namedzipitem(a=2, b=4)]
# Author: Matthew Wigginton Conway <mwconway@asu.edu>
# feel free to use and share
from collections import namedtuple
def namedzip (**kwargs):
keys = list(kwargs.keys())
typ = namedtuple('namedzipitem', keys)
length = len(kwargs[keys[0]])
@mattwigway
mattwigway / boxplot.py
Last active Jan 4, 2018
Matplotlib boxplot with custom summary stats
View boxplot.py
# To the extent possible under law, Matthew Wigginton Conway has waived all copyright and
# related or neighboring rights to this work. This work is published from: United States.
def customBoxPlot (whiskerLo, boxLo, med, boxHi, whiskerHi, **kwargs):
fakeData = [np.array([42, 42]) for i in whiskerLo]
bp = plt.boxplot(fakeData, **kwargs)
for i in range(len(whiskerLo)):
# https://stackoverflow.com/questions/27214537
# This can't possibly be the best way to do this...
# lower whisker
@mattwigway
mattwigway / ocrpdf.sh
Last active Aug 21, 2017
Command-line tool to OCR PDFs
View ocrpdf.sh
#!/bin/bash
# OCR a PDF using Tesseract and Ghostscript
# (brew install tesseract, brew install ghostscript using Homebrew on a Mac)
# Usage: ocrpdf input.pdf output.pdf
# Copyright (c) 2017 Matthew Wigginton Conway
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
View StringNPE.java
import org.mapdb.*;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* Created by matthewc on 9/15/15.
@mattwigway
mattwigway / addNullValues.py
Created Sep 9, 2015
Replace bottom-coded values with null
View addNullValues.py
#!/usr/bin/python
# Remove all the -99999... values in the NL neighborhoods file and replace them with NULL
from sys import argv
import fiona
with fiona.open(argv[1]) as infile:
meta = infile.meta
meta['schema']['geometry'] = 'MultiPolygon'
View index.html
<!DOCTYPE html>
<html>
<head>
<title>MetricsGraphics Confidence Bound Test</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/metrics-graphics/2.2.1/metricsgraphics.css" />
</head>
<body>
<div id="chart"></div>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
You can’t perform that action at this time.