Skip to content

Instantly share code, notes, and snippets.

Created September 30, 2015 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d3304096ca1c4660ecd0 to your computer and use it in GitHub Desktop.
Save anonymous/d3304096ca1c4660ecd0 to your computer and use it in GitHub Desktop.
bind pub - .x hex:it
proc hex:it {n u h c t} {
set hexit [join [lrange [split [string trim $t]] 0 end]]; set out ""
if {$hexit eq ""} { putserv "privmsg $c :\00303$::lastbind <WHAT!>\003"; return }
foreach _ [split $hexit {}] {
lappend out [format "\\\u%04x" [scan $_ %c]]
}
putserv "privmsg $c :\002[join $out ""]\002"
putserv "privmsg $c :[hexor $hexit]"
return 0
}
proc hexor {str} {
set out ""
foreach _ [split $str {}] {
binary scan $_ H* hexor
lappend out $hexor
}
return "\002\\\x[join $out "\\\x"]\002"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment