From aac58a7e9dafc15a0a0736e11388e03867cd34ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 20 Jun 2009 00:03:18 +1000 Subject: [PATCH] add hex2bin filter for easy diff now you should do git config diff.bdf.textconv ./hex2bin.pl git config core.whitespace -trailing-space --- .gitattributes | 1 + hex2bin.pl | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .gitattributes create mode 100755 hex2bin.pl diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4e94306 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.bdf diff=bdf diff --git a/hex2bin.pl b/hex2bin.pl new file mode 100755 index 0000000..ff0082f --- /dev/null +++ b/hex2bin.pl @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +while (<>) { + if (m/^([0-9A-F]+)$/) { + $full = $&; + $t = $1; + $t =~ s/0/ /g; + $t =~ s/1/ ##/g; + $t =~ s/2/ ## /g; + $t =~ s/3/ ####/g; + $t =~ s/4/ ## /g; + $t =~ s/5/ ## ##/g; + $t =~ s/6/ #### /g; + $t =~ s/7/ ######/g; + $t =~ s/8/## /g; + $t =~ s/9/## ##/g; + $t =~ s/A/## ## /g; + $t =~ s/B/## ####/g; + $t =~ s/C/#### /g; + $t =~ s/D/#### ##/g; + $t =~ s/E/###### /g; + $t =~ s/F/########/g; + print "$full\t$t\n"; + } + else { + print $_; + } +} -- 2.11.4.GIT