Skip to content

Instantly share code, notes, and snippets.

View brownag's full-sized avatar

Andrew Gene Brown brownag

View GitHub Profile
@jiahao
jiahao / llama2.jl
Last active August 2, 2023 08:35
NOTE 2023-07-30: This gist is deprecated in favor of https://github.com/rai-llc/LanguageModels.jl . llama2.jl is a port of @karpathy's llama2.c to Julia.
# A port of https://github.com/karpathy/llama2.c/blob/master/run.c
# to Julia.
# Jiahao Chen <jiahao@csail.mit.edu> 2023-07-29
#
# MIT License: see full text at https://opensource.org/license/mit/
#
using LinearAlgebra
using LogExpFunctions
library(soilDB)
library(terra)
library(sf)
library(viridis)
# BBOX polygon in WKT
wkt <- 'POLYGON((-121.25714 37.53609,-121.25714 37.99098,-120.48055 37.99098,-120.48055 37.53609,-121.25714 37.53609))'
# init sf object and set CRS -> WGS84
x <- st_as_sfc(wkt)
#This script downloads soilgrids (https://www.isric.org/explore/soilgrids) data
#at a given resolution (variable "res", in degrees) and the depth intervals 0-5 and 5-15
#to compute the mean for the depth interval 0-15.
#It also applies the conversion factor shown in the FAQ (https://www.isric.org/explore/soilgrids/faq-soilgrids#How_can_I_access_SoilGrids)
#to reconstitute the original data units.
library(gdalUtils)
library(raster)
#variables to download
@obrl-soil
obrl-soil / rgrass7-setup-win-osgeo4w.R
Last active March 14, 2024 20:41
rgrass7 and OsGeo4W on Windows - environment variables for R
# Source this file at the top of an R or Rmd file using rgrass7 together
# with GRASS installed via OSGeo4W (https://trac.osgeo.org/osgeo4w/) on a
# Windows machine.
# e.g. source(file.path(getwd(), 'rgrass7-setup-win-osgeo4w.R'))
# You can alternatively add the contents to a project-specific .Rprofile.
# Its better to set these variables in an R session rather than in System,
# especially if you have other GIS software like PostGIS installed, which has
@rohitfarmer
rohitfarmer / nvimr-demo.md
Last active January 31, 2024 05:32
Nvim-R Demo

How to use Neovim or VIM Editor as an IDE for R

Note: This tutorial is written for Linux based systems.

Requirements

R >= 3.0.0

To install the latest version of R please flollow the download and install instructions at https://cloud.r-project.org/

Neovim >= 0.2.0

Neovim (nvim) is the continuation and extension of Vim editor with the aim to keep the good parts of Vim and add more features. In this tutorial I will be using Neovim (nvim), however, most of the steps are equally applicable to Vim also. Please follow download and installation instructions on nvim's GitHub wiki https://github.com/neovim/neovim/wiki/Installing-Neovim.

@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 4, 2024 11:33
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@tgirke
tgirke / _Nvim-R-Tmux.md
Last active October 13, 2023 05:29
Nvim-R-Tmux: An Integrated Working Environment for R

Nvim-R-Tmux: Neovim-based IDE for R

!!! This Gist tutorial is deprecated. Its new version is available here !!!

This is some red text.

  • Author: Thomas Girke
  • Last update: 18-Nov-2020

@ramnathv
ramnathv / gh-pages.md
Created March 28, 2012 15:37
Creating a clean gh-pages branch

Creating a clean gh-pages branch

This is the sequence of steps to follow to create a root gh-pages branch. It is based on a question at [SO]

cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" &gt; index.html