source code of /small-scripts/index.html

Last modified
Lines 230

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. </p>
  49. <p class="row">
  50. <span class="textonly" translate="no">]</span><span class="head active">Small scripts</span><span class="textonly" translate="no">[</span>
  51. &gt;&gt;
  52. <span class="textonly" translate="no">[</span><a class="sub" href="/read/">Website's scripts</a><span class="textonly" translate="no">]</span>
  53. </p>
  54. <p class="row">
  55. <span class="textonly" translate="no">[</span><a class="sub" href="/sitemap.py">Sitemap</a><span class="textonly" translate="no">]</span>
  56. </p>
  57. <hr class="textonly"/>
  58. </div></div></nav>
  59. <!-- END autogenerated navigation -->
  60.         <main><div id="content">
  61.             <h1 id="title">Small scripts</h1>
  62.             <h2>The scripts I'm most proud of</h2>
  63.             <dl>
  64.                 <dt>
  65.                     <a translate="no"
  66. href="/read/?path=/small-scripts/minify&amp;referer=/small-scripts/&amp;title=Small+scripts">
  67.                         minify.py
  68.                     </a> - Simple XHTML minifier
  69.                 </dt>
  70.                 <dd>
  71.                     <p>
  72.                         It reads from <code>stdin</code> and writes to
  73.                         <code>stdout</code>.  The reason I wrote this script
  74.                         was that the other HTML minifiers I used were
  75.                         over-optimizing the HTML, causing validation errors.
  76.                     </p>
  77.                     <p>
  78.                         I don't use this script any more, as my new design is
  79.                         based on static XHTML5 being served. (Lighttpd can
  80.                         compress static resources but not the output streams
  81.                         from CGI scripts.)
  82.                     </p>
  83.                 </dd>
  84.                 
  85.                 <dt>
  86.                     <a translate="no"
  87. href="/read/?path=/small-scripts/killbom&amp;referer=/small-scripts/&amp;title=Small+scripts">
  88.                         killbom
  89.                     </a> - Eliminate UTF-8 Byte Order Marks
  90.                 </dt>
  91.                 <dd>
  92.                     <p>
  93.                         This script removes all UTF-8 BOMs from all specified
  94.                         files. Even BOMs, that somehow got somewhere else than
  95.                         in the beginning of the file, are also removed.
  96.                     </p>
  97.                     <p><strong>
  98.                         This script SHOULD NOT be run on binary files due to
  99.                         its very literal operation.
  100.                     </strong></p>
  101.                     <blockquote>
  102. <pre>Usage: killbom [file] ...
  103. killbom removes all UTF-8 BOM marks from files.
  104. WARNING: It really removes all sequences of '\0xEF\0xBB\0xBF'.
  105. WARNING: It accepts no options. All arguments are treated as filenames.
  106. </pre>
  107.                     </blockquote>
  108.                 </dd>
  109.                 
  110.                 <dt>
  111.                     <a translate="no"
  112. href="/read/?path=/small-scripts/shrink-disavow&amp;referer=/small-scripts/&amp;title=Small+scripts">
  113.                         shrink-disavow
  114.                     </a> - Minify Google Webmaster Tools /
  115.                     <span translate="no">Search Console</span>
  116.                 </dt>
  117.                 <dd>
  118.                     <p>
  119.                         It converts multiple complete URLs on the same domain
  120.                         to the <code>domain: </code>syntax.
  121.                     </p>
  122.                     <blockquote>
  123. <pre>Usage: script_name {infile} {outfile} [num_of_links]
  124. num_of_links is the number of URLs from the same domain that will are
  125. required for replacing all those URLs with a single 'domain:'.
  126. The default value is two.
  127. </pre>
  128.                     </blockquote>
  129.                 </dd>
  130.                 
  131.                 <dt>
  132.                     <a translate="no"
  133. href="/read/?path=/mkhtml&amp;referer=/small-scripts/&amp;title=Small+scripts">
  134.                         mkhtml
  135.                     </a> - The key of my new design
  136.                 </dt>
  137.                 <dd>
  138.                     <p>
  139.                         The old design was based on fancy Python scripts
  140.                         generating the content.  I made it too automated for
  141.                         too specific types of content.
  142.                     </p>
  143.                     <p>The objectives for the new design were:</p>
  144.                     <ul>
  145.                         <li>
  146.                             Autogenerate the navigation.
  147.                             The only thing I needed to be done automagically.
  148.                         </li>
  149.                         <li>
  150.                             Work like a macro expander.
  151.                         </li>
  152.                         <li>
  153.                             Generate (mostly) static content,
  154.                             but work for scripts too.
  155.                         </li>
  156.                         <li>
  157.                             Be ran from a Makefile.
  158.                         </li>
  159.                     </ul>
  160.                     <p>It still has some downsides:</p>
  161.                     <ul>
  162.                         <li>
  163.                             A bit terribly implemented.
  164.                         </li>
  165.                         <li>
  166.                             A bit limited in certain cases.
  167.                         </li>
  168.                         <li>
  169.                             Quite ad-hoc.
  170.                         </li>
  171.                         <li>
  172.                             Weird macro syntax.
  173.                         </li>
  174.                     </ul>
  175.                 </dd>
  176.             </dl>
  177.             
  178.             
  179.             <h2>Other scripts</h2>
  180.             <dl>
  181.                 <dt translate="no">
  182.                     <a href="/read/?path=/small-scripts/monitor&amp;referer=/small-scripts/&amp;title=Small+scripts">
  183.                         monitor
  184.                     </a>
  185.                 </dt>
  186.                 <dd>Fail2ban, ps aux | grep ..., °C, loadavg ...</dd>                
  187.             </dl>
  188.         </div></main>
  189.         
  190. <!-- INCLUDED FOOTER -->
  191.     <hr class="textonly"/>
  192.     <p>
  193.         Copyright © Oskar Skog<br/>
  194.         Website content released under the <a
  195.         href="https://creativecommons.org/licenses/by/4.0/" rel="license noopener"
  196.         target="_blank">Creative Commons Attribution (CC-BY 4.0)</a> license
  197.         and my software usually under the <span class="a"><a target="_blank"
  198.         rel="noopener"
  199.         href="https://opensource.org/license/BSD-2-Clause">FreeBSD license
  200.         (2-clause)</a>.</span>
  201.         <br/>
  202.         Images may be from other sites, I should have cited useful sources
  203.         somewhere on the page.
  204.         <span class="notprint">Contact me if I haven't.</span>
  205.     </p>
  206.     <p id="contact" class="notprint">
  207.         You can contact me at: <a href="mailto:oskar@oskog97.com"
  208.         rel="noopener" target="_blank">oskar@oskog97.com</a>
  209.         <span class="a">(<a href="/pgp-pub/oskar.asc"
  210.                             >PGP public key</a>)</span>
  211.     </p>
  212.     <p> <a class="notprint" href="https://oskog97.com/read/?path=/style.css">
  213.             CSS Stylesheet
  214.         </a>
  215.     </p>
  216. </div></footer>
  217. <!-- END OF INCLUDED FOOTER -->
  218.     </body>
  219. </html>