User Tools

Site Tools


start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
start [2026/03/20 07:21] – [Disk performance tests] abeverleystart [2026/04/12 16:14] (current) abeverley
Line 96: Line 96:
  
 [[overlay|Using Overlay to extract data from OpenStreetMap]] [[overlay|Using Overlay to extract data from OpenStreetMap]]
 +
 +===== Quick and dirty string dumping in Perl =====
 +
 +From https://blogs.perl.org/users/mauke/2026/04/quick-and-dirty-string-dumping.html
 +
 +A non-obvious feature of sprintf can help here: sprintf('%vd', $string) gives the decimal values of all code points in $string separated by dots. For example:
 +
 +  sprintf('%vd', "abc\n\a") is 97.98.99.10.7
 +  sprintf('%vd', "\xe2\x82\xac") is 226.130.172
 +  sprintf('%vd', "\x{20ac}") is 8364
 +
 +Don't like decimal character codes? Use hex instead:
 +
 +  sprintf('%vx', "abc\n\a") is 61.62.63.a.7
 +  sprintf('%vx', "\xe2\x82\xac") is e2.82.ac
 +  sprintf('%vx', "\x{20ac}") is 20ac
 +
 +Don't like dots? Use whatever separator you want:
 +
 +  sprintf('%*vd', '~', "abc\n\a") is 97~98~99~10~7
  
 ===== Using iptables and PHP to create a captive portal ===== ===== Using iptables and PHP to create a captive portal =====
start.txt · Last modified: by abeverley