<commit_before>@ECHO OFF
SETLOCAL
CLS

:: All praise BAT files
::
:: Kalabox Services Script.
::
:: Copyright (C) 2016 Kalabox Inc
::

:: Set out environment
SET VM=Kalabox2
SET VBOXMANAGE=%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe
SET KALABOX_DEFAULT_HOA=VirtualBox Host-Only Network

:: Get the Kalabox HOA
"%VBOXMANAGE%" showvminfo "%VM%" | FINDSTR /C:"Host-only Interface">%TEMP%\hoa.tmp
FOR /F "tokens=2 delims=," %%A IN ('TYPE "%TEMP%\hoa.tmp"') DO SET KALABOX_ATTACHMENT=%%A
FOR /F "tokens=2 delims='" %%A IN ("%KALABOX_ATTACHMENT%") DO SET KALABOX_VB_HOA=%%A
FOR /F "tokens=5 delims= " %%A IN ("%KALABOX_VB_HOA%") DO SET KALABOX_ADAPTER_ID=%%A

:: Append an ID to the HOA if needed
IF DEFINED KALABOX_ADAPTER_ID (SET KALABOX_WIN_HOA="%KALABOX_DEFAULT_HOA% %KALABOX_ADAPTER_ID%") ELSE (SET KALABOX_WIN_HOA="%KALABOX_DEFAULT_HOA%")

:: GEt the IP addrress assume
:: @todo: is it ok to assume the IP file is still here from the previous run of services.bat?
FOR /F %%A in ('TYPE "%TEMP%\ip.tmp"') DO (SET KALABOX_IP=%%A)
IF NOT DEFINED KALABOX_IP (SET KALABOX_IP=10.13.37.100)

:: We need to set these so that Windows does not use our DNS server as its primary
netsh interface ipv4 set interface %KALABOX_WIN_HOA% metric=9999
netsh interface ipv6 set interface %KALABOX_WIN_HOA% metric=9999

:: Set the Kalabox IP address into the Kalabox HOA
netsh interface ipv4 add dnsservers %KALABOX_WIN_HOA% %KALABOX_IP% validate=no index=1
ipconfig /flushdns

:: Report success if we get this far
EXIT /B 0<commit_msg>Update DNS Script<commit_after>@ECHO OFF
SETLOCAL
CLS

:: All praise BAT files
::
:: Kalabox Services Script.
::
:: Copyright (C) 2016 Kalabox Inc
::

:: Set out environment
SET KALABOX_DEFAULT_HOA=vEthernet (DockerNAT)
SET KALABOX_IP=127.0.0.1

:: Get the Kalabox HYPERV HOA
ipconfig | FINDSTR /C:"%KALABOX_DEFAULT_HOA%">%TEMP%\hoa.tmp
FOR /F "tokens=1 delims=:" %%A IN ('TYPE "%TEMP%\hoa.tmp"') DO SET KALABOX_HOA_TRIMMED=%%A
FOR /F "tokens=5 delims= " %%A IN ("%KALABOX_HOA_TRIMMED%") DO SET KALABOX_ADAPTER_ID=%%A

:: Append an ID to the HOA if needed
IF DEFINED KALABOX_ADAPTER_ID (SET KALABOX_WIN_HOA="%KALABOX_DEFAULT_HOA% %KALABOX_ADAPTER_ID%") ELSE (SET KALABOX_WIN_HOA="%KALABOX_DEFAULT_HOA%")

:: We need to set these so that Windows does not use our DNS server as its primary
netsh interface ipv4 set interface %KALABOX_WIN_HOA% metric=9999
netsh interface ipv6 set interface %KALABOX_WIN_HOA% metric=9999

:: Set the Kalabox IP address into the Kalabox HOA
netsh interface ipv4 add dnsservers %KALABOX_WIN_HOA% %KALABOX_IP% validate=no index=1
ipconfig /flushdns

:: Report success if we get this far
EXIT /B 0
{'fraction_non_alphanumeric': 0.11094282468761833, 'fraction_numerical': 0.020825444907232107, 'mean_word_length': 5.63819095477387, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2323601', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1057, 'n_words': 316}