Skip to content

Instantly share code, notes, and snippets.

@mjstevens777
mjstevens777 / README.md
Last active October 18, 2024 18:41
CS:2 River Guide

CS:2 River Guide

Are you sick of rivers overflowing and flooding everything? Use this guide to understand how rivers work in Cities Skylines 2.

For a stream source, you can use the formula:

$Flow = 0.057 \times Area \times Grade$

For the most part, radius doesn't matter.

@mjstevens777
mjstevens777 / README.md
Last active March 20, 2024 22:03
BuildKit cache expiration behavior

Setup

Let's say we have a Dockerfile with 3 basic stages:

  • 3 base layers of an Ubuntu image. These basically never change.
  • 5 intermediate layers of installing apt/python dependencies. These only change when we want to update our packages.
  • 2 final layers of copying and building our source code. These change every build.

When we change our packages we create a new group of intermediate layers. Let's say that this is our scenario for when we change our packages:

group number number of builds description
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import SpectralClustering
# Download https://www.hindustantimes.com/static/iframes/language_probability_map/data.csv
df = pd.read_csv('data.csv', index_col=0)
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-addon: cluster-autoscaler.addons.k8s.io
k8s-app: cluster-autoscaler
name: cluster-autoscaler
namespace: kube-system
---
@mjstevens777
mjstevens777 / pytorch_bilinear_conv_transpose.py
Last active August 25, 2023 15:06
Conv Transpose 2d for Pytorch initialized with bilinear filter / kernel weights
"""
Copyright 2018 Matt Stevens. See license at end of file.
Defines the BilinearConvTranspose2d class.
"""
import torch
import torch.nn as nn
class BilinearConvTranspose2d(nn.ConvTranspose2d):
"""A conv transpose initialized to bilinear interpolation."""