Last active
April 3, 2024 08:13
-
-
Save dex4er/1330416 to your computer and use it in GitHub Desktop.
Revisions
-
dex4er revised this gist
Apr 3, 2024 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ # URL encoding by RFC 3986 (by line) perl -MURI::Escape -lpe '$_=uri_escape($_)' perl -MURI::Escape -lpe '$_=uri_unescape($_)' -
dex4er revised this gist
Jul 8, 2014 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,11 @@ # Test webserver plackup -e 'sub{[200,[],[Data::Dumper::Dumper@_]]}' # Fileserver plackup -MPlack::App::Directory -e 'Plack::App::Directory->new' # HTTP proxy (Starlight is the most stable server) starlight -MPlack::App::Proxy -e 'enable q{AccessLog};enable q{Proxy::Connect};enable q{Proxy::Requests};Plack::App::Proxy->new->to_app' # Serving cgi-bin scripts plackup -MPlack::App::CGIBin -e 'Plack::App::CGIBin->new(root=>".",exec_cb=>sub{1})->to_app' -
dex4er revised this gist
Jun 20, 2014 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ rlwrap -m -A -pgreen -S"perl> " perl -CS -w -MData::Dump -wnE'@_=eval;print"\033[0;33m";dd@_;print"\033[0;31m$@"if$@' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,5 +4,5 @@ plackup -e 'sub { [ 200, [], [Data::Dumper::Dump @_] ] }' # Fileserver plackup -MPlack::App::Directory -e 'Plack::App::Directory->new' # HTTP proxy (Starlight is the most stable server) starlight -MPlack::App::Proxy -e 'enable q{AccessLog}; enable q{Proxy::Connect}; enable q{Proxy::Requests}; Plack::App::Proxy->new->to_app' -
dex4er revised this gist
Jun 20, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ rlwrap -m -A -pgreen -S"perl> " perl -CS -w -MData::Dump -wnE'@a=eval;print"\033[0;33m";dd@a;print"\033[0;31m$@"if$@' -
dex4er revised this gist
Sep 10, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,5 +4,5 @@ plackup -e 'sub { [ 200, [], [Data::Dumper::Dump @_] ] }' # Fileserver plackup -MPlack::App::Directory -e 'Plack::App::Directory->new' # HTTP proxy (Starlet is the most stable server) plackup -s Starlet -MPlack::App::Proxy -e 'my $proxy = Plack::App::Proxy->new->to_app; sub { my $env = shift; $env->{"plack.proxy.url"} = $env->{REQUEST_URI}; $proxy->($env) }' -
dex4er revised this gist
Sep 7, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ # Normalize date perl -MPOSIX::strptime=strptime -MPOSIX=strftime -le '$f="%Y-%m-%d %H:%M:%S"; print strftime $f, strptime "2012-3-14 5:6:7", $f' -
dex4er revised this gist
Aug 29, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,5 +4,5 @@ plackup -e 'sub { [ 200, [], [Data::Dumper::Dump @_] ] }' # Fileserver plackup -MPlack::App::Directory -e 'Plack::App::Directory->new' # HTTP proxy (with Twiggy or Starlet) plackup -s Twiggy -MPlack::App::Proxy -e 'my $proxy = Plack::App::Proxy->new->to_app; sub { my $env = shift; $env->{"plack.proxy.url"} = $env->{REQUEST_URI}; $proxy->($env) }' -
dex4er renamed this gist
Aug 28, 2012 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ # Test webserver plackup -e 'sub { [ 200, [], [Data::Dumper::Dump @_] ] }' # Fileserver plackup -MPlack::App::Directory -e 'Plack::App::Directory->new' # HTTP proxy plackup -MPlack::App::Proxy -e 'my $proxy = Plack::App::Proxy->new->to_app; sub { my $env = shift; $env->{"plack.proxy.url"} = $env->{REQUEST_URI}; $proxy->($env) }' -
dex4er revised this gist
Aug 13, 2012 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,5 @@ # Simplest webserver plackup -MYAML::Syck --port 8080 -e 'sub { [ 200, [], [Dump \%ENV] ] }' # Simplest proxy plackup -MPlack::App::Proxy -e 'my $proxy = Plack::App::Proxy->new->to_app; sub { my $env = shift; $env->{"plack.proxy.url"} = $env->{REQUEST_URI}; $proxy->($env) }' -
dex4er revised this gist
Apr 26, 2012 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,3 +3,6 @@ perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)' < file # Decoding file perl -MMIME::Base64 -ne 'print decode_base64($_)' < file.b64 # HMAC-SHA1 perl -MDigest::HMAC_SHA1 -le '$_=Digest::HMAC_SHA1->new($ARGV[0])->add($ARGV[1])->b64digest; $_.="=" x length % 4; print' TestKey TestString -
dex4er revised this gist
Apr 6, 2012 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,14 +4,14 @@ perl -MEncode -ple '$_=encode "GSM0338", decode "UTF-8", $_; $l=length($_)*2; $l # Decode GSM 03.38 7-bit string to UTF-8 perl -MEncode -ple 's/^(..)//; $l = (hex($1)+2)*4; $b=unpack "b*", pack "H*", $_; $b=~s/(.{7})/$1./g; $b=substr $b, 0, $l; $b=substr $b, 0, int(length($b)/8)*8; $_=decode "GSM0338", pack "b*", $b;' # Encode UTF-8 string as ESTI GSM 03.38 IRA hex string perl -MEncode -ple '$_=uc unpack "H*", encode "GSM0338", decode "UTF-8", $_' # Decode ESTI GSM 03.38 to UTF-8 IRA hex string perl -MEncode -ple '$_=encode "UTF-8", decode "GSM0338", pack "H*", $_' # Encode UTF-8 as UCS2-LE IRA hex string perl -MEncode -ple '$_=uc unpack "H*", pack "n*", unpack "v*", encode "UCS-2LE", decode "UTF-8", $_' # Decode UCS2-LE IRA hex string to UTF-8 perl -MEncode -ple '$_=encode "UTF-8", decode "UCS-2LE", pack "v*", unpack "n*", pack "H*", $_' -
dex4er revised this gist
Jan 30, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ # Simplest webserver plackup -MYAML::Syck --port 8080 -e 'sub { [ 200, [], [Dump \%ENV] ] }' -
dex4er revised this gist
Jan 30, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ # Simplest webserver $ plackup -MYAML::Syck --port 8080 -e 'sub { [ 200, [], [Dump \%ENV] ] }' -
dex4er revised this gist
Jan 20, 2012 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ # Encoding file perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)' < file # Decoding file perl -MMIME::Base64 -ne 'print decode_base64($_)' < file.b64 -
dex4er revised this gist
Nov 30, 2011 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ # Assemble regexp from list of strings perl -MRegexp::Assemble -pe 'BEGIN { $r=Regexp::Assemble->new }; $r->add($_); undef $_; END { print $r->re, "\n" }' -
dex4er revised this gist
Nov 30, 2011 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,13 +5,13 @@ perl -MEncode -ple '$_=encode "GSM0338", decode "UTF-8", $_; $l=length($_)*2; $l perl -MEncode -ple 's/^(..)//; $l = (hex($1)+2)*4; $b=unpack "b*", pack "H*", $_; $b=~s/(.{7})/$1./g; $b=substr $b, 0, $l; $b=substr $b, 0, int(length($b)/8)*8; $_=decode "GSM0338", pack "b*", $b;' # Encode UTF-8 as ESTI GSM 03.38 IRA string perl -MEncode -ple '$_=uc unpack "H*", encode "GSM0338", decode "UTF-8", $_' # Decode ESTI GSM 03.38 to UTF-8 IRA string perl -MEncode -ple '$_=encode "UTF-8", decode "GSM0338", pack "H*", $_' # Encode UTF-8 as UCS2-LE IRA string perl -MEncode -ple '$_=uc unpack "H*", pack "n*", unpack "v*", encode "UCS-2LE", decode "UTF-8", $_' # Decode UCS2-LE IRA string to UTF-8 perl -MEncode -ple '$_=encode "UTF-8", decode "UCS-2LE", pack "v*", unpack "n*", pack "H*", $_' -
dex4er revised this gist
Nov 30, 2011 . 1 changed file with 15 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,17 @@ # Encode UTF-8 string as GSM 03.38 7-bit string perl -MEncode -ple '$_=encode "GSM0338", decode "UTF-8", $_; $l=length($_)*2; $l -= $l>6 ? int($l/8) : 0; $b=unpack "b*", $_; $b=~s/(.{7})./$1/g; $_=sprintf "%02X%s", $l, uc unpack "H*", pack "b*", $b' # Decode GSM 03.38 7-bit string to UTF-8 perl -MEncode -ple 's/^(..)//; $l = (hex($1)+2)*4; $b=unpack "b*", pack "H*", $_; $b=~s/(.{7})/$1./g; $b=substr $b, 0, $l; $b=substr $b, 0, int(length($b)/8)*8; $_=decode "GSM0338", pack "b*", $b;' # Encode UTF-8 as ESTI GSM 03.38 IRA string perl -MEncode -ple '$_=unpack "H*", encode "GSM0338", decode "UTF-8", $_' # Decode ESTI GSM 03.38 to UTF-8 IRA string perl -MEncode -ple '$_=encode "UTF-8", decode "GSM0338", pack "H*", $_' # Encode UTF-8 as UCS2-LE IRA string perl -MEncode -ple '$_=unpack "H*", pack "n*", unpack "v*", encode "UCS-2LE", decode "UTF-8", $_' # Decode UCS2-LE IRA string to UTF-8 perl -MEncode -ple '$_=encode "UTF-8", decode "UCS-2LE", pack "v*", unpack "n*", pack "H*", $_' -
dex4er revised this gist
Nov 29, 2011 . 3 changed files with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,4 +2,4 @@ perl -MJSON -ple '$_=encode_json eval $_' # JSON 2 Perl perl -MJSON::PP -MJSON::Syck=Load -MData::Dumper -pe '$_=Dumper(Load(encode_json(JSON::PP->new->relaxed->allow_barekey->decode($_))));' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ perl -ple '$l=length($_)*2; $l -= $l>6 ? int($l/8) : 0; $b=unpack("b*", $_); $b=~s/(.{7})./$1/g; $_=sprintf "%02X%s", $l, uc unpack("H*", pack("b*", $b))' # Encode UTF-8 as ESTI GSM 03.38 perl -MEncode -pe '$_=encode("gsm0338", $_)' # Decode ESTI GSM 03.38 to UTF-8 perl -MEncode -pe '$_=decode("gsm0338", $_)' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ # URL encoding by RFC 3986 (by line) perl -MURI::Escape -pe '$_=uri_escape($_)' perl -MURI::Escape -pe '$_=uri_unescape($_)' -
dex4er revised this gist
Nov 29, 2011 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,8 @@ # Encode ASCII string as GSM 7bit string (without charmap conversion) perl -ple '$l=length($_)*2; $l -= $l>6 ? int($l/8) : 0; $b=unpack("b*", $_); $b=~s/(.{7})./$1/g; $_=sprintf "%02X%s", $l, uc unpack("H*", pack("b*", $b))' # Encode UTF-8 as ESTI GSM 03.38 perl -MEncode -pi -e '$_=encode("gsm0338", $_)' # Decode ESTI GSM 03.38 to UTF-8 perl -MEncode -pi -e '$_=decode("gsm0338", $_)' -
dex4er revised this gist
Nov 23, 2011 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,9 @@ perl -MXML::Compile::Schema -le '$r=shift @ARGV; $s=XML::Compile::Schema->new; $ # XSD 2 example YAML perl -MYAML -MXML::Compile::Schema -le '$r=shift @ARGV; $s=XML::Compile::Schema->new; $s->importDefinitions($_) for @ARGV; print Dump eval $s->template("PERL", $r, show=>"ALL")' # XML to YAML perl -MYAML -MXML::Compile::Schema -MXML::Compile::Util=type_of_node -le '$x=XML::LibXML->new->parse_fh(\*STDIN); $r=$x->documentElement; print Dump (XML::Compile::Schema->new(\@ARGV)->compile(READER=>type_of_node($r), sloppy_integers=>1, sloppy_floats=>1)->($r));' *.xsd < file.xml # YAML to XML perl -MYAML=LoadFile,Dump -MXML::Compile::Schema -le '$d=LoadFile(shift @ARGV); $r=shift @ARGV; $x=XML::LibXML::Document->new("1.0", "UTF-8"); $x=XML::Compile::Schema->new(\@ARGV)->compile(WRITER => $r)->($x, $d); print $x->toString(1)' file.yml '{http://some.name.space/}rootTag' *.xsd -
dex4er revised this gist
Nov 23, 2011 . 1 changed file with 9 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,15 @@ perl -MXML::Twig -MText::Wrap -e 'package Text::Wrap; $columns=78; $huge="overfl perl -MXML::Twig -MText::Wrap -e 'package Text::Wrap; $columns=78; $huge="overflow"; XML::Twig->new(pretty_print=>"indented_a")->parse(\*STDIN)->print;' # XSD 2 example XML perl -MXML::Compile::Schema -le '$r=shift @ARGV; $s=XML::Compile::Schema->new; $s->importDefinitions($_) for @ARGV; print $s->template("XML", $r, show=>"ALL")' '{http://some.name.space/}rootTag' *.xsd # XSD 2 example YAML perl -MYAML -MXML::Compile::Schema -le '$r=shift @ARGV; $s=XML::Compile::Schema->new; $s->importDefinitions($_) for @ARGV; print Dump eval $s->template("PERL", $r, show=>"ALL")' # YAML to XML perl -MYAML=LoadFile,Dump -MXML::Compile::Schema -le '$d=LoadFile(shift @ARGV); $r=shift @ARGV; $x=XML::LibXML::Document->new("1.0", "UTF-8"); $x=XML::Compile::Schema->new(\@ARGV)->compile(WRITER => $r)->($x, $d); print $x->toString(1)' file.yml '{http://some.name.space/}rootTag' *.xsd # YAML to XML where data are inside hash key perl -MYAML=LoadFile,Dump -MXML::Compile::Schema -le '$d=LoadFile(shift @ARGV); $r=shift @ARGV; ($a=$r)=~s/{.*}//; $x=XML::LibXML::Document->new("1.0", "UTF-8"); $x=XML::Compile::Schema->new(\@ARGV)->compile(WRITER => $r)->($x, $d->{$a}); print $x->toString(1)' file.yml '{http://some.name.space/}action' *.xsd -
dex4er revised this gist
Nov 22, 2011 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,3 +7,6 @@ perl -MXML::Twig -MText::Wrap -e 'package Text::Wrap; $columns=78; $huge="overfl # XSD 2 example XML # Arguments: '{http://some.name.space/}rootTag' *.xsd perl -MXML::Compile::Schema -le '$r=shift @ARGV; $s=XML::Compile::Schema->new; $s->importDefinitions($_) for @ARGV; print $s->template("XML", $r, show=>"ALL")' # XSD 2 example YAML perl -MYAML -MXML::Compile::Schema -le '$r=shift @ARGV; $s=XML::Compile::Schema->new; $s->importDefinitions($_) for @ARGV; print Dump eval $s->template("PERL", $r, show=>"ALL")' -
dex4er revised this gist
Nov 22, 2011 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,9 @@ # Pretty printing in compact form perl -MXML::Twig -MText::Wrap -e 'package Text::Wrap; $columns=78; $huge="overflow"; XML::Twig->new(pretty_print=>"indented_c")->parse(\*STDIN)->print;' # Pretty printing with attributes in separate lines (VCS-friendly) perl -MXML::Twig -MText::Wrap -e 'package Text::Wrap; $columns=78; $huge="overflow"; XML::Twig->new(pretty_print=>"indented_a")->parse(\*STDIN)->print;' # XSD 2 example XML # Arguments: '{http://some.name.space/}rootTag' *.xsd perl -MXML::Compile::Schema -le '$r=shift @ARGV; $s=XML::Compile::Schema->new; $s->importDefinitions($_) for @ARGV; print $s->template("XML", $r, show=>"ALL")' -
dex4er revised this gist
Nov 21, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ # Encode ASCII string as GSM 7bit string (without charmap conversion) perl -ple '$l=length($_)*2; $l -= $l>6 ? int($l/8) : 0; $b=unpack("b*", $_); $b=~s/(.{7})./$1/g; $_=sprintf "%02X%s", $l, uc unpack("H*", pack("b*", $b))' -
dex4er revised this gist
Nov 21, 2011 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ # Encode ASCII string as GSM 7bit string (without charmap conversion) perl -ple 'chomp; $l=length($_)*2; $l-=$l>6?int($l/8):0; $b=unpack("b*",$_); $b=~s/(.{7})./$1/g; $_=sprintf "%02X%s", $l, uc unpack("H*", pack("b*", $b))' -
dex4er revised this gist
Nov 18, 2011 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # Pretty printing in compact form perl -MXML::Twig -MText::Wrap -e 'package Text::Wrap; $columns=78; $huge="overflow"; XML::Twig->new(pretty_print=>"indented_c")->parse(\*STDIN)->print;' # Pretty printing with attributes in separate lines perl -MXML::Twig -MText::Wrap -e 'package Text::Wrap; $columns=78; $huge="overflow"; XML::Twig->new(pretty_print=>"indented_a")->parse(\*STDIN)->print;' -
dex4er revised this gist
Nov 18, 2011 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ # Pretty printing in compact form perl -MXML::Twig -MText::Wrap -e 'XML::Twig->new(pretty_print=>"indented_c")->parse(\*STDIN)->print;' # Pretty printing with attributes in separate lines perl -MXML::Twig -MText::Wrap -e 'XML::Twig->new(pretty_print=>"indented_a")->parse(\*STDIN)->print;' -
dex4er revised this gist
Nov 18, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,4 +2,4 @@ perl -MJSON -ple '$_=encode_json eval $_' # JSON 2 Perl perl -MJSON::PP -MJSON::Syck=Load -MData::Dumper -ple '$_=Dumper(Load(encode_json(JSON::PP->new->relaxed->allow_barekey->decode($_))));' -
dex4er revised this gist
Nov 18, 2011 . 2 changed files with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ # Perl 2 JSON perl -MJSON -ple '$_=encode_json eval $_' # JSON 2 Perl perl -MJSON::PP -MJSON::Syck -MData::Dumper -ple '$_=Dumper(JSON::Syck::Load(JSON::PP->new->encode(JSON::PP->new->relaxed->allow_barekey->decode($_))));' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ # URL encoding by RFC 3986 (by line) perl -MURI::Escape -ple '$_=uri_escape($_)' perl -MURI::Escape -ple '$_=uri_unescape($_)' -
dex4er revised this gist
Nov 18, 2011 . 2 changed files with 2 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ # MD5 checksum (whole file) perl -MDigest::Perl::MD5=md5_hex -le 'undef $/; $_=<STDIN>; print md5_hex($_)' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +0,0 @@
NewerOlder