Skip to content

Instantly share code, notes, and snippets.

@evanrelf
evanrelf / download
Created October 26, 2023 01:10
Offline Advent of Code
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'
if [ "$#" -ne 1 ]; then
echo "usage: ./download <year>" >&2
exit 1
fi
@willkurt
willkurt / prob_logic.ipynb
Last active September 16, 2021 17:25
Implementing probability as logic using Python's data model methods
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution.md
Last active June 9, 2025 17:07
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,

@aortbals
aortbals / squash-and-merge-cli.md
Last active March 6, 2025 18:54
Squash and Merge on the Command line

With the introduction of GitHub's Squash and Merge feature, this has become less prevelant, however it's still useful in scenarios where GitHub's interface is unavailable.

Let's talk through two ways to do a squash and merge on the command line.

Take 1: Interactive Rebase

When to use it

  • When you have not merged main into your feature branch
  • There are no merge conflicts
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NoraCodes
NoraCodes / pronouns.py
Last active February 24, 2019 03:18
An example of proper handling of pronoun replacement for, e.g., text games.
################################################################
# pronouns.py - Leonora Tindall
#
# An example of proper handling of pronoun replacement in
# Python, including a selection menu. This handles only
# singular pronouns, providing a simple .format() based
# interface for replacing pronouns in prose.
# This script is limited to English, but a similar technique
# should work for most languages using a similar grammar.
################################################################
@davidread
davidread / gist:0a34b59bffa86eb37812
Created December 11, 2015 20:53
Using Met Office weather open data on Azure Data Market
1. Register for Microsoft account at https://signup.live.com/signup
2. Email verification - click link (logs you in)
3. Register on Azure Data Market at https://datamarket.azure.com/register
4. Go to: https://datamarket.azure.com/dataset/datagovuk/metofficeweatheropendata click 'Sign up' then 'agree', then 'sign up'.
Use Web i/f to download CSV:
At: https://datamarket.azure.com/dataset/explore/0f2cba12-e5cf-4c6d-83c9-83114d44387a click 'Explore', 'Three Hourly Forecast' and 'Download Excel (CSV)'
or by API:
Go to: https://datamarket.azure.com/account for account key
@TomAugspurger
TomAugspurger / to_redshift.py
Last active September 16, 2021 16:55
to_redshift.py
# see also https://github.com/wrobstory/pgshift
import gzip
from io import StringIO, BytesIO
from functools import wraps
import boto
from sqlalchemy import MetaData
from pandas import DataFrame
from pandas.io.sql import SQLTable, pandasSQL_builder
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.