Skip to content

Instantly share code, notes, and snippets.

@unusorin
unusorin / rgb_bigtiff_cogs_notes.md
Created March 30, 2022 14:57 — forked from palmerj/rgb_bigtiff_cogs_notes.md
Creating BigTiff COGS for raster RGB photos from a tile mosaic directory using GDAL

Creating a Cloud Optimised Geotiffs (COGs) for raster photo imagery

This process outlines the process for creating Cloud Optimised Geotiffs suitable for hosting in services such as AWS S3. COGs enables more efficient workflows use cases such as fast access from Functions as a Services (E.g AWS Lambda), or comsumption into client desktop GIS systems (e.g QGIS). For more details on COGs please see https://www.cogeo.org/in-depth.html

1. Create a mosaic

#!/usr/bin/env php
<?php
require 'SebastianBergmann/FinderFacade/autoload.php';
require 'TheSeer/fDOMDocument/autoload.php';
use SebastianBergmann\FinderFacade\FinderFacade;
use TheSeer\fDOM\fDOMDocument;
$input = new FinderFacade(array($argv[1]), array(), array('*.xml'));
$output = $argv[2];
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "raring64"
config.vm.hostname = "docker"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box"
#!/bin/sh
AGENT_URL=http://puppetlabs.com/downloads/puppet/puppet-2.7.14.tar.gz
FACTER_URL=http://puppetlabs.com/downloads/facter/facter-1.6.9.tar.gz
apt-get update
apt-get -y install ruby rake rubygems
cd /tmp
wget ${FACTER_URL} -O /tmp/facter.tar.gz
@unusorin
unusorin / clear.sh
Created February 26, 2014 08:31 — forked from Zuckonit/clear.sh
#!/usr/bin/env bash
printf "\033c"

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@unusorin
unusorin / gist:7874001
Created December 9, 2013 15:30
Errors as exceptions
<?php
class PhpErrorException extends \Exception{
public function __construct($message = "", $code = 0, $file = '', $line = '', Exception $previous = null)
{
$this->file = $file;
$this->line = $line;
parent::__construct($message, $code, $previous);
}
}
@unusorin
unusorin / default.vcl
Created July 5, 2013 08:02
Varnish vcl file for Symfony2
backend default {
.host = "domain.com";
.port = "8000";
}
sub vcl_recv {
if (req.request == "PURGE") {
if (!client.ip ~ purge) {
error 405 "Not allowed.";
@unusorin
unusorin / gist:3749876
Created September 19, 2012 14:06
Time ago
<?php
function prettyDate($date){
$time = strtotime($date);
$now = time();
$ago = $now - $time;
if($ago < 60){
$when = round($ago);
$s = ($when == 1)?"second":"seconds";
return "$when $s ago";
}elseif($ago < 3600){
@unusorin
unusorin / MultiCurl.class.php
Created September 19, 2012 13:03
MultiCurl class PHP
<?php
/**
* MultiCurl class library is a PHP solution for work with MULTI CURL extension.
* It provides to execute some parallel HTTP requests with limit of downloaded
* size. Example: start 100 downloads with 2 parallel sessions, and get only
* first 100 Kb per session.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either