Skip to content

Instantly share code, notes, and snippets.

View jrfep's full-sized avatar
🗺️
world view

José R. Ferrer Paris jrfep

🗺️
world view
View GitHub Profile
@jrfep
jrfep / Coral-reef-N-Tanzania-Kenya-criterion-D1-results.dot
Created July 27, 2023 05:35
Graphviz diagram describing the sequential rule for adjusting category of risk from multiple indicators. Example from Obura et al. (2022). https://doi.org/10.1038/s41893-021-00817-0 Table S16
digraph G {
graph [
label = "Coral Reef Northern Tanzania/Kenya - Subcriterion D1"
labelloc = t
compound=true;
fontname = "Helvetica,Arial,sans-serif"
fontsize = 20
layout = dot
rankdir = TD
newrank = true
@jrfep
jrfep / auto-organise-files.sh
Created July 10, 2023 09:24
Auto organise files in subfolder for each date
#!/bin/bash
## basically following https://stackoverflow.com/questions/27475057/sort-files-into-sub-folders-by-date-bash
DIR=`pwd`
target=$DIR
cd "$DIR"
for file in *; do
subfolderName=$(stat -f "%Sm" -t "%Y-%m-%d" $file)
@jrfep
jrfep / gradual-grid.gv
Created April 20, 2023 22:55
Visual representation of a gradual grid using graphviz dot language
digraph G {
bgcolor=transparent;
start [shape=Mdiamond
label=<<TABLE COLOR='white' CELLPADDING="0" CELLSPACING="0" BORDER="1">
<TR>
<TD BGCOLOR='#ffffd9'>1</TD>
<TD BGCOLOR='white'>X</TD>
<TD BGCOLOR='white'>X</TD>
<TD BGCOLOR='white'>X</TD>
@jrfep
jrfep / explore-gpx-file-with-mapview.R
Created July 5, 2022 22:03
Visualise a GPS track in .gpx format with mapview in R
require(mapview)
require(sf)
# depending on the version of GDAL, you might need to use `fgb = TRUE` instead
mapviewOptions(fgb = FALSE)
gpx_file <- "~/Desktop/Track_02-JUL-22 170634.gpx" # path and filename
read_sf(gpx_file,'tracks') -> paseo
paseo %>% st_geometry() %>% plot() # check if there is data on the track
mapview(paseo)
@jrfep
jrfep / cummulative-R-packages-plot.R
Last active November 19, 2021 20:05
Cummulative number of R packages on CRAN
#!R --vanilla
## original idea & report by Henrik Bengtsson at
## https://stat.ethz.ch/pipermail/r-devel/2016-February/072388.html
## some code borrowed from:
## https://gist.github.com/daroczig/3cf06d6db4be2bbe3368
library(rvest)
library(dplyr)
require(stringr)
@jrfep
jrfep / CropGeotiffExample.sh
Created July 28, 2016 14:23
Crop and rename raster data in geotiff format with gdal in a linux bash
## files downloaded from http://chelsa-climate.org/downloads/
## monthly temperatures and precipitation with global extent
## output options:
outputdir = "$HOME/output"
xmin=-74
ymin=0
xmax=-58
ymax=13
for (( j=1; j <= 12; j++ ))
do