You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
581 B
Python

#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Generate RFC 4193 ULA Locally Assigned Address Block /56
# @raycast.mode silent
# @raycast.packageName Developer Utilities
# Optional parameters:
# @raycast.icon 💻
import os, binascii, subprocess
prefix = "fd" + binascii.b2a_hex( os.urandom( 6 ) ).decode( "utf-8" ) + "00"
prefix = prefix[ 0:4 ] + ":" + prefix[ 4:8 ] + ":" + prefix[ 8:12 ] + ":" + prefix[ 12:16 ] + "::/56"
subprocess.run( [ "/usr/bin/pbcopy" ], input = prefix.encode( "utf-8" ) )
print( prefix )