Skip to content

Instantly share code, notes, and snippets.

View johnniehard's full-sized avatar
🚀
Making it happen!

Johnnie Hård johnniehard

🚀
Making it happen!
View GitHub Profile
@johnniehard
johnniehard / nginx.conf
Created February 4, 2020 12:30
nginx autoindex config
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
listen 80 default_server;
listen [::]:80 default_server;
#root /var/www/html;
@johnniehard
johnniehard / machine.js
Last active January 22, 2020 12:02
Generated by XState Viz: https://xstate.js.org/viz
const todoMachine = Machine({
id: 'todoMachine',
initial: 'fetch',
context: {
todos: null
},
states: {
idle: {
on: {
FETCH: 'fetch',
@johnniehard
johnniehard / res.json
Last active January 17, 2020 08:36
Exempel på API-svar flödesappen. res.md förklarar fälten i res.json.
{
"uuid": "72e679a0-1a59-11ea-b338-d7ffcbd7b692",
"jobState": "complete",
"clientUrl": "https://<url-här>",
"result": {
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": ["...koordinater"]
},
@johnniehard
johnniehard / allfilesindir.sh
Last active April 5, 2023 07:20
Create a text file with the absolute path to all files of type in a directory.
#!/bin/bash
find $1 -name "*.$2" -print0 | xargs -0 ls >> files.txt
@johnniehard
johnniehard / dokku-postgis.md
Last active May 4, 2020 19:09
Postgis on Dokku. Old blog post, was placed in private repo, posting it here so that others can find it.

title: Setting up PostGIS with Dokku date: 2017-09-22 00:00:00 Z tags:

  • GIS
  • PostGIS
  • Dokku layout: post author: Johnnie Hård subtitle: Note to self on how to set up a PostGIS datbase on a Dokku host.
@johnniehard
johnniehard / tunnel.md
Last active March 22, 2019 13:58
Port forward to internal ip. Mongo on Dokku

The mongo service need to have exposed ports as per the documentation.

Then, on the Dokku server run

dokku mongo:info <name>

take note of the internal ip of the Mongo server, exposed ports and the Mongo URI.

Then run

@johnniehard
johnniehard / Dockerfile
Last active November 15, 2019 21:25 — forked from perrygeo/Dockerfile
Minimal debian image with Python 3.6 and geo python tools
FROM python:3.6-slim-stretch
ADD requirements.txt /tmp/requirements.txt
RUN apt-get update && \
apt-get install -y \
build-essential \
make \
gcc \
locales \
@johnniehard
johnniehard / MBTiles: Pipe GeoJSON from PostGIS to Tippecanoe.md
Last active April 11, 2020 20:49
MBTiles: Pipe GeoJSON from PostGIS to Tippecanoe

I had a large dataset in postgis and wanted to avoid the hassle of first exporting it to a several GB geojson file before tiling it with Tippecanoe.

ogr2ogr -f GeoJSON /dev/stdout \                                                                            
PG:"host=localhost dbname=postgres user=postgres password=thepassword" \
-sql "select * from a, roi where a.geom && roi.geom" \
| docker run -i -v ${PWD}:/data tippecanoe:latest tippecanoe \
--output=/data/yourtiles.mbtiles
@johnniehard
johnniehard / index.html
Last active September 1, 2018 07:32 — forked from d3noob/index.html
Sankey Diagram with v4
<!DOCTYPE html>
<meta charset="utf-8">
<title>SANKEY Experiment</title>
<style>
.node rect {
cursor: move;
fill-opacity: .9;
shape-rendering: crispEdges;
}
import { render, html } from 'lit-html'
class MyElement extends HTMLElement {
constructor(){
super()
this.state = {
loading: true
}
}