Skip to content

Instantly share code, notes, and snippets.

View SimonGoring's full-sized avatar

Simon SimonGoring

View GitHub Profile
@SimonGoring
SimonGoring / listgit.sh
Last active November 18, 2021 16:06
A short bash script to check a directory and report whether Git projects have been committed, or are being tracked.
#!/bin/bash
curdir=$PWD
RED='\033[1;31m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
NC='\033[0m' # No Color
cnt=0
good=0
untr=0
uncom=0
@SimonGoring
SimonGoring / onlinesales.ipynb
Created September 20, 2018 06:34
Modified ipython notebook with new data and table definitions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SimonGoring
SimonGoring / db_connect.json
Last active September 18, 2018 05:35
IPython Notebook for BAIT Group Project
{
"host": "localhost",
"port": 5432,
"database": "yourdatabase",
"user": "postgres",
"password": "postgres"
}
@SimonGoring
SimonGoring / clean_db.sql
Last active September 21, 2022 23:30
Basic Database model for real estate data in Postgres.
/* If you've messed up and need to remove all the tables. */
DROP TABLE listings.person CASCADE;
DROP TABLE listings.property CASCADE;
DROP TABLE listings.agency CASCADE;
DROP TABLE listings.agent CASCADE;
DROP TABLE listings.listing CASCADE;
DROP TABLE listings.offer CASCADE;
@SimonGoring
SimonGoring / installLibs.sh
Last active January 2, 2019 20:37
Recursively searches R and Rmd files in a directory to install all required packages using R.
#!/bin/bash
# This scrips is described in more detail at http://www.goring.org/resources/regex_bash_libraries.html
rinstall=0
while getopts "i" OPTION
do
case $OPTION in
i)
echo Running installLib with the option to install packages.
@SimonGoring
SimonGoring / neotomav2fagus.R
Created May 16, 2018 16:25
Obtain data from the v2.0 Neotoma data API and plot it using R.
# Use the newer Neotoma API to pull sites with Fagus into a map from a JSON response.
# Used as part of the Data Demo Derby (hosted by EarthRates)
small_occ <- httr::GET('http://api-dev.neotomadb.org/v2.0/data/occurrence/?taxonname=Fagus&limit=5000')
small_content <- httr::content(small_occ)
library(dplyr)
site_table <- small_content$data %>%
@SimonGoring
SimonGoring / autobuild.sh
Last active November 2, 2021 20:02
Autobuild RMarkdown presentations
#!/bin/bash
### Set initial time of file
LTIME=`stat -c %Z ./$1.Rmd`
while true
do
ATIME=`stat -c %Z ./$1.Rmd`
if [[ "$ATIME" != "$LTIME" ]]
@SimonGoring
SimonGoring / neotoma_us_lake_sizes.R
Last active August 7, 2017 22:52
Extract lake sizes from the National Hydrology Database for all US Neotoma pollen sites.
# This script starts from scratch:
library(rgdal)
library(neotoma)
library(dplyr)
library(purrr)
library(sp)
library(datasets)
library(sf)
@SimonGoring
SimonGoring / rstudio-backtrace.txt
Created April 18, 2017 17:51
RStudio backtrace - Crash on file open.
RStudio Version: 1.0.136
> print(sessionInfo())
R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS
locale:
[1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8
@SimonGoring
SimonGoring / diagnostic-report.txt
Created April 2, 2017 05:57
RStudio Diagnostic report
[1] "1.0.136"
$R
[1] "/usr/bin/R"
$pdflatex
[1] ""
$bibtex
[1] ""