Skip to content

Instantly share code, notes, and snippets.

View JamieWritesCode's full-sized avatar

Jamie Baker JamieWritesCode

View GitHub Profile
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution.md
Last active May 12, 2025 10:36
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,

@willvincent
willvincent / db_backup.sh
Last active October 19, 2017 12:59
Intended for use with cron. This script will backup all (or one specific) database, the specified user has access to on the given DB server, and remove backups older than the specified duration to keep them for. If no params are passed, defaults will be used. and backups created for _every_ database.
#!/bin/bash
USAGE="$0 [-u <user> -p <password> -h <host> -P <PORT> -d <database> -D <destination/directory/without/trailing/slash>]"
DESTINATION=`pwd`
USER=root
PASS=root
HOST=localhost
PORT=3306
# SPECIFY HOW LONG TO RETAIN BACKUPS
@mindplay-dk
mindplay-dk / jquery.order.js
Created October 4, 2013 12:52
jQuery plugin to sort/order a list of HTML elements (including lists, tables, any element type or structure)
/**
* Sort a list of elements and apply the order to the DOM.
*/
jQuery.fn.order = function(asc, fn) {
fn = fn || function (el) {
return $(el).text().replace(/^\s+|\s+$/g, '');
};
var T = asc !== false ? 1 : -1,
F = asc !== false ? -1 : 1;
this.sort(function (a, b) {