Skip to content

Instantly share code, notes, and snippets.

View linwoodc3's full-sized avatar

Linwood Creekmore linwoodc3

  • United States
View GitHub Profile
@linwoodc3
linwoodc3 / worldDataframes.py
Last active October 1, 2017 15:11
Python code to create geodataframe for countries, lakes, and oceans for geospatial analysis in Python. Use geopandas and Python 2 or download the
#Author: Linwood Creekmore
#Date: October 1, 2017
# Instructions:
"""
Download and use my shapefilereader function in Python 2 OR just download the linked zip to your computer and read using geopandas
gist to shapefilereader - > https://gist.github.com/linwoodc3/72b2f24b6d2ff6ffde1597f1ca2dea3f
"""
@linwoodc3
linwoodc3 / timenormalize.py
Last active October 18, 2017 11:29
Get a timezone string from a latitude and longitude pair for timezone normalization.
# Created by: Linwood Creekmore III
# valinvescap@gmail.com
from tzwhere import tzwhere
tz = tzwhere.tzwhere()
import numpy as np
def getT(x):
try:
latitude=x[1]
@linwoodc3
linwoodc3 / index.html
Created April 22, 2018 03:00
Simple front end for machine learning web application demo
<!DOCTYPE html>
<html>
<title>QB-Spective</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body { font-family: sans-serif; }
@linwoodc3
linwoodc3 / style.css
Created April 22, 2018 03:01
A simple css file for the QB web app.
body {
background-color: #E5E5FF;
}
img.resize {
max-width:70%;
max-height:70%;
}
#the-string {
display: none;
}
@linwoodc3
linwoodc3 / index.html
Last active June 5, 2018 12:15
sample html for sage.
<!DOCTYPE html>
<html>
<title>QB-Spective</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body { font-family: sans-serif; }
THE SHAME OF SAN JOAQUIN
WGAw #1834463
FADE IN:
EXT. SUBDIVISION - MORNING
A peculiar wind blows snowflakes past a wall guarding the
entrance to a neighborhood that reads “SAN JOAQUIN ESTATES”.
In a black Mustang idling at the curb sits BOBBY GONZALEZ, a
directionless young man with a hard look and disheveled hair.
THE SHAME OF SAN JOAQUIN
WGAw #1834463
FADE IN:
EXT. SUBDIVISION - MORNING
A peculiar wind blows snowflakes past a wall guarding the
entrance to a neighborhood that reads “SAN JOAQUIN ESTATES”.
In a black Mustang idling at the curb sits BOBBY GONZALEZ, a
directionless young man with a hard look and disheveled hair.
@linwoodc3
linwoodc3 / polyglotOnMacOSXPython27.sh
Last active September 1, 2018 14:32
Bash script that successfully installs the polyglot multilingual text (NLP) processing toolkit on a MacOSX computer with Python 2.7 and Anaconda.
#!/bin/bash
# Author:
# Linwood Creekmore
# email: valinvescap@gmail.com
# navigate to home directory; just for clean start
cd ~ &&
# exit out of whatever conda environment you are in
@linwoodc3
linwoodc3 / gg.py
Created March 17, 2019 13:05
testing code editor
timeit -n 100 geohash.encode(36.056595, -112.125092)
[Out]: 992 ns ± 21.4 ns per loop (mean ± std. dev. of 7 runs, 100 loops each)
@linwoodc3
linwoodc3 / cleantweets.py
Last active January 19, 2021 22:58
Python script that uses the python Twitter client (https://github.com/sixohsix/twitter) to pull tweets that are geolocated. Optionally stores in efficient columnar parquet data store with configurable file sizes. Took 13 secs to download 100 geolocated tweets on MacOS 10.12 with 16 GB RAM on 82 Mb/s connection.
# Author
# Linwood Creekmore III
# April 8 2017
# heavy input from http://socialmedia-class.org/twittertutorial.html
# valinvescap@gmail.com
import re
import copy
import numpy as np
import pandas as pd