Skip to content

Instantly share code, notes, and snippets.

View MilesMcBain's full-sized avatar

Miles McBain MilesMcBain

View GitHub Profile
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution.md
Last active May 29, 2025 14:20
Fix DNS resolution in WSL2

Permanent WSL DNS Fix (WSL 2.2.1+)

If you're encountering ping github.com failing inside WSL with a Temporary failure in name resolution, you're not alone — this has been a long-standing issue, especially when using VPNs or corporate networks.

This issue is now fixed robustly with DNS tunneling, which preserves dynamic DNS behavior and avoids limitations like WSL’s former hard cap of 3 DNS servers in /etc/resolv.conf.

DNS tunneling is enabled by default in WSL version 2.2.1 and later, meaning that if you're still seeing DNS resolution issues, the first and most effective fix is simply to upgrade WSL. Upgrading WSL updates the WSL platform itself, but does not affect your installed Linux distributions, apps, or files.

To upgrade WSL, follow these steps,

library(tidyverse)
library(sf)
library(mapview)
library(furrr)
library(raster)
plan(multiprocess)
ex = extent(c(xmin=-112,xmax=155,ymin=-44,ymax=-10))
# This example simulates a stock price 1 time and 10k times.
# It uses a functional approach and a loop approach.
# A speed test is done at the end.
# This example for GBM ignores the fact that
# 1) There is an explicit solution to GBM where simulation isn't needed
# 2) Along the same lines, there is a vectorized form where pure matrix mult can be used.
# These are ignored for the sake of the example, because there are often cases
# where this isn't the case and you HAVE to do the discrete loop.
@jimjam-slam
jimjam-slam / rmd-snippets.json
Created February 22, 2018 23:15
Visual Studio Code snippets for working with RMarkdown files. Go to Configure User Snippets and drop it in.
{
// Snippets for talking to yourself
"TK (citation needed)": {
"prefix": "tkcite",
"body": "_(**TKTK** - citation needed)_",
"description": "Add a note to yourself to cite this later."
},
"TK": {
"prefix": "tktk",
"body": "_(**TKTK** - blah blah blah)_",
@hofmannsven
hofmannsven / README.md
Created December 6, 2017 00:32
Increase key repeat rate on macOS

Increase key repeat rate on macOS

Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat

Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.

Source: https://apple.stackexchange.com/a/83923

@fernandojsg
fernandojsg / gltf_bookmarklet.js
Last active September 1, 2017 13:54
THREE.js and AFRAME glTF exporter bookmarklet
javascript:(function(){
var link = document.createElement( 'a' ); link.style.display = 'none'; document.body.appendChild( link );
function save( blob, filename ) { link.href = URL.createObjectURL( blob ); link.download = filename; link.click(); }
function saveString( text, filename ) { save( new Blob( [ text ], { type: 'application/json' } ), filename );}
var script=document.createElement('script');
script.src='https://threejs.org/examples/js/exporters/GLTFExporter.js';
script.onload = function () {
var exporter = new THREE.GLTFExporter();
@byronmejia
byronmejia / QUT Horizon Guide.md
Last active October 19, 2022 06:48
A QUT Student's guide to the Horizon (client).

VMware Horizon Client Tutorial

Sometimes, it's necessary to try and connect to the QUT computers as a student, whether it be for using certain proprietary software, certain environments, or beefier computers?

This guide assumes you are not on campus and require a VPN client (Virtual Private Network) to behave as if you are at QUT.

#devtools::install_github('rstudio/leaflet')
library(leaflet)
library(raster)
## fake a raster
r <- raster(volcano)
## this volcano is in NZ, but we are ignoring that with huge abandon
extent(r) <- extent(100, 150, -42, -15)
projection(r) <- "+init=epsg:4326"