Skip to content

Instantly share code, notes, and snippets.

@mast4461
mast4461 / local_scales.js
Last active July 21, 2022 13:57
Compute local scales in meters per degree, for use with WGS84 geocoordinates.
const turf = require("@turf/turf")
const points = {
"Bertilsvägen 7, containern": [17.583636, 59.855249],
"Granskogen": [17.570114, 59.864838],
"Skäggesta, korsningen": [17.552488, 59.872742],
"Hågahögen": [17.586869, 59.837368]
}
// A small value for the finite difference derivative approximation.
@mast4461
mast4461 / tampermonkey-wikipedia-userscript.js
Created November 29, 2021 14:48
Wikipedia layout improvement userscript
// ==UserScript==
// @name Wikipedia re-layout
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Add a reasonable max width to Wikipedia page content, with a handlebar on the right for adjustments.
// @author You
// @match https://en.wikipedia.org/*
// @icon https://www.google.com/s2/favicons?domain=wikipedia.org
// @grant none
// ==/UserScript==
@mast4461
mast4461 / coursera-playback-rate-hotkeys-tampermonkey.js
Created December 14, 2020 06:29
Video playback rate hotkeys for Coursera, through Tampermonkey
// ==UserScript==
// @name Coursera playback rate hotkeys
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Add button listeners to + and - keys for changing the video playback rate on Coursera
// @author You
// @match https://www.coursera.org/learn/*
// @grant none
// ==/UserScript==
@mast4461
mast4461 / .eslintrc.yml
Last active November 17, 2016 14:32 — forked from ghostwords/.eslintrc
YAML configuration for ESLint that turns off all* rules. Good starting point. *supposedly at least at the time of last update of the original gist
--- # Disable all rules. Rules at http://eslint.org/docs/rules/
ecmaFeatures:
arrowFunctions: false # enable arrow functions
binaryLiterals: false # enable binary literals
blockBindings: false # enable let and const (aka block bindings)
classes: false # enable classes
defaultParams: false # enable default function parameters
destructuring: false # enable destructuring
forOf: false # enable for-of loops
@mast4461
mast4461 / strnpowm.m
Last active August 29, 2015 14:14
Matlab code for computing large exponentials of the form n^m (n and m integers). Uses chars to store digits, for performance. Handles huge numbers, e.g. 2^1000. Returns the result as a string.
function str = strnpowm(base,exponent)
% Computes base^exponent (both integers) and returns the result as a string
% Handles huge numbers, e.g. 2^1000
str = char(1);
for i = 1:exponent
l = length(str);
product = repmat('0',1,l);
carry = 0;