Skip to content

Instantly share code, notes, and snippets.

WSL 2 Cisco AnyConnect Networking Workaround

Overview

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277

Below outline steps to automatically configure the Interface metric on VPN connect and update DNS settings (/etc/resolv.conf) on connect/disconnect.

Manual Configuration

Set Interface Metrics

@jkjung-avt
jkjung-avt / data_generator.py
Created August 31, 2018 12:14
An example multiprocessing-ready data generator for Keras, taken from https://stanford.edu/~shervine/blog/keras-how-to-generate-data-on-the-fly
import numpy as np
import keras
class DataGenerator(keras.utils.Sequence):
'Generates data for Keras'
def __init__(self, list_IDs, labels, batch_size=32, dim=(32,32,32), n_channels=1,
n_classes=10, shuffle=True):
'Initialization'
self.dim = dim
self.batch_size = batch_size
@danni
danni / migration_loaddata.py
Last active November 16, 2023 08:28 — forked from leifdenby/migration_loaddata.py
Django function for loading fixtures which use the current migration state of the model
import os
import logging
from django.core import serializers
LOGGER = logging.getLogger(__name__)
def load_fixture(app, fixture, ignorenonexistent=True):
"""