Skip to content

Instantly share code, notes, and snippets.

View geneorama's full-sized avatar

Gene Leynes geneorama

View GitHub Profile
@geneorama
geneorama / gist:c38573682aac4ec0d131451ca5a04f65
Created July 2, 2021 17:21
WinScp error for ppk conversion
View gist:c38573682aac4ec0d131451ca5a04f65
$ winscp.com /keygen id_rsa_xyz.pem /output=id_rsa_xyz.ppk
Scripting does not use standalone parameters. The parameters you have specified on command-line will not be used. Your command-line syntax is probably wrong.
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Searching for host...
Host "C" does not exist.
winscp> exit
exit
@geneorama
geneorama / chicovidcasevsothers.R
Created October 27, 2020 21:14
Yet another COVID 19 map - Chicago area cases, hospitalizations, and deaths (normalized for peak)
View chicovidcasevsothers.R
## Author Gene Leynes
## Date: Oct 27, 2020
## Best run with R (Free) in R Studio (Free)
## Download R and R Studio to reproduce.
## Available for windows, mac, linux
## If you don't have these packages you can install them with this code:
## install.packages("data.table")
## install.packages("magrittr")
@geneorama
geneorama / wardmap.R
Last active May 30, 2022 22:04
Plot Chicago ward map with labels that are actually in the wards
View wardmap.R
##==============================================================================
## INITIALIZE
##==============================================================================
rm(list=ls())
library(geneorama) ## Not actually needed
library(data.table)
View interactive_map_tutorial.Rmd
---
title: "Making Interactive Maps of Public Data in R"
author: "Ryan Rosenberg"
output: html_document
---
<style>
.leaflet {
margin: auto;
}
</style>
@geneorama
geneorama / readme.md
Last active December 6, 2018 20:12
msysgit readme
View readme.md

I copied this in case they change it or the package goes away. This document describes the componentes of msysgit, which is part of git bash for windows. It explains the difference between MSys and MinGW, and has a link to a very useful wiki (https://github.com/msysgit/msysgit/wiki) with instructions on how to report bugs etc.


README.md for msysgit/msysgit

Please note!

View gist:14b947e5dbe18caa620dd65bacdc170f
rm(list=ls())
library(data.table)
txt <- fread("~/Downloads/iGrill Mini-5839 - Probe - 32418, 112903 AM.csv")
setnames(txt, 'Temperature (°F)', 'temperature')
setnames(txt, 'Date & Time', 'timestamp')
txt[ , timestamp := as.POSIXct(strptime(timestamp, "%m/%d/%y, %I:%M:%S %p"))]
txt[temperature == "--", temperature:=NA]
txt
@geneorama
geneorama / ls.socrata example.md
Last active December 6, 2018 20:01
flattening `ls.socrata`
View ls.socrata example.md

Flatten return values Socrata's data view

You can get the list of data sets in a Socrata domain with the data.json route, for example; "http://soda.demo.socrata.com/data.json".

However there are some very nested objects that are inconvenient for R. This is just an example of how to flatten specifically the data.json return value from Socrata.

This is not tested. This was a demo in conjunction with work on ls.socrata in the package https://github.com/Chicago/RSocrata/

@geneorama
geneorama / glmnet_girdsearch.R
Created November 2, 2016 13:34
Heap your criticisms here
View glmnet_girdsearch.R
grid_glmnet <- expand.grid(alpha = c(0, .2, .4, .6, .8, 1),
# lambda = seq(.01, .2, length = 40))
#lambda = rev(exp(seq(log(.00001), log(200), length=10)))
lambda = rev(exp(seq(log(.00001), log(20), length=20))))
results_glmnet <- list()
# g <- unique(dat$grp)[1]
# i <- 1
for(i in 1:nrow(grid_glmnet)){
print(i)
@geneorama
geneorama / label_encoding_beginning
Last active February 1, 2018 01:13
Example of how to encode data frame with string / factor levels into numeric factor levels, and store the encoding.
View label_encoding_beginning
##
## gene leynes 2016-10-28
##
## Label encoder based on
## http://stackoverflow.com/questions/38620424/label-encoder-functionality-in-r
##
encoding_matrix <- function(df, plug_missing = TRUE, missing_string = "MISSING"){
df <- as.data.frame(df)
cols <- which(sapply(df, is.character) | sapply(df, is.factor))
@geneorama
geneorama / index.html
Last active October 10, 2016 17:22
WNV_Map_with_counts
View index.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />