Skip to content

Instantly share code, notes, and snippets.

@sunnyyoung
Created August 10, 2022 02:29
Show Gist options
  • Save sunnyyoung/fdc8f9af981a643a7536118a9feebe5e to your computer and use it in GitHub Desktop.
Save sunnyyoung/fdc8f9af981a643a7536118a9feebe5e to your computer and use it in GitHub Desktop.
Raycast script command: Swap between IP string value and IP integer value.
#!/bin/bash
# @raycast.schemaVersion 1
# @raycast.title Swap IP
# @raycast.icon 🔢
# @raycast.mode fullOutput
# @raycast.argument1 { "type": "text", "placeholder": "IP Value" }
if [[ $1 =~ ^-?[0-9]+$ ]] ; then
echo $((($1 >> 24) & 0xFF)).$((($1 >> 16) & 0xFF)).$((($1 >> 8) & 0xFF)).$(($1 & 0xFF))
else
echo $((16#`printf '%02X' ${1//./ }`))
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment