<commit_before><commit_msg>wol: En-repo a little Wake-On-LAN script that I'm not actually even using any more<commit_after>/*
Trigger Wake-On-LAN based on an IPv6 address, assuming that it has the computer's MAC address encoded into it.
Parses out the MAC address by taking the appropriate octets and inverting one bit:
fc00:e968:6179::de52:7100 -> 00:1d:09:a9:31:9f
*/

int main(int argc,array(string) argv)
{
	if (argc<2) exit(0,"USAGE: pike wol ipv6_address\n");
	Stdio.UDP mainsock=Stdio.UDP();
	mainsock->bind(2017)->enable_broadcast(); //Port doesn't matter.
	foreach (argv[1..],string ip)
	{
		if (ip=="yosemite") ip="00:1e:37:d8:eb:36";
		array(int) addr=Protocols.IPv6.parse_addr(ip);
		string mac;
		if (addr)
		{
			addr[4]^=0x200;
			mac=sprintf("%@2c",addr[4..]); mac=mac[..2]+mac[5..];
		}
		else mac=(string)array_sscanf(ip,"%x:%x:%x:%x:%x:%x");
		mainsock->send("192.168.0.255",2017,"\xFF"*6+mac*16);
	}
}
{'fraction_non_alphanumeric': 0.18892508143322476, 'fraction_numerical': 0.0738327904451683, 'mean_word_length': 5.105960264900662, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '6211283', 'n_tokens_mistral': 428, 'n_tokens_neox': 381, 'n_words': 82}