Skip to content

Instantly share code, notes, and snippets.

@ArrEssJay
ArrEssJay / Android.mk
Last active December 24, 2015 13:29
Android.mk NDK makefile to build a simple command-line app linked against a static or shared library Compiler options would suit arm v7a only (eg. Cortex A8). See the NDK doco.
# build executable linked against static lib using NDK
# Usage: <NDK_Location>/ndk-build NDK_PROJECT_PATH=./ NDK_APPLICATION_MK=./Android.mk
# (Assuming 'pwd' is your native code location)
LOCAL_PATH := $(call my-dir)
#prebuilt static library
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_SRC_FILES := foo.a
@ArrEssJay
ArrEssJay / CaseInsensitiveManager.py
Last active August 29, 2015 13:56
Django manager for case-insensitive duplicate checking
#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)
@ArrEssJay
ArrEssJay / nsw_utm.js
Last active February 12, 2016 00:18
NSW 6-figure abbreviated UTM grid reference to 1:25k map sheet. Handles AGD66 and MGA94 datums.
//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 / env.conf
Last active April 22, 2018 07:59
ngrok / ngrok2 systemd script + config
# /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 / xorg.conf
Last active November 23, 2023 13:57
xorg.conf for 4 NVIDIA GTX1080i GPU, fake monitor, headless arrangement
# 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 / setfanspeed.sh
Last active September 20, 2017 02:57
Set NVIDIA fan speed under fake X server
# 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 / cleanupMEBankCSV.py
Last active May 17, 2018 23:20
Cleanup MEBank (AU) transaction export CSV files.
#!/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 / survex.rb
Last active August 15, 2018 00:47
Survex Homebrew Formula
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 / randGrid.py
Created October 7, 2019 00:50
QGIS Geometry generator example - Random polygon grid fill (generates a multipoint geometry)
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 / aspect.qml
Created October 7, 2019 03:15
QGIS Slope-Aspect Map (Aspect)
<!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"/>