Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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