Skip to content

Instantly share code, notes, and snippets.

package datastore
import (
"context"
"encoding/json"
"fmt"
"sync"
)
// cacheSetFunc is a function to update cache keys.
diff -r 2e0936c9783e broadcast/alarmstream.go
--- a/broadcast/alarmstream.go Thu Jan 17 13:36:18 2019 +0100
+++ b/broadcast/alarmstream.go Fri Jan 18 12:59:27 2019 +0100
@@ -181,6 +181,15 @@
return nil
}
+func (asb *AlarmStreamBroker) heartbeat() {
+ // TODO: Implement me!
+}
package main
import (
"database/sql"
"time"
)
const querySQL = `
SELECT
st_x(koordinate),
@s-l-teichmann
s-l-teichmann / geojson.go
Created August 28, 2018 08:46
Using json.Marshaler in GeoJSON
package main
import (
"encoding/json"
"fmt"
"log"
"os"
)
//type Point2D [2]float64
@s-l-teichmann
s-l-teichmann / setrole.go
Created August 23, 2018 09:14
Impersonation on two database connections
package main
import (
"context"
"database/sql"
"fmt"
"log"
"github.com/jackc/pgx"
"github.com/jackc/pgx/stdlib"
@s-l-teichmann
s-l-teichmann / convert.go
Last active July 12, 2018 10:26
Splitting files
// convert -- a little file splitter
// (c) 2018 by Sascha L. Teichmann
// This is Free Software covered by the terms of the MIT license.
//
package main
import (
"bufio"
"flag"
// Small example how to do a web server in Go with stdlib.
// (c) 2017 by Sascha L. Teichmann
// The is Free Software covered by the terms of the MIT License.
// See https://opensource.org/licenses/MIT for details.
package main
import (
"context"
"fmt"
@s-l-teichmann
s-l-teichmann / blindtiffs.go
Last active November 1, 2017 12:37
A small tool to create a copy of a directory tree with all GeoTIFFs 'blinded' (all values zero) by gdal_calc.py preserving the meta data.
// blindtiffs
// ----------
// Usage: blindtiffs <src> <dst>
// Recursively copies folder <src> to folder <dst>.
// All GeoTIFFs in the source tree are 'blinded' by
// gdal_calc.py to have zero channels but still contain
// all the meta data.
//
// (c) 2017 by Sascha L. Teichmann
@s-l-teichmann
s-l-teichmann / parassh.go
Last active August 28, 2017 14:58
Simple experiment to parallel ssh-ing into remote machines with Go
// Simple experiment to parallel ssh-ing into remote machines with Go.
//
// (c) 2017 by Sascha L. Teichmann
// The is Free Software covered by the terms of the MIT License.
// See https://opensource.org/licenses/MIT for details.
//
package main
import (
"bufio"
// A simple experiment to check how fast point in polygon tests with
// a first level spatial index filter are.
//
// This is Free Software covered by the MIT license.
// See https://opensource.org/licenses/MIT for details.
// (c) 2017 by Sascha L. Teichmann (sascha.teichmann@intevation.de)
//
package main
import (