Skip to content

Instantly share code, notes, and snippets.

@Firefishy
Firefishy / SACRS.md
Created September 7, 2016 09:04 — forked from gubuntu/SACRS.md
southern African coordinate reference systems (CRS) definitions in proj4 and WKT

Use this file to get the CRS definitions you need in southern Africa, particularly South Africa, Lesotho, Swaziland and Zimbabwe.

Most GIS software now implements the South African CRS (SACRS; incorrectly but popularly known as the "LO" system) which is based on south-oriented (or south-facing) transverse mercator (TMSO). The EPSG codes for these are:

  • odd numbers from 22275 to 22293 for the Cape datum
  • all numbers from 2046 to 2055 for the Hartebeesthoek94 or WGS84 datum.

If you have data in one of these south-oriented CRSs it will draw upside down and back to front in its native CRS but if you have on-the-fly transformation enabled, your layers will overlay your other data perfectly in whatever project CRS you choose. This feature request will result south-oriented coordinates and visualisation being more intutitive to GIS users.

Note on datums: Although there are a few metres difference between the WGS84 and Hartebeethoek94 datums, for all intents and purpos

#title credit serviceUrl yOriginTop zmin zmax
za-ngi-aerial State Copyright © Chief Directorate: National Geo-spatial Information https://aerial.openstreetmap.org.za/ngi-aerial/{z}/{x}/{y}.jpg 1 0 22
za-ngi-aerial-overlay State Copyright © Chief Directorate: National Geo-spatial Information https://aerial.openstreetmap.org.za/ngi-aerial-overlay/{z}/{x}/{y}.png 1 0 22
za-ngi-topo-50k State Copyright © Chief Directorate: National Geo-spatial Information https://htonl.dev.openstreetmap.org/ngi-tiles/tiles/50k/{z}/{x}/{y}.png 0 4 15
za-ngi-topo-250k State Copyright © Chief Directorate: National Geo-spatial Information https://htonl.dev.openstreetmap.org/ngi-tiles/tiles/250k/{z}/{x}/{y}.png 0 4 12
@Firefishy
Firefishy / sysctl-tune.conf
Created March 23, 2017 17:57
Safe sysctl tuning for modern high traffic systems
# Enable Packetization Layer Path MTU Discovery.
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_base_mss = 1024
# Ensure slow start is disabled
# https://github.com/ton31337/tools/wiki/tcp_slow_start_after_idle---tcp_no_metrics_save-performance
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_no_metrics_save = 0
# Tune network buffers - servers have more than 16MB of RAM in 2017
#!/bin/bash
set -e
JAVA_HOME=${1-text}
[ $# -eq 0 ] && { echo "Usage: sudo $0 \$(/usr/libexec/java_home -v '1.8*')" ; exit 1; }
KEYSTORE=$JAVA_HOME/jre/lib/security/cacerts
wget https://letsencrypt.org/certs/letsencryptauthorityx1.der
wget https://letsencrypt.org/certs/letsencryptauthorityx2.der
@Firefishy
Firefishy / docker-osm-me.sh
Created March 26, 2016 19:54
Quickstart for OSM in Docker
#!/bin/bash
set -e
type docker >/dev/null 2>&1 || { echo >&2 "error: docker is required. See: https://docs.docker.com/engine/installation/linux/"; exit 1; }
type docker-compose >/dev/null 2>&1 || { echo >&2 "error: docker-compose is required. See: https://docs.docker.com/compose/install/"; exit 1; }
[ ! -d cgimap ] && git clone --branch add-docker --depth 1 https://github.com/Firefishy/cgimap.git;
[ ! -d openstreetmap-website ] && git clone --branch add-docker --depth 1 https://github.com/Firefishy/openstreetmap-website.git
(cd cgimap && docker build -t openstreetmap/cgimap .)
(cd openstreetmap-website && docker-compose run --rm app bundle exec rake db:migrate)
(cd openstreetmap-website && docker-compose up)
# remove environment; cd openstreetmap-website ; docker-compose down

Keybase proof

I hereby claim:

  • I am firefishy on github.
  • I am firefishy (https://keybase.io/firefishy) on keybase.
  • I have a public key ASDl3d4SDUHEeEPFoE8m4x-J_Cohq7ZYhDKZ0eAHHq8I_Ao

To claim this, I am signing this object:

// Based on java example: http://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html
// save as: URLConnectionReader.java
// compile using JDK: javac URLConnectionReader.java
// run: java URLConnectionReader
// good path: returns HTML
// bad path: throws an exception
import java.net.*;
import java.io.*;
@Firefishy
Firefishy / docker-compose.yml
Created October 8, 2020 19:02
Using docker to get latest btrfs-progs
version: "2"
services:
app:
build:
context: .
dockerfile: Dockerfile
devices:
# Which disk(s) to expose to docker...
- "/dev/md1:/dev/md1"
10
Errors Corrected by Total Correction Gigabytes Total
ECC rereads/ errors algorithm processed uncorrected
fast | delayed rewrites corrected invocations [10^9 bytes] errors
read: 888487 54220 122540 942707 54220 1788780.870 0
write: 1974923 2662 2666 1977585 2662 223280.255 0
verify: 487 17321 34884 17808 17321 133.236 0
Non-medium error count: 194
cd /path-to-dir/LUREF_NGL/; find . -type f -iname '*.tif' >input-files.txt
docker run -it --rm -v /path-to-dir/LUREF_NGL:/data osgeo/gdal:alpine-normal-v2.4.1 sh -l
(in docker) gdalbuildvrt -resolution highest -r nearest ANA_LUREF_NGL_DTM.vrt -input_file_list input-files.txt
# Rest not in docker...
gdaladdo -ro --config COMPRESS DEFLATE --config COMPRESS_OVERVIEW DEFLATE --config ZLEVEL 9 --config BIGTIFF_OVERVIEW IF_SAFER --config GDAL_TIFF_OVR_BLOCKSIZE 512 -r nearest ANA_LUREF_NGL_DTM.vrt 4 16 64 256 1024 4096
gdaldem hillshade ANA_LUREF_NGL_DTM.vrt lu_hillshade_2017.tif -co BIGTIFF=YES -co TILED=YES -co COMPRESS=DEFLATE -co GDAL_NUM_THREADS=ALL_CPUS -of GTiff -b 1 -z 1.0 -s 0.5 -az 315.0 -alt 45.0
gdaladdo -ro --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL --config BIGTIFF_OVERVIEW IF_SAFER --config GDAL_TIFF_OVR_BLOCKSIZE 512 -r average lu_hillshade_2017.tif 4 16 64 256 1024 4096
gdalwarp -t_srs epsg:3857 -r lanczos -multi -wo NUM_THREADS=ALL_CPUS A