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
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
Last active April 30, 2024 09:07
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@aortbals
aortbals / squash-and-merge-cli.md
Last active January 16, 2024 10:46
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
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.