Skip to content

Instantly share code, notes, and snippets.

View jsfenfen's full-sized avatar

Jacob Fenton jsfenfen

View GitHub Profile
@jsfenfen
jsfenfen / export_rgb.js
Last active January 20, 2023 21:05
Export RGB image from google earth engine's landsat8 collection using GEE's script editor
var year_string = '2019'
// Bounding box for imagery. The smaller it is, the faster to process
var bounding_box = ee.Geometry.Rectangle([-16.6147, 15.8444, -16.4147, 16.2444]);
var use_landsat_7 = true;
// Landsat7 imagery comes with "striping" that's an artifact of a hardware failure
// Compositing helps a little, but is not a fix.
// More here: https://blog.mapbox.com/debanding-the-world-94439af16e7f
library(ggplot2)
library(dplyr)
# See https://healthdata.gov/dataset/covid-19-reported-patient-impact-and-hospital-capacity-state-timeseries
fileurl = "https://healthdata.gov/sites/default/files/reported_hospital_utilization_timeseries_20210227_1306.csv"
hospraw <- read.csv(url(fileurl), header=TRUE, sep=",")
# parse the dates
hospraw$dateob = as.Date(hospraw$date)
@jsfenfen
jsfenfen / ppb.kml
Created September 15, 2020 14:01
ppb
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2">
<NetworkLinkControl>
<minRefreshPeriod>30</minRefreshPeriod>
</NetworkLinkControl>
<Document>
<name>911 Incidents</name>
<open>1</open>
<description>Recent 911 dispatch incidents in Portland, Oregon </description>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
library("RPostgreSQL")
# connect to postgres
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname = "database_name",
host = "localhost", port = 5432,
user = "user_name")
# execute query
@jsfenfen
jsfenfen / axis_titles.html
Last active November 6, 2018 16:47
Adding some axis titles to layercakes histogram example
#### AxisXTitled.html
<g class='axis x-axis'>
{#each ticks as tick, i}
<g class='tick tick-{ tick }' transform='translate({$xScale(tick)},{$yScale.range()[0]})'>
{#if opts.gridlines !== false}
<line y1='{$height * -1}' y2='0' x1='0' x2='0'></line>
{/if}
<text y='16' text-anchor='{textAnchor(i)}'>{opts.formatTick ? opts.formatTick(tick) : tick}</text>
</g>

Keybase proof

I hereby claim:

  • I am jsfenfen on github.
  • I am jacobfenton (https://keybase.io/jacobfenton) on keybase.
  • I have a public key ASDZS1fJ_YxvKE7xmX-HbKYpKOM8fiADdK2GlQ1xgC0nygo

To claim this, I am signing this object:

@jsfenfen
jsfenfen / gist:eceeb74a10a91e963f51615fdc7e542e
Created April 6, 2018 22:16
201700969349301030_public.xml
<?xml version="1.0" encoding="utf-8"?>
<Return xmlns="http://www.irs.gov/efile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.irs.gov/efile" returnVersion="2015v3.0">
<ReturnHeader binaryAttachmentCnt="0">
<ReturnTs>2017-04-06T17:02:24-05:00</ReturnTs>
<TaxPeriodEndDt>2016-06-30</TaxPeriodEndDt>
<PreparerFirmGrp>
<PreparerFirmEIN>930743240</PreparerFirmEIN>
<PreparerFirmName>
<BusinessNameLine1Txt>Hoffman Stewart &amp; Schmidt PC</BusinessNameLine1Txt>
</PreparerFirmName>
@jsfenfen
jsfenfen / read_procurements.py
Created March 13, 2017 17:00
Read Roseburg, OR's pdf "check report"
import csv
import re
""" Roseburg_Procurement.txt created with "$ pdftotext -layout Roseburg_Procurment.pdf """
infile = open("Roseburg_Procurement.txt","r")
outfile = open("Roseburg_Procurement_output.csv", "w")
paymentfile = open("Roseburg_Procurement_payment.csv", "w")
trashfile = open("Roseburg_Procurement_trashlines.txt", "w")