This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- modelled crossings | |
SELECT | |
pmc.pscis_model_combined_id, | |
x.crossing_id as model_crossing_id, | |
pmc.pscis_stream_crossing_id, | |
x.track_name, | |
x.track_classification, | |
x.use_type, | |
x.gauge, | |
x.status, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pack <- renv::dependencies() %>% | |
dplyr::distinct(Package) %>% | |
dplyr::pull(Package) | |
paste(shQuote(pack), collapse=", ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reticulate::use_condaenv('bcfishpass') %>% | |
base::system2(paste0("sh ",getwd(), "/scripts/test.sh")) | |
schema <- jsonlite::fromJSON('data/whse_fish.pscis_assessment_svw_metadata.json', flatten = T) %>% | |
purrr::pluck('schema') %>% | |
dplyr::mutate(column_name = stringr::str_to_lower(column_name)) | |
#within test.sh (unhash second line) is | |
#!/bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this is for make | |
for x in {1..20}; do make; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from https://stackoverflow.com/questions/17385794/how-to-get-the-process-id-to-kill-a-nohup-process#:~:text=When%20using%20nohup%20and%20you,you%20need%20to%20force%20kill). | |
# pg_tileserv | |
nohup ~/config/pg_tileserv >> pg_tileserv.log 2>&1 & | |
echo $! > pid_pg_tileserv.txt | |
#check output with | |
tail pg_tileserv.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# asssumes UTMs. Column nmaes would be `lat` `long` if in Albers or WSG84 | |
#option 1 - retains the sf object | |
sf_object %>% | |
mutate( | |
easting = sf::st_coordinates(.)[,1], | |
northing = sf::st_coordinates(.)[,2]) | |
# option 2 - this changes from sf object to a dbl_df - not usually helpful | |
sf_object %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Command+Shift+Dot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#list column names of a table | |
select column_name | |
from information_schema.columns | |
where table_name = 'questionnaire' | |
and table_schema = 'fi'; | |
## list the sizes of all schemas in a database | |
SELECT schema_name, | |
pg_size_pretty(sum(table_size)::bigint), | |
(sum(table_size) / pg_database_size(current_database())) * 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#For now lets stop tracking the bcfishpass.sqlite changes in repo unless changes to underlying tables actually happen by running the script below | |
git update-index --assume-unchanged data/bcfishpass.sqlite. When changes actually occur we use git update-index --no-assume-unchanged data/bcfishpass.sqlite to log a commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
([^/\\]+)\.\gpkg |
OlderNewer