Skip to content

Instantly share code, notes, and snippets.

View carsonfarmer's full-sized avatar
🏖️
Remote working...

Carson Farmer carsonfarmer

🏖️
Remote working...
View GitHub Profile
@carsonfarmer
carsonfarmer / us-co2-codebook.txt
Last active September 3, 2015 22:05
Total CO2 emissions from fossil-fuels (1000 metric tons) for the United States
Total CO2 emissions from fossil-fuels (1000 metric tons) for the United States
Data source:
Source organization(s): CDIAC (Carbon Dioxide Information Analysis Center)
Link to source organization: http://cdiac.ornl.gov/
File name: nation.1751_2009.csv
Link to complete reference: http://cdiac.ornl.gov/ftp/ndp030/CSV-FILES/
Data attributes:
year:
@carsonfarmer
carsonfarmer / fuzzy.py
Created October 22, 2015 18:39
Problems with line merging geometries near the anti-meridian
from shapely import wkt
from shapely import ops
import matplotlib.pyplot as plt
%matplotlib inline
a = wkt.loads("LINESTRING (-180 68.96363636363637, -177.55 68.2, -174.92825 67.20589, -175.01425 66.58435, -174.33983 66.33556, -174.57182 67.06219, -171.85731 66.91307999999999, -169.89958 65.97723999999999, -170.89107 65.54139000000001, -172.53025 65.43791, -172.555 64.46079, -172.95533 64.25269, -173.89184 64.2826, -174.65392 64.63124999999999, -175.98353 64.92288000000001, -176.20716 65.35666999999999, -177.22266 65.52024, -178.35993 65.39052, -178.90332 65.74044000000001, -178.68611 66.11211, -179.88377 65.87456, -179.43268 65.40411, -180 64.97970870219837)")
b = wkt.loads("LINESTRING (180 64.97432999999999, 178.7072000000003 64.53493, 177.4112800000002 64.60821, 178.3130000000002 64.07593, 178.9082500000002 63.25197000000014, 179.37034 62.98262000000011, 179.48636 62.56894, 179.2282500000001 62.30410000000015, 177.3643 62.5219, 174.5692900000002 61.76915, 173.68013 61.65261, 172.15 60.95, 170.698500000000
@carsonfarmer
carsonfarmer / Iterative GeoJSON.ipynb
Created February 5, 2016 19:33
Some basic ideas for dealing with a 'stream' of GeoJSON features
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carsonfarmer
carsonfarmer / GSoc2016App.md
Created March 23, 2016 00:37 — forked from TaylorOshan/GSoc2016App.md
GSoC Proposal - Taylor Oshan- PySAL: Spatial Interaction Modeling

Python Software Foundation 2016 Google Summer of Code Application

Sub-organization Information

PySAL: Python Spatial Analysis Library

Student Information

  • Name: Taylor Oshan
@carsonfarmer
carsonfarmer / Random DEM.ipynb
Created November 7, 2016 17:01
Super basic random terrain function
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carsonfarmer
carsonfarmer / circularMean.swift
Last active October 18, 2017 00:10
Swift version of Averages/Mean time of day (https://rosettacode.org/wiki/Averages/Mean_time_of_day)
func circularMean() {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy/MM/dd HH:mm:ss zzz"
let times = [Date](arrayLiteral: formatter.date(from: "2017/10/17 23:00:17 UTC")!, formatter.date(from: "2017/10/17 23:40:20 UTC")!, formatter.date(from: "2017/10/17 00:12:45 UTC")!, formatter.date(from: "2017/10/17 00:17:19 UTC")!)
// 1 second of time = 360/(24 * 3600) = 1/240th degree
let angles = times.map { secondOfDay(fromDate: $0) / 240 }
print(degreeToTime(degree: meanAngle(angles: angles), forDate: Date())!)
}
func meanAngle(angles: [Double]) -> Double {
@carsonfarmer
carsonfarmer / IrisWithNeuralyzer.swift
Last active November 28, 2017 21:50
Swift code for Medium article on Neuralyzer
import Neuralyzer
struct IrisData: Codable {
let row: [Double]
}
var parsedData: [IrisData] = []
if let file = Bundle.main.path(forResource: "iris", ofType: "json") {
do {
let jsonDecoder = JSONDecoder()

Keybase proof

I hereby claim:

  • I am carsonfarmer on github.
  • I am carsonfarmer (https://keybase.io/carsonfarmer) on keybase.
  • I have a public key ASCn5qH7gBKTze_0Tu48Y-hfPRwRARddzi6M6HjMi2mTVQo

To claim this, I am signing this object:

@carsonfarmer
carsonfarmer / main.js
Last active June 21, 2018 20:05
Update to main.js IPFS Dapp example
const setup = async () => {
// The root IPFS CID for our xkcd archive
const xkcdRoot = '/ipfs/QmS74HhZt3ZekqUDqdttSgMsHwYQ6miDLwGUHy6pp4qLyD'
// Pick and random comic between 1 and 2003 (which is the latest in the archive)
const comicNumber = Math.floor(Math.random() * 2003) + 1
try {
// Create IPFS peer
const ipfs = await getIpfs()
// Connect to public peer pinning xkcd comics (might not be needed)
await ipfs.swarm.connect(
@carsonfarmer
carsonfarmer / index.html
Created June 14, 2018 06:37
index.html step 1
<!doctype html>
<html>
<head>
<meta charset="utf8">
<title>Encryptoid ĐApp</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div id="main">
<h1>Welcome to Encryptoid!</h1>