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

import lombok.val;
import org.junit.Assert;
import org.junit.Test;
import java.lang.invoke.*;
/*
Your scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should.
Please don't actually do this... :P
@jarek-przygodzki
jarek-przygodzki / smartos.vbox.md
Created October 15, 2019 19:06 — forked from timkuijsten/smartos.vbox.md
SmartOS on VirtualBox

VirtualBox config

vbox host vboxnet0 = 192.168.56.1 (static, no dhcp)

vbox smartos guest config:

storage:

  • add ISO

audio:

  • disable
@jarek-przygodzki
jarek-przygodzki / create-smartos-vm.sh
Created October 14, 2019 17:37 — forked from twobitfool/create-smartos-vm.sh
Create a SmartOS VM in VirtualBox
#!/bin/sh
#
# Creates a SmartOS VM in VirtualBox (assuming you alread have VirtualBox installed)
#
# This script will:
# * Download the latest live ISO image of SmartOS
# * Create a VirtualBox VM, or update an existing VM with the latest ISO
# * Configure the VM with a zones disk, and boot it!
#
#
@jarek-przygodzki
jarek-przygodzki / jessfraz.md
Created April 20, 2018 06:06 — forked from acolyer/jessfraz.md
Containers, operating systems and other fun things from The Morning Paper
@jarek-przygodzki
jarek-przygodzki / linkns.sh
Last active March 22, 2018 21:07 — forked from yangyuqian/linkns.sh
Create symlinks for network namespaces inside docker containers
#!/bin/bash
# This simple script creates symlinks for network namespaces of docker containers,
# then you can interact to that network namespace with built-in iproute2 on linux.
# See iproute2 convention in: http://man7.org/linux/man-pages/man8/ip-netns.8.html
container_ids=`docker ps -aq`
for cid in $container_ids
do
= Arch Linux step-by-step installation =
= http://blog.fabio.mancinelli.me/2012/12/28/Arch_Linux_on_BTRFS.html =
== Boot the installation CD ==
== Create partition ==
cfdisk /dev/sda
* Create a partition with code 8300 (Linux)
@jarek-przygodzki
jarek-przygodzki / check_fdb.py
Created March 6, 2018 07:54 — forked from kleptog/check_fdb.py
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 = {}
@jarek-przygodzki
jarek-przygodzki / git-dirty-checks.md
Created March 4, 2018 20:16 — forked from sindresorhus/git-dirty-checks.md
Benchmark results of the fastest way to check if a git branch is dirty

Tested against the WebKit git repo by entering the repo with 1 file dirty.


git diff --quiet --ignore-submodules HEAD # Will tell if there are any uncomitted changes, staged or not.
0.6 sec

git diff-index --quiet HEAD # Only tracked
2 sec