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 / 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 / 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 / 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 / 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 / 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 / eebatch.js
Created March 20, 2020 12:20
kör alla tasks i EE webbklienten
function runTaskList() {
//1. task local type-EXPORT_FEATURES awaiting-user-config
//2. task local type-EXPORT_IMAGE awaiting-user-config
var tasklist = document.getElementsByClassName('awaiting-user-config');
for (var i = 0; i < tasklist.length; i++)
tasklist[i].children[2].click();
}
// confirmAll();
function confirmAll() {
var ok = document.getElementsByClassName('goog-buttonset-default goog-buttonset-action');
@johnniehard
johnniehard / TestSketch.js
Last active April 3, 2020 19:34
Using p5.js with React using custom hook.
import useSketch from ".";
export default function TestSketch() {
const sketch = useSketch(s => {
s.setup = () => {
s.createCanvas(800, 600)
}
dokku apps:create hasura
dokku domains:add hasura hasura.my.domain.com
dokku postgres:create hasura-db
dokku postgres:link hasura-db hasura
dokku config:set hasura HASURA_GRAPHQL_DATABASE_URL="<info from above command>" HASURA_GRAPHQL_ADMIN_SECRET="blahblah" HASURA_GRAPHQL_ENABLE_CONSOLE="true"
dokku proxy:ports-set hasura http:80:8080
docker pull hasura/graphql-engine
docker tag hasura/graphql-engine dokku/hasura
dokku tags:deploy hasura
dokku letsencrypt hasura
@johnniehard
johnniehard / getradius.sql
Created July 1, 2020 08:38
Getting the centroid and radius of (circle) polygons with postgis.
create table "magnus-etuna".trees as
select fid, center as geom, radius as crownRadius from "magnus-etuna"."tree-polygons", ST_MinimumBoundingRadius(geom) as geom;
@johnniehard
johnniehard / food-color-names.csv
Created October 3, 2020 04:53
Tasty CSS color names
color comment
salmon
tomato
orange
peachpuff Questionable? It has peach, but wat's a puff?
lime
olive
lavender Questionable.
plum
honeydew