Skip to content

Instantly share code, notes, and snippets.

View NewGraphEnvironment's full-sized avatar

Allan Irvine NewGraphEnvironment

View GitHub Profile
@NewGraphEnvironment
NewGraphEnvironment / gist:cf464176a44015ea5121b39e59105a29
Created May 26, 2024 23:12
see running processes on port so you can kill -9 <PID>
sudo lsof -i :7788
@NewGraphEnvironment
NewGraphEnvironment / labels.R
Created April 29, 2024 20:05
remove labels with gh
purrr::walk(
c("test", "bug"),
~gh::gh(
"DELETE /repos/:owner/:repo/issues/:issue_number/labels/:name",
owner = "NewGraphEnvironment",
repo = "fish_passage_skeena_2023_reporting",
issue_number = 69,
name = .x
)
)
``` r
library(tidyverse)
ishies <- c(
gh::gh("/repos/NewGraphEnvironment/onboarding/issues", .limit = 100, state = "open"),
gh::gh("/repos/NewGraphEnvironment/onboarding/issues", .limit = 100, state = "closed")
) |>
# but these have pull requests as well. We want what we call "issues" only so we filter
purrr::discard(~"pull_request" %in% names(.x))
rfp - reproducable field projects
+ retrieve metadata
- QGIS project generation
- mergin/git integration to track commit messages for pushed mergin versions in git
- mergin project creation
- mergin status testing
- mergin permissions tracking and
- background_layers.gpkg
- retrieve metadata from bcdata catalougue and elsewhere when provided with schema.table names
- tables showing layers in QGIS projects and
@NewGraphEnvironment
NewGraphEnvironment / gist:a9da0243c48ad352b2bb2ff44184cc1d
Created March 22, 2024 20:11
chattr token breakout and file creation wildfire playbook review
# Load required libraries
{
library(pdftools)
library(tm)
library(stringr)
library(chattr)
library(tidyverse)
}
chattr('which model are you and what are you up to? Please explain in less than 100 words', stream = FALSE)
Old Growth Geospatial Data
Old Growth
Legal Old Growth
Air Photo
Photo BC*
name Data Files - Description - Zipped folder containing all the data files used for analysis
name - R Scripts - Description - Zipped folder containing the R-scripts used for data analysis
Riparian
Riparian and In-Stream Assessment of the Bulkley River System
Restoration
library(readwritesqlite)
library(tidyhydat)
library(tidyverse)
library(cli)
library(DBI)
# see a list of parameters available
param_id <- param_id
@NewGraphEnvironment
NewGraphEnvironment / pscis_roads.sql
Created January 3, 2024 15:47
bcdata roads query
with dra as
(SELECT
pt.stream_crossing_id,
nn.*
FROM whse_fish.pscis_assessment_svw as pt
CROSS JOIN LATERAL
(SELECT
digital_road_atlas_line_id,
road_name_full,
road_surface,
git stash push -m 'no change' -- data/bcfishpass.sqlite
@NewGraphEnvironment
NewGraphEnvironment / gist:4ae4ebb25f4e5f4451fb3e59fafd556e
Created September 10, 2023 20:45
update background_layers.gpkg streams and crossings from shared db
query <- "SELECT *
FROM bcfishpass.streams
WHERE watershed_group_code IN ('ADMS', 'MORK', 'UFRA', 'CANO', 'LNTH', 'UNTH', 'MURT', 'CLWR', 'CLRH', 'REVL')"
##import and grab the coordinates - this is already done
sf::st_read(conn, query = query) %>% st_write('background_layers.gpkg', delete_layer =TRUE, layer = 'streams')
query <- "SELECT *
FROM bcfishpass.crossings