Skip to content

Instantly share code, notes, and snippets.

View Shterneregen's full-sized avatar
:octocat:

Iurii Sergeev Shterneregen

:octocat:
View GitHub Profile
@Shterneregen
Shterneregen / WakeOnLanService.kt
Last active July 7, 2022 22:14
Wake On Lan using Kotlin by sending magic packet
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
import random.telegramhomebot.utils.logger
import java.net.DatagramPacket
import java.net.DatagramSocket
import java.net.InetAddress
/**
* The magic packet is a frame that is most often sent as a broadcast and that contains anywhere within its payload
* 6 bytes of all 255 (FF FF FF FF FF FF in hexadecimal), followed by sixteen repetitions of the target computer's
@Shterneregen
Shterneregen / CreateScheduledTask.ps1
Last active April 19, 2024 06:37
Windows task to update Cisco AnyConnect InterfaceMetric to help with internet connectivity porblem with running VPN. After the first launch, the task will automatically start when you turn on the VPN
# - Create CreateScheduledTask.ps1 file with content below.
# - Run as admin command in PowerShell:
# Get-Content .\CreateScheduledTask.ps1 | PowerShell.exe -noprofile -
# - Restart Windows
# - Launch WSL
# - Launch VPN
# - Done! Metric automatically updated
$taskname="Fix VPN for WSL"
$scriptName = "UpdateAnyConnectInterfaceMetric.ps1"