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
#install.packages("rapidclient") | |
#devtools::install_github("bergant/rapiclient") | |
library("rapidclient") | |
library(tidyverse) | |
# api <- get_api(url = "https://www.geonormandie.fr/geonetwork/srv/v2/api-docs") | |
# api <- get_api(url = "https://catalogue.sigloire.fr/geonetwork/srv/v2/api-docs") | |
# api <- get_api(url = "http://onegeology-geonetwork.brgm.fr/geonetwork3/srv/v2/api-docs") | |
is.error <- function(x) inherits(x, "try-error") |
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
# renv | |
library(purrr) | |
library(tidyverse) | |
pkg <- jsonlite::read_json('renv.lock', simplifyVector = T) | |
pkg <- pkg$Packages | |
# dataframe of package |
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
library(magrittr) | |
library(pins) | |
board <- pins::board_s3( | |
bucket = "jdlomenede", | |
prefix = "my_board/", | |
versioned = TRUE, | |
access_key = Sys.getenv("AWS_ACCESS_KEY_ID"), | |
secret_access_key = Sys.getenv("AWS_SECRET_ACCESS_KEY"), | |
session_token = Sys.getenv("AWS_SESSION_TOKEN"), |
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
#!/bin/bash | |
# install github cli | |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | |
sudo apt update | |
sudo apt install gh | |
#configure git | |
env | grep "URL_GIT" | cut -d "=" -f2 > /home/rstudio/git.store | |
chown rstudio /home/rstudio/git.store |
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
create table deps_saved_ddl | |
( | |
deps_id serial primary key, | |
deps_view_schema varchar(255), | |
deps_view_name varchar(255), | |
deps_ddl_to_run text | |
); | |
create or replace function deps_save_and_drop_dependencies(p_view_schema varchar, p_view_name varchar) returns void as | |
$$ |
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
#/bin/bash | |
# create sql dump with ogr_fdw on wfs server | |
export adresse=WFS:http://ws.carmen.developpement-durable.gouv.fr/WFS/8/nature?REQUEST=GetCapabilities | |
export ogr_fdw=/usr/lib/postgresql/12/bin/ogr_fdw_info | |
export GDAL_HTTP_PROXY=10.27.8.20:8080 | |
function wfs_layers() { | |
cmd="$ogr_fdw -s $1" | |
for layer in `$cmd | awk 'f;/Layers/{f=1}'` |
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
def retrieveInfoLayerBrowser(self, index): | |
self.proxy_model = self.navigateurTreeView.model() | |
self.model = self.proxy_model.sourceModel() | |
item = self.model.dataItem(self.proxy_model.mapToSource(index)) | |
if isinstance(item, QgsLayerItem): | |
comments = item.comments() | |
self.layer = QgsVectorLayer(item.uri(), | |
#continuer pour afficher les métadonnées et voir si on peut faire la même chose pour asgardmenu | |
self.layer = QgsVectorLayer(item.uri(), item.name(), 'postgres') | |
self.loadMetadata() |
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
#!python | |
# pyqgis script | |
# get uri from browser panel | |
navigateur = iface.mainWindow().findChild(QDockWidget,'Browser') | |
navigateurTreeView = navigateur.findChild(QTreeView) | |
idx = navigateurTreeView.currentIndex() | |
uri = None | |
proxy_model = navigateurTreeView.model() | |
#model = proxy_model.sourceModel() | |
model = iface.browserModel() |
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
#!/bin/bash | |
gh auth login --with-token < token-gh.txt | |
gh repo list MTES-MCT -L 3000 | | |
grep parcours_r | | |
awk '{print $1}' | | |
xargs -n1 -I repository gh repo fork repository --clone --remote |
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
CREATE SCHEMA IF NOT EXISTS admin; | |
CREATE OR REPLACE FUNCTION admin.list_default_privileges( | |
_schema_name text DEFAULT NULL::text, | |
_de text DEFAULT NULL::text, | |
_pour text DEFAULT NULL::text, | |
_privileges text DEFAULT NULL::text, | |
_objtype text DEFAULT 'r'::text) | |
RETURNS TABLE(r_schema_name text, r_objtype text, r_de text, r_pour text, r_privileges text, r_is_grantable boolean) | |
LANGUAGE 'plpgsql' |
NewerOlder