Skip to content

Instantly share code, notes, and snippets.

View jarek-przygodzki's full-sized avatar

Jarek Przygódzki jarek-przygodzki

View GitHub Profile

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

Fibers

Fibers are an abstraction over sequential computation, similar to threads but at a higher level. There are two ways to think about this model: by example, and abstractly from first principles. We'll start with the example.

(credit here is very much due to Fabio Labella, who's incredible Scala World talk describes these ideas far better than I can)

Callback Sequentialization

Consider the following three functions

@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active April 26, 2024 03:07
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@sliekens
sliekens / eolconfig.ps1
Last active October 7, 2021 11:58
Configure Git line normalization the right way (using PowerShell)
# first install Git 2.16+
# https://git-scm.com/download/win
git --version
# (optional) reset machine settings because per-machine config makes no sense in team projects
# the default (when not set) for core.autocrlf is false (no eol conversions)
git config --unset core.autocrlf
git config --unset core.safecrlf
git config --unset core.eol
@AJNOURI
AJNOURI / Home-Rancher-vbox.sh
Last active December 29, 2022 16:19
Start your own Rancher cluster home lab with RancherOS virtualbox nodes.
### Launch Rancher container
$ docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable
# v2
sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
### Start 2 Virtualbox VMs with RancherOS
$ docker-machine create -d virtualbox --virtualbox-boot2docker-url https://github.com/rancher/os/releases/download/v1.3.0/rancheros.iso rancheros1
$ docker-machine create -d virtualbox --virtualbox-boot2docker-url https://github.com/rancher/os/releases/download/v1.3.0/rancheros.iso rancheros2
@delitescere
delitescere / pwned-passwd.sh
Last active April 10, 2018 04:04
Check a pwned password from the macOS / bash command line
pwned-passwd ()
{
history -d $((HISTCMD - 1));
sha=$(printf $1 | sha1sum | cut -d' ' -f1 | tr [:lower:] [:upper:]);
prefix=${sha:0:5};
suffix=${sha:5};
count=$(curl -Ss https://api.pwnedpasswords.com/range/$prefix | grep $suffix | cut -d':' -f2);
[ -n "$count" ] && echo $count >&2 && return 1;
return 0;
@acolyer
acolyer / jessfraz.md
Created November 19, 2017 13:39
Containers, operating systems and other fun things from The Morning Paper
@kleptog
kleptog / check_fdb.py
Last active March 6, 2018 07:54
Script to check Docker Swarm fdb
#!/usr/bin/python
from subprocess import check_output as run
import glob
# Get nodes
nodes = run(['docker', 'node', 'ls', '-q']).split()
self = run(['docker', 'node', 'inspect', 'self', '--format={{.ID}}']).strip()
nodeinfo = {}
@jessfraz
jessfraz / boxstarter.ps1
Last active April 11, 2024 16:02
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@alexellis
alexellis / k8s-pi.md
Last active April 11, 2024 14:17
K8s on Raspbian