m (Code)
m (Code)
Line 12: Line 12:
 
# [[putInDir]] — to move files inside directories bearing their name.
 
# [[putInDir]] — to move files inside directories bearing their name.
 
# [[uniqname]] — to generate a timestamp which can be used as a unique name.
 
# [[uniqname]] — to generate a timestamp which can be used as a unique name.
 +
 +
== Pattern substitutions ==
 +
 +
See [http://www.cs.tut.fi/~jkorpela/perl/regexp.html Jukka “Yucca” Korpela]'s cheatsheet for regexps ([[Media:Regular_expressions_in_Perl_-_a_summary_with_examples.war|archived]])
 +
 +
=== Replace comma-separated digits by their point-separated counterpart ===
 +
 +
E.g, 123,45 → 123.45. To change in all ''.dat'' files:
 +
 +
<code lang='bash'>perl -pi -w -e 's/(\d+),(\d+)/$1\.$2/g;' *dat</code>
  
 
== Pretty print ==
 
== Pretty print ==
  
 
We use [http://www.mediawiki.org/wiki/User:Gri6507 Paul Grinberg]'s [http://www.mediawiki.org/wiki/Extension:Code Code extension] for [[Mediawiki]] to pretty-print source through [http://qbnz.com/highlighter/ GeSHi] on our web.
 
We use [http://www.mediawiki.org/wiki/User:Gri6507 Paul Grinberg]'s [http://www.mediawiki.org/wiki/Extension:Code Code extension] for [[Mediawiki]] to pretty-print source through [http://qbnz.com/highlighter/ GeSHi] on our web.

Revision as of 15:33, 19 September 2012

{{{1}}}

Contents

Code

This page is still largely in progress.

This is a list of code we make available with no guarantee, beside the one that it did once work for its intended purpose.

Beware, version below one (e.g., v°0.1) are $\beta$-version. It might be that's all you find here.

  1. stampit — to stamp pdf files after their name.
  2. sanitize — to remove accents & special characters from filenames.
  3. putInDir — to move files inside directories bearing their name.
  4. uniqname — to generate a timestamp which can be used as a unique name.

Pattern substitutions

See Jukka “Yucca” Korpela's cheatsheet for regexps (archived)

Replace comma-separated digits by their point-separated counterpart

E.g, 123,45 → 123.45. To change in all .dat files:

perl -pi -w -e 's/(\d+),(\d+)/$1\.$2/g;' *dat

Pretty print

We use Paul Grinberg's Code extension for Mediawiki to pretty-print source through GeSHi on our web.