source code of /small-scripts/index.html

Last modified
Lines 235

Parent directory Download CGIread sitemap Main page

Quick links: contact content footer navigation title

  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3.     <head>
  4.         <meta charset="utf-8"/>
  5.         <meta name="viewport" content="width=device-width, initial-scale=1"/>
  6.         <link rel="stylesheet" href="https://oskog97.com/style.css" type="text/css"/>
  7.         <link rel="icon" type="image/png" href="/favicon.png"/>
  8.         <link rel="canonical" href="https://oskog97.com/small-scripts/"/>
  9. <!-- End html5 macro. -->
  10. <!-- Included structured data -->
  11. <script type="application/ld+json">
  12. {
  13.     "@context":
  14.     {
  15.         "@vocab": "http://schema.org/"
  16.     },
  17.     "@type": "WebPage",
  18.     "url": "https://oskog97.com/small-scripts/",
  19.     "author": {
  20.         "@type": "Person",
  21.         "@id": "https://oskog97.com/",
  22.         "name": "Oskar Skog",
  23.         "url": "https://oskog97.com/"
  24.     },
  25.     "publisher": {"@id": "https://oskog97.com/"},
  26.     "copyrightHolder": {"@id": "https://oskog97.com/"},
  27.     "license": "http://creativecommons.org/licenses/by/4.0/",
  28.     "DateModified": "2022-12-12"
  29. }
  30. </script>
  31. <!-- End of included structured data-->
  32.         <title>Small scripts</title>
  33.         <meta name="description" content="Various poorly documented scripts
  34. in Python or Bourne shell."/>
  35.     </head>
  36.     <body>
  37.         
  38. <!-- BEGIN autogenerated navigation -->
  39. <nav><div id="navigation"><div id="nav_inner">
  40. <p><a href="#content" class="textonly">Skip navigation</a></p>
  41. <p class="row">
  42. <span class="textonly" translate="no">[</span><a class="head" href="/">Home</a><span class="textonly" translate="no">]</span>
  43. &gt;&gt;
  44. <span class="textonly" translate="no">[</span><a class="sub" href="/projects/anonymine/">Anonymine</a><span class="textonly" translate="no">]</span>
  45. <span class="textonly" translate="no">[</span><a class="sub" href="/projects/light-sensor/">Analog light sensor</a><span class="textonly" translate="no">]</span>
  46. <span class="textonly" translate="no">[</span><a class="sub" href="/projects/PLLM-M702A/">Reverse-engineered schematics for PLLM-M702A</a><span class="textonly" translate="no">]</span>
  47. <span class="textonly" translate="no">]</span><span class="sub active">Small scripts</span><span class="textonly" translate="no">[</span>
  48. <span class="textonly" translate="no">[</span><a class="sub" href="/thinkpad/">-&gt; My IBM thinkpad</a><span class="textonly" translate="no">]</span>
  49. </p>
  50. <p class="row">
  51. <span class="textonly" translate="no">]</span><span class="head active">Small scripts</span><span class="textonly" translate="no">[</span>
  52. &gt;&gt;
  53. <span class="textonly" translate="no">[</span><a class="sub" href="/read/">Website's scripts</a><span class="textonly" translate="no">]</span>
  54. </p>
  55. <p class="row">
  56. <span class="textonly" translate="no">[</span><a class="sub" href="/sitemap.py">Sitemap</a><span class="textonly" translate="no">]</span>
  57. </p>
  58. <hr class="textonly"/>
  59. </div></div></nav>
  60. <!-- END autogenerated navigation -->
  61.         <main><div id="content">
  62.             <h1 id="title">Small scripts</h1>
  63.             <h2>The scripts I'm most proud of</h2>
  64.             <dl>
  65.                 <dt>
  66.                     <a translate="no"
  67. href="/read/?path=/small-scripts/minify&amp;referer=/small-scripts/&amp;title=Small+scripts">
  68.                         minify.py
  69.                     </a> - Simple XHTML minifier
  70.                 </dt>
  71.                 <dd>
  72.                     <p>
  73.                         It reads from <code>stdin</code> and writes to
  74.                         <code>stdout</code>.  The reason I wrote this script
  75.                         was that the other HTML minifiers I used were
  76.                         over-optimizing the HTML, causing validation errors.
  77.                     </p>
  78.                     <p>
  79.                         I don't use this script any more, as my new design is
  80.                         based on static XHTML5 being served. (Lighttpd can
  81.                         compress static resources but not the output streams
  82.                         from CGI scripts.)
  83.                     </p>
  84.                 </dd>
  85.                 
  86.                 <dt>
  87.                     <a translate="no"
  88. href="/read/?path=/small-scripts/killbom&amp;referer=/small-scripts/&amp;title=Small+scripts">
  89.                         killbom
  90.                     </a> - Eliminate UTF-8 Byte Order Marks
  91.                 </dt>
  92.                 <dd>
  93.                     <p>
  94.                         This script removes all UTF-8 BOMs from all specified
  95.                         files. Even BOMs, that somehow got somewhere else than
  96.                         in the beginning of the file, are also removed.
  97.                     </p>
  98.                     <p><strong>
  99.                         This script SHOULD NOT be run on binary files due to
  100.                         its very literal operation.
  101.                     </strong></p>
  102.                     <blockquote>
  103. <pre>Usage: killbom [file] ...
  104. killbom removes all UTF-8 BOM marks from files.
  105. WARNING: It really removes all sequences of '\0xEF\0xBB\0xBF'.
  106. WARNING: It accepts no options. All arguments are treated as filenames.
  107. </pre>
  108.                     </blockquote>
  109.                 </dd>
  110.                 
  111.                 <dt>
  112.                     <a translate="no"
  113. href="/read/?path=/small-scripts/shrink-disavow&amp;referer=/small-scripts/&amp;title=Small+scripts">
  114.                         shrink-disavow
  115.                     </a> - Minify Google Webmaster Tools /
  116.                     <span translate="no">Search Console</span>
  117.                 </dt>
  118.                 <dd>
  119.                     <p>
  120.                         It converts multiple complete URLs on the same domain
  121.                         to the <code>domain: </code>syntax.
  122.                     </p>
  123.                     <blockquote>
  124. <pre>Usage: script_name {infile} {outfile} [num_of_links]
  125. num_of_links is the number of URLs from the same domain that will are
  126. required for replacing all those URLs with a single 'domain:'.
  127. The default value is two.
  128. </pre>
  129.                     </blockquote>
  130.                 </dd>
  131.                 
  132.                 <dt>
  133.                     <a translate="no"
  134. href="/read/?path=/mkhtml&amp;referer=/small-scripts/&amp;title=Small+scripts">
  135.                         mkhtml
  136.                     </a> - The key of my new design
  137.                 </dt>
  138.                 <dd>
  139.                     <p>
  140.                         The old design was based on fancy Python scripts
  141.                         generating the content.  I made it too automated for
  142.                         too specific types of content.
  143.                     </p>
  144.                     <p>The objectives for the new design were:</p>
  145.                     <ul>
  146.                         <li>
  147.                             Autogenerate the navigation.
  148.                             The only thing I needed to be done automagically.
  149.                         </li>
  150.                         <li>
  151.                             Work like a macro expander.
  152.                         </li>
  153.                         <li>
  154.                             Generate (mostly) static content,
  155.                             but work for scripts too.
  156.                         </li>
  157.                         <li>
  158.                             Be ran from a Makefile.
  159.                         </li>
  160.                     </ul>
  161.                     <p>It still has some downsides:</p>
  162.                     <ul>
  163.                         <li>
  164.                             A bit terribly implemented.
  165.                         </li>
  166.                         <li>
  167.                             A bit limited in certain cases.
  168.                         </li>
  169.                         <li>
  170.                             Quite ad-hoc.
  171.                         </li>
  172.                         <li>
  173.                             Weird macro syntax.
  174.                         </li>
  175.                     </ul>
  176.                 </dd>
  177.             </dl>
  178.             
  179.             
  180.             <h2>Other scripts</h2>
  181.             <dl>
  182.                 <dt translate="no">
  183.                     <a href="/read/?path=/small-scripts/monitor&amp;referer=/small-scripts/&amp;title=Small+scripts">
  184.                         monitor
  185.                     </a>
  186.                 </dt>
  187.                 <dd>Fail2ban, ps aux | grep ..., °C, loadavg ...</dd>                
  188.             </dl>
  189.         </div></main>
  190.         
  191. <!-- INCLUDED FOOTER -->
  192.     <hr class="textonly"/>
  193.     <p>
  194.         Copyright © Oskar Skog<br/>
  195.         Website content released under the <a
  196.         href="https://creativecommons.org/licenses/by/4.0/" rel="license noopener"
  197.         target="_blank">Creative Commons Attribution (CC-BY 4.0)</a> license
  198.         and my software usually under the <span class="a"><a target="_blank"
  199.         rel="noopener"
  200.         href="https://opensource.org/licenses/BSD-2-Clause">FreeBSD license
  201.         (2-clause)</a>.</span>
  202.         <br/>
  203.         Images may be from other sites, I should have cited useful sources
  204.         somewhere on the page.
  205.         <span class="notprint">Contact me if I haven't.</span>
  206.     </p>
  207.     <p id="contact" class="notprint">
  208.         You can contact me at: <a href="mailto:oskar@oskog97.com"
  209.         rel="noopener" target="_blank">oskar@oskog97.com</a>
  210.         <span class="a">(<a href="/pgp-pub/oskar.asc"
  211.                             >PGP public key</a>)</span>
  212.     </p>
  213.     <p> <a class="notprint" href="https://oskog97.com/read/?path=/style.css">
  214.             CSS Stylesheet
  215.         </a>
  216.         <a href="https://validator.w3.org/check/referrer" rel="nofollow noopener"
  217.             target="_blank" class="notprint"><span
  218.             class="img">Valid HTML5</span
  219.         ></a><br/>
  220.     </p>
  221. </div></footer>
  222. <!-- END OF INCLUDED FOOTER -->
  223.     </body>
  224. </html>