Skip to content

Instantly share code, notes, and snippets.

View prl900's full-sized avatar

Pablo Rozas Larraondo prl900

View GitHub Profile
@prl900
prl900 / geo.md
Last active September 5, 2017 21:32

G^e^o

@prl900
prl900 / stringer_pipeline.go
Created September 12, 2017 10:15
Example of a Go pipeline
package main
import (
"fmt"
)
type Stringer struct {
In chan *string
Out chan *string
Error chan error
@prl900
prl900 / S3_cloud_free.go
Created September 14, 2017 21:03
AWS Go SDK example
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
import numpy as np
from osgeo import gdal
from PIL import Image
import netCDF4
import json
import os
import sys
import datetime
import argparse
import time
@prl900
prl900 / tiling.go
Last active October 23, 2017 20:58
package main
import (
"fmt"
)
type Array struct {
Data []byte
Shape []int
Offset []int
@prl900
prl900 / wcs.py
Last active November 28, 2017 22:54
Sample script using owslib to perform a WCS request using logging
#!/usr/bin/env python
from owslib.wcs import WebCoverageService
import logging
def GetCapabilities(path):
if not path.startswith('http'):
print "Malformed path, should start with http"
return
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@prl900
prl900 / parser.hs
Created February 3, 2018 11:42
Haskell CSV parser sample code
split :: String -> [String]
split [] = [""]
split (c:cs) | c == ',' = "" : rest
| otherwise = (c : head rest) : tail rest
where rest = split cs
nameexists :: String -> [[String]] -> Bool
nameexists a [] = False
nameexists a (x:xs) | x !! 0 == a = True
| otherwise = nameexists a xs
@prl900
prl900 / parser.go
Created February 3, 2018 11:51
Go CSV parser sample code
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
const csvFile = "CSVFile.csv"
@prl900
prl900 / parser.py
Created February 3, 2018 12:09
Python CSV parser sample code
FILE_NAME = "CSVFile.csv"
def exists(name, persons):
for person in persons:
if name == person[0]:
return True
return False
def get_phone(name, persons):
for person in persons: