Skip to content

Instantly share code, notes, and snippets.

@ArrEssJay
ArrEssJay / slope.qml
Created Oct 7, 2019
QGIS Slope-Aspect Map (Slope)
View slope.qml
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis styleCategories="AllStyleCategories" minScale="1e+08" hasScaleBasedVisibilityFlag="0" version="3.8.0-Zanzibar" maxScale="0">
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
</flags>
<customproperties>
<property value="false" key="WMSBackgroundLayer"/>
<property value="false" key="WMSPublishDataSourceUrl"/>
@ArrEssJay
ArrEssJay / aspect.qml
Created Oct 7, 2019
QGIS Slope-Aspect Map (Aspect)
View aspect.qml
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis styleCategories="AllStyleCategories" minScale="1e+08" hasScaleBasedVisibilityFlag="0" version="3.8.0-Zanzibar" maxScale="0">
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
</flags>
<customproperties>
<property value="false" key="WMSBackgroundLayer"/>
<property value="false" key="WMSPublishDataSourceUrl"/>
@ArrEssJay
ArrEssJay / randGrid.py
Created Oct 7, 2019
QGIS Geometry generator example - Random polygon grid fill (generates a multipoint geometry)
View randGrid.py
from qgis.core import *
from qgis.gui import *
import math
import random
"""
Define a grid based on the interval and the bounding box of
the feature. Grid will minimally cover the feature and be centre aligned
Create a multi-point geometry at the grid intersections where
@ArrEssJay
ArrEssJay / survex.rb
Last active Aug 15, 2018
Survex Homebrew Formula
View survex.rb
class Survex < Formula
desc "Cave Surveying Tool"
homepage "https://www.survex.com"
url "https://survex.com/software/1.2.36/survex-1.2.36.tar.gz"
sha256 "8781f33daf61c5d22e52400e6130e66a1fec7557cf9aa793d0e26e9b37204ed0"
revision 4
depends_on "wxmac"
depends_on "proj"
depends_on "ffmpeg"
@ArrEssJay
ArrEssJay / cleanupMEBankCSV.py
Last active May 17, 2018
Cleanup MEBank (AU) transaction export CSV files.
View cleanupMEBankCSV.py
#!/usr/local/bin/python3
import csv
import argparse
import sys
parser = argparse.ArgumentParser(description='Cleanup MEbank (AU) CSV files with descriptions split over multiple lines')
parser.add_argument('infile', nargs='?', type=argparse.FileType('r'), default=sys.stdin)
parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'), default=sys.stdout)
parser.add_argument('--invertorder', action='store_true')
@ArrEssJay
ArrEssJay / setfanspeed.sh
Last active Sep 20, 2017
Set NVIDIA fan speed under fake X server
View setfanspeed.sh
# This needs to be called from xinit
# See https://gist.github.com/RobDeBagel/0e126a56b0ee9f23551a98fb258414c
# Set fan speeds appropriately. The curve is tailored to my own environment
# Also set clock speeds
#!/bin/bash
setFanSpeed() {
eval "nvidia-settings -a [gpu:$2]/GPUFanControlState=1 -a [fan:$2]/GPUTargetFanSpeed=$1" > /dev/null
@ArrEssJay
ArrEssJay / xorg.conf
Last active May 22, 2021
xorg.conf for 4 NVIDIA GTX1080i GPU, fake monitor, headless arrangement
View xorg.conf
# Use this in a situation where you want a headless Linux box with multiple GPU boards but no desktop environment
# Fake EDID convinces drivers that a monitor is connected
# Use any EDID binary file
# To start a fake X server make a systemd file with something like:
# ExecStart=/usr/bin/tcsh -c 'xinit /opt/set-gpu-fans/setfanspeed.sh -- :0 -once -config /opt/set-gpu-fans/xorg.rob'
# See other gist for fan setting script : https://gist.github.com/RobDeBagel/a960c2b157256c162220e60300529cf0
Section "ServerLayout"
Identifier "Layout0"
@ArrEssJay
ArrEssJay / env.conf
Last active Apr 22, 2018
ngrok / ngrok2 systemd script + config
View env.conf
# /lib/systemd/system/ngrok.service.d/env.conf
[Service]
#which tunnel, or all?
Environment="TUNNEL=--all"
#log format
Environment="LOG_FORMAT=logfmt"
#log level
@ArrEssJay
ArrEssJay / nsw_utm.js
Last active Feb 12, 2016
NSW 6-figure abbreviated UTM grid reference to 1:25k map sheet. Handles AGD66 and MGA94 datums.
View nsw_utm.js
//requires esri leaflet, leaflet, proj4js
//fiddle at https://jsfiddle.net/a8aLj0nk/13
var map = L.map('map').setView([-34.00, 151.00], 9);
var position = 0;
var marker;
L.esri.tiledMapLayer("http://mapsq.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPITopoMap/MapServer", {
detectRetina: true,
reuseTiles: true
@ArrEssJay
ArrEssJay / CaseInsensitiveManager.py
Last active Aug 29, 2015
Django manager for case-insensitive duplicate checking
View CaseInsensitiveManager.py
#Based on https://gist.github.com/rtorr/3148833#
#Extended to take a list of fields to replace the query for
class CaseInsensitiveManager(models.Manager):
def __init__(self, fields=None, *args, **kwargs):
if fields != None:
self.fields = fields
super(CaseInsensitiveManager, self).__init__(*args, **kwargs)