Skip to content

Instantly share code, notes, and snippets.

@pomadchin
pomadchin / Main.scala
Last active August 4, 2024 19:04
GeoTrellis quickstart
package com.pomadchin
import geotrellis.raster.RasterSource
import geotrellis.vector.Extent
object Main {
// https://github.com/locationtech/geotrellis/blob/master/raster/data/one-month-tiles-tiff/test-200506000000_0_1.tiff
// ./bin/hadoop fs -copyFromLocal ~/Downloads/test-200506000000_0_1.tiff /test-200506000000_0_1.tiff
def main(args: Array[String]): Unit =
RasterSource("hdfs://localhost:9000/test-200506000000_0_1.tiff")
@pomadchin
pomadchin / README.md
Created February 13, 2023 23:12 — forked from robertpainsi/README.md
How to reopen a pull-request after a force-push?

How to reopen a pull-request after a force-push?

Precodinitions

  • You need the rights to reopen pull requests on the repository.
  • The pull request hasn't been merged, just closed.

Instructions

  1. Write down the current commit hash of your PR-branch git log --oneline -1 <PR-BRANCH>
  2. Write down the latest commit hash on github before the PR has been closed.
  3. git push -f origin :
@pomadchin
pomadchin / example-item-id.json
Last active November 9, 2021 16:00
PySTAC SELF_CONTAINED catalog generation with absolute links in items
{
"type": "Feature",
"stac_version": "1.0.0",
"id": "example-item-id",
"properties": {
"datetime": "2021-11-01T00:00:00Z"
},
"geometry": {
"type": "Polygon",
"coordinates": [
@pomadchin
pomadchin / README.md
Last active October 13, 2021 17:59
RF Notebook with STAC and Focal Operations

Instructions to run STAC API Example.ipynb

git clone [email protected]:locationtech/rasterframes.git
cd rasterframes/rasterframes/rf-notebook/src/main/docker

# edit docker-compose.yaml
# image: quay.io/daunnc/rasterframes-notebook:0.9.2-SNAPSHOT
docker compose up
@pomadchin
pomadchin / snippets-importing-libraries.ipynb
Last active October 13, 2021 16:42
RasterFrames STAC and Focal Ops example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function git-tag-rename() {
git tag $2 $1
git tag -d $1
git push origin :refs/tags/$1
git push --tags
}
for tag in $(git tag); do
git-tag-rename "$tag" "v$tag"
done
debug: Using host CA: commonName=StM Root CA
debug: Using host CA: commonName=StM Root CA
debug: Using host CA: commonName=5b7fb0f6-e87d-463a-b1a5-ad7ca22c0540
debug: Using host CA: commonName=17799bf3-1589-4401-9f0f-3dcd835564fb
debug: Using host CA: countryName=US,stateOrProvinceName=New Jersey,localityName=Jersey City,organizationName=The USERTRUST Network,commonName=USERTrust RSA Certification Authority
debug: Using host CA: countryName=US,stateOrProvinceName=New Jersey,localityName=Jersey City,organizationName=The USERTRUST Network,commonName=USERTrust RSA Certification Authority
debug: Using host CA: countryName=US,stateOrProvinceName=MI,localityName=Ann Arbor,organizationName=Internet2,organizationalUnitName=InCommon,commonName=InCommon RSA Server CA
debug: Using host CA: countryName=SE,organizationName=AddTrust AB,organizationalUnitName=AddTrust External TTP Network,commonName=AddTrust External CA Root
debug: Using host CA: countryName=SE,organizationName=AddTrust AB,organizationalUnitName=Add
@pomadchin
pomadchin / STACCatalogUpdate.scala
Last active July 27, 2021 22:37
Code to update STAC Catalog via STAC4s Client
import com.azavea.stac4s.StacItem
import com.azavea.stac4s.api.client.{ETag, SttpStacClient}
import cats.effect.{ExitCode, IO, IOApp}
import cats.syntax.option._
import eu.timepit.refined.types.string.NonEmptyString
import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend
import sttp.client3.UriContext
import java.net.URI
import cats.{Id, ~>}
import cats.effect.{Sync, IO}
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success, Try}
/** Type class that allows to handle unsafe calls */
trait UnsafeLift[F[_]] { self =>
def apply[A](value: => A): F[A]
@pomadchin
pomadchin / Coercible.scala
Last active December 7, 2019 00:34
Auto derivation of Circe codecs for shapeless Newtypes and TaggedTypes
import shapeless.newtype.Newtype
/** Coercion to derive [[shapeless.newtype.Newtype]] and [[shapeless.tag.Tagged]] type classes */
trait Coercible[A, B] {
def apply(a: A): B = a.asInstanceOf[B]
}
object Coercible {
implicit def newTypeToCoercible[R: * => O, O]: Coercible[R, Newtype[R, O]] = new Coercible[R, Newtype[R, O]] { }
implicit def newTypeToCoercibleK[F[_], R: Coercible[*, Newtype[R, O]]: * => O, O]: Coercible[F[R], F[Newtype[R, O]]] = new Coercible[F[R], F[Newtype[R, O]]] { }