Skip to content

Instantly share code, notes, and snippets.

@shigenobuokamoto
shigenobuokamoto / sandbox.wsb
Created August 14, 2024 00:32
IME setting for Windows Sandbox
<Configuration>
<VGpu>Enable</VGpu>
<MemoryInMB>6114</MemoryInMB>
<Networking>Enable</Networking>
<LogonCommand>
<Command>powershell -command "New-ItemProperty -LiteralPath 'HKCU:Software\Microsoft\IME\15.0\IMEJP\MSIME' -Name 'IsKeyAssignmentEnabled' -PropertyType 'DWord' -Value 1;New-ItemProperty -LiteralPath 'HKCU:Software\Microsoft\IME\15.0\IMEJP\MSIME' -Name 'KeyAssignmentHenkan' -PropertyType 'DWord' -Value 0;New-ItemProperty -LiteralPath 'HKCU:Software\Microsoft\IME\15.0\IMEJP\MSIME' -Name 'KeyAssignmentMuhenkan' -PropertyType 'DWord' -Value 1;New-ItemProperty -LiteralPath 'HKLM:SYSTEM\CurrentControlSet\Services\i8042prt\Parameters' -Name 'LayerDriver JPN' -PropertyType 'String' -Value 'kbd106.dll';New-ItemProperty -LiteralPath 'HKLM:SYSTEM\CurrentControlSet\Services\i8042prt\Parameters' -Name 'OverrideKeyboardIdentifier' -PropertyType 'String' -Value 'PCAT_106KEY';"</Command>
</LogonCommand>
</Configuration>
@shigenobuokamoto
shigenobuokamoto / for2.3.11-network-mirrored.service
Last active September 27, 2024 13:53
network-mirrored.service.2.3.11
[Unit]
Wants=network-pre.target
Before=network-pre.target shutdown.target
[Service]
User=root
ExecStart=/bin/sh -ec '\
[ -x /usr/bin/wslinfo ] && [ "$(/usr/bin/wslinfo --networking-mode)" = "mirrored" ] || exit 0;\
echo 1 > /proc/sys/net/ipv4/conf/all/route_localnet;\
nft add rule ip nat WSLPOSTROUTING "iif \"loopback0\" ip saddr 127.0.0.0/8 ip daddr != 127.0.0.0/8 counter masquerade comment mirrored"\
@shigenobuokamoto
shigenobuokamoto / wsl-persistent.service
Last active August 7, 2024 19:43
/etc/systemd/system/wsl-persistent.service
[Unit]
[Service]
ExecStart=/bin/sh -ec 'exec /mnt/c/windows/system32/waitfor.exe WSL$(date +%\\s)'
[Install]
WantedBy=multi-user.target
@shigenobuokamoto
shigenobuokamoto / network-mirrored.service
Last active November 14, 2024 12:14
/etc/systemd/system/network-mirrored.service
[Unit]
Wants=network-pre.target
Before=network-pre.target shutdown.target
[Service]
User=root
ExecStart=/bin/sh -ec '\
[ -x /usr/bin/wslinfo ] && [ "$(/usr/bin/wslinfo --networking-mode)" = "mirrored" ] || exit 0;\
echo "\
add chain ip nat WSLPREROUTING { type nat hook prerouting priority dstnat - 1; policy accept; };\