Skip to content

Instantly share code, notes, and snippets.

View alecdotninja's full-sized avatar
🐶
𝓂❀𝓈𝓉𝓁𝓎™ fine

Alec Larsen alecdotninja

🐶
𝓂❀𝓈𝓉𝓁𝓎™ fine
View GitHub Profile
@alecdotninja
alecdotninja / IterableWeakMap.ts
Last active December 16, 2023 00:07
Iterable weak collections for TypeScript using WeakRef/FinalizationRegistry
import { IterableWeakSet } from "./IterableWeakSet";
export class IterableWeakMap<K extends WeakKey, V> {
readonly #keys = new IterableWeakSet<K>();
readonly #values = new WeakMap<K, V>();
constructor(iterable?: Iterable<[K, V]> | null) {
if (!iterable) {
return;
}

Keybase proof

I hereby claim:

  • I am alecdotninja on github.
  • I am alecdotninja (https://keybase.io/alecdotninja) on keybase.
  • I have a public key ASBfcHSbUgmOQ4_Sv9ElIRNU35h_Uzxj04DT0cRwR4XZAAo

To claim this, I am signing this object:

require 'socket'
require 'net/http'
# from linux/socket.h
Socket::PF_NETLINK = 16
Socket::NETLINK_ROUTE = 0
# listens for changes in ip addresses on all interfaces
SOCKADDR_NL_FOR_AF_NETLINK_AND_RTMGRP_IPV4_IFADDR =
"\u0010\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0010\u0000\u0000\u0000\u0000\u0000\u0000\u0000"