<?xml version="1.0" encoding="utf-8" ?>

<?xml-stylesheet type="text/xsl" href="/templates/2k11/rss.xsl" media="screen" ?>
<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Daniel Lange's blog (Entries tagged as bash)</title>
    <link>https://daniel-lange.com/</link>
    <description>agrep -pB IT /dev/life</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 2.6.0 - http://www.s9y.org/</generator>
    <pubDate>Thu, 02 Jun 2022 16:38:50 GMT</pubDate>

    <image>
    <url>//daniel-lange.com/uploads/Avatar_Blog_144_234.png</url>
    <title>RSS: Daniel Lange's blog - agrep -pB IT /dev/life</title>
    <link>https://daniel-lange.com/</link>
    <width>144</width>
    <height>234</height>
</image>

<item>
    <title>Get Youtube Channel ID from username</title>
    <link>https://daniel-lange.com/archives/175-Get-Youtube-Channel-ID-from-username.html</link>
            <category>Internet</category>
    
    <comments>https://daniel-lange.com/archives/175-Get-Youtube-Channel-ID-from-username.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=175</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=175</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;Youtube has a really nice RSS feature that is extremely well hidden.&lt;/p&gt;

&lt;p&gt;If you postfix a Channel ID to&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;https://www.youtube.com/feeds/videos.xml?channel_id=&amp;lt;id goes here&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;you get a really nice Atom 1.0 (~RSS) feed for your feedreader.&lt;/p&gt;

&lt;p&gt;Unfortunately the Channel ID is hard to find while you are navigating Youtube with usernames in the URL.&lt;/p&gt;

&lt;p&gt;E.g. &lt;a href=&quot;https://www.youtube.com/c/TED&quot;&gt;https://www.youtube.com/c/TED&lt;/a&gt; is TED&#039;s channel, full of interesting and worth-to-watch content (and some assorted horse toppings, of course).&lt;/p&gt;

&lt;p&gt;But you have to read a lot of ugly HTML / JSON in that page to find and combine&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/feeds/videos.xml?channel_id=UCAuUUnT6oDeKwE6v1NGQxug&quot;&gt;https://www.youtube.com/feeds/videos.xml?channel_id=UCAuUUnT6oDeKwE6v1NGQxug&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;which is the related RSS feed.&lt;/p&gt;

&lt;p&gt;Jeff Keeling wrote a simple &lt;a href=&quot;https://jeffkeeling.github.io/youtube_rss_extractor/&quot;&gt;Youtube RSS Extractor&lt;/a&gt; that does well if you have a &lt;code&gt;../playlist?...&lt;/code&gt; or a &lt;code&gt;.../channel/...&lt;/code&gt; URL but it will (currently) fail on user name channels or Youtube landing pages.&lt;/p&gt;

&lt;p&gt;So how do we get the Channel ID for a Youtube user we are interested to follow?&lt;/p&gt;

&lt;p&gt;Youtube has a great API but that is gated by API keys even for the most simple calls (that came only with v3 of the API but the previous version is depreciated since 2015)&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;dl@laptop:~$ &lt;/span&gt;curl &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;https://www.googleapis.com/youtube/v3/channels?part=contentDetails&amp;amp;forUsername=DebConfVideos&#039;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;error&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;code&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #000000;&quot;&gt;403&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;message&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;The request is missing a valid API key.&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;errors&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;message&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;The request is missing a valid API key.&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;domain&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;global&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;reason&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;forbidden&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;status&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;PERMISSION_DENIED&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;Luckily we can throw the same (example) user name &lt;code&gt;DebConfVideos&lt;/code&gt; at &lt;code&gt;curl&lt;/code&gt; and &lt;code&gt;grep&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;dl@laptop:~$ &lt;/span&gt;curl &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://www.youtube.com/c/DebConfVideos/videos&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-Po&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;&amp;quot;channelId&amp;quot;:&amp;quot;.+?&amp;quot;&#039;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;channelId&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;UC7SbfAPZf8SMvAxp8t51qtQ&amp;quot;&lt;/span&gt; &lt;/div&gt;

&lt;p&gt;So &lt;a href=&quot;https://www.youtube.com/feeds/videos.xml?channel_id=UC7SbfAPZf8SMvAxp8t51qtQ&quot;&gt;https://www.youtube.com/feeds/videos.xml?channel_id=UC7SbfAPZf8SMvAxp8t51qtQ&lt;/a&gt; is the RSS feed for DebConfVideos.&lt;/p&gt;

&lt;p&gt;We can use individual Youtube video URLs as well. With the hack above, it&#039;ll work to find us the Chanel ID from a Youtube video URL:&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:690 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;920&quot; height=&quot;78&quot;  src=&quot;https://daniel-lange.com/uploads/entries/220601_Google_Youtube_get_channelId_2.jpg&quot;  alt=&quot;Working around the Youtube API restrictions to still make use of their RSS feed&quot;&gt;&lt;/p&gt;

&lt;p&gt;Now, some user pages may have multiple valid RSS feeds because they contain multiple channels.&lt;/p&gt;

&lt;p&gt;Remember the TED page from above? Well run:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;dl@laptop:~$ &lt;/span&gt;curl &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://www.youtube.com/c/TED&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-Po&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;&amp;quot;channelId&amp;quot;:&amp;quot;.+?&amp;quot;&#039;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cut&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-d&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;\&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;4&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;read&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-r&lt;/span&gt; YTID ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-n&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Youtube-ID: &lt;span style=&quot;color: #007800;&quot;&gt;$YTID&lt;/span&gt; &amp;quot;&lt;/span&gt; ; curl &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://www.youtube.com/feeds/videos.xml?channel_id=&lt;span style=&quot;color: #007800;&quot;&gt;$YTID&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-m&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-P&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-o&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;(?&amp;lt;=&amp;lt;title&amp;gt;).+(?=&amp;lt;/title&amp;gt;)&amp;quot;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;done&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;This will iterate through the Channel IDs found and show you the titles. That way you can assess which one you want to add to your feedreader.&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:691 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;670&quot; height=&quot;246&quot;  src=&quot;https://daniel-lange.com/uploads/entries/220601_Google_Youtube_get_channelId_and_title.jpg&quot; title=&quot;Bash automation FTW!&quot; alt=&quot;screenshot of the above&quot;&gt;&lt;/p&gt;

&lt;p&gt;You probably want the last Channel ID listed above, the non-selective &quot;TED&quot; one. And that&#039;s the one from the example above.&lt;/p&gt;

&lt;h2&gt;Update&lt;/h2&gt;

&lt;p&gt;02.06.2022:
smpl wrote in and has the much better solution for the most frequent use cases:&lt;/p&gt;

&lt;pre&gt;
You can also use get a feed directly with a username:
https://www.youtube.com/feeds/videos.xml?user=&amp;lt;username&amp;gt;

The one I use most is the one for playlists (if creators remember to
use them).

https://www.youtube.com/feeds/videos.xml?playlist_id=&amp;lt;playlist id&amp;gt;
&lt;/pre&gt;

&lt;p&gt;For the common case you don&#039;t even need the channel ID that way.
But it is also conveniently given in a &lt;code&gt;&amp;lt;yt:channelId&amp;gt;&lt;/code&gt; tag (or the topmost &lt;code&gt;&amp;lt;id&amp;gt;&lt;/code&gt; tag) within the Atom XML document.&lt;/p&gt;

&lt;p&gt;Thanks, smpl!&lt;/p&gt;

&lt;div class=&quot;footnotes&quot;&gt;
&lt;hr /&gt;
&lt;ol&gt;

&lt;li id=&quot;fn:1&quot;&gt;
&lt;p&gt;Actually it is even more complicated as some channels, like our DebConfVideos example, will only get you an incomplete result, cf. &lt;a href=&quot;https://stackoverflow.com/questions/37267324/how-to-get-youtube-channel-details-using-youtube-data-api-if-channel-has-custom&quot;&gt;this StackOverflow entry&lt;/a&gt;. I.e. the &lt;code&gt;forUsername&lt;/code&gt; iterator may not even work and the &quot;best practice&quot; seems to be mucking around with the &lt;code&gt;search&lt;/code&gt; call.&amp;#160;&lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;
 
    </content:encoded>

    <pubDate>Wed, 01 Jun 2022 16:45:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/175-guid.html</guid>
    <category>api</category>
<category>atom</category>
<category>automate</category>
<category>bash</category>
<category>channel</category>
<category>google</category>
<category>rss</category>
<category>updated</category>
<category>url</category>
<category>user</category>
<category>video</category>
<category>web</category>
<category>youtube</category>

</item>
<item>
    <title>Debian Gitlab (salsa.debian.org) tricks</title>
    <link>https://daniel-lange.com/archives/140-Debian-Gitlab-salsa.debian.org-tricks.html</link>
            <category>Debian</category>
    
    <comments>https://daniel-lange.com/archives/140-Debian-Gitlab-salsa.debian.org-tricks.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=140</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=140</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;Debian is moving the git hosting from &lt;a href=&quot;https://alioth.debian.org&quot;&gt;alioth.debian.org&lt;/a&gt;, an instance of Fusionforge, to &lt;a href=&quot;https://salsa.debian.org&quot;&gt;salsa.debian.org&lt;/a&gt; which is a Gitlab instance.&lt;/p&gt;

&lt;p&gt;There is some background reading available on &lt;a href=&quot;https://wiki.debian.org/Salsa/&quot;&gt;https://wiki.debian.org/Salsa/&lt;/a&gt;. This also has pointers to an import script to ease migration for people that move repositories. It&#039;s definitely worth hanging out in &lt;a href=&quot;irc://irc.oftc.net/alioth&quot;&gt;#alioth on oftc&lt;/a&gt;, too, to learn more about salsa / gitlab in case you have a persistent irc connection.&lt;/p&gt;

&lt;p&gt;As of now() salsa has 15,320 projects, 2,655 users in 298 groups.&lt;br /&gt;
Alioth has 29,590 git repositories (which is roughly equivalent to a project in Gitlab), 30,498 users in 1,154 projects (which is roughly equivalent a group in Gitlab).&lt;/p&gt;

&lt;p&gt;So we currently have 50% of the git repositories migrated. One month after leaving beta. This is very impressive.&lt;br /&gt;
As Alioth has naturally accumulated some cruft, Alexander Wirt (formorer) estimates that 80% of the repositories in use have already been migrated.&lt;/p&gt;

&lt;p&gt;So it&#039;s time to update your local &lt;code&gt;.git/config&lt;/code&gt; URLs!&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://dogguy.org&quot;&gt;Mehdi Dogguy&lt;/a&gt; has written &lt;a href=&quot;https://salsa.debian.org/mehdi/salsa-scripts/&quot;&gt;nice scripts&lt;/a&gt; to ease handling salsa / gitlab via the (extensive and very well documented) &lt;a href=&quot;https://docs.gitlab.com/ce/api/&quot;&gt;API&lt;/a&gt;. Among them is &lt;a href=&quot;https://salsa.debian.org/mehdi/salsa-scripts/blob/master/list_projects.sh&quot;&gt;list_projects&lt;/a&gt; that gets you nice overview of the projects in a specific group. This is especially true for the &quot;Debian&quot; group that contains the former &lt;a href=&quot;https://wiki.debian.org/Alioth/Git#Collab_Maint_project&quot;&gt;collab-maint&lt;/a&gt; repositories, so source code that can and shall be maintained by Debian Developers collectively.&lt;/p&gt;

&lt;h2&gt;Finding migrated repositories&lt;/h2&gt;

&lt;p&gt;Salsa can search quite quickly via the Web UI: &lt;a href=&quot;https://salsa.debian.org/search?utf8=✓&amp;amp;search=htop&quot;&gt;https://salsa.debian.org/search?utf8=✓&amp;amp;search=htop&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a class=&quot;serendipity_image_link&quot; title=&quot;Salsa search screenshot&quot; href=&#039;https://salsa.debian.org/search?utf8=✓&amp;search=htop&#039; target=&quot;_blank&quot;&gt;&lt;!-- s9ymdb:648 --&gt;&lt;img class=&quot;serendipity_image_center&quot; style=&quot;border:1px solid black&quot; width=&quot;774&quot; height=&quot;304&quot; src=&quot;https://daniel-lange.com/uploads/entries/180225_Salsa_search_screenshot.png&quot; title=&quot;Salsa search screenshot&quot; alt=&quot;Salsa search screenshot&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;but finding the URL to clone the repository from is more clicks and ~4MB of data each time (yeah, the modern web), so&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;$ curl &lt;span style=&quot;color: #660033;&quot;&gt;--silent&lt;/span&gt; https:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;salsa.debian.org&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;api&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;v4&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;projects?&lt;span style=&quot;color: #007800;&quot;&gt;search&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;htop&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; jq .&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;br /&gt;&amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;id&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #000000;&quot;&gt;9546&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;description&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;interactive processes viewer&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;htop&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;name_with_namespace&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Debian / htop&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;path&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;htop&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;path_with_namespace&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;debian/htop&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;created_at&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;2018-02-05T12:44:35.017Z&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;default_branch&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;master&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;tag_list&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ssh_url_to_repo&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;git@salsa.debian.org:debian/htop.git&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;http_url_to_repo&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://salsa.debian.org/debian/htop.git&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;web_url&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://salsa.debian.org/debian/htop&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;avatar_url&amp;quot;&lt;/span&gt;: null,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;star_count&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #000000;&quot;&gt;0&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;forks_count&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #000000;&quot;&gt;0&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;last_activity_at&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;2018-02-17T18:23:05.550Z&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;is a bit nicer.&lt;/p&gt;

&lt;p&gt;Please notice the git url format is a bit odd, it&#039;s either&lt;br /&gt;
&lt;code&gt;git@salsa.debian.org:debian/htop.git&lt;/code&gt; or&lt;br /&gt;
&lt;code&gt;ssh://git@salsa.debian.org/debian/htop.git&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Notice the &quot;:&quot; -&gt; &quot;/&quot; after the hostname. Bit me once.&lt;/p&gt;

&lt;h2&gt;Finding repositories to update&lt;/h2&gt;

&lt;p&gt;At this time I found it useful to check which of the repositories I have cloned had not yet been updated in the local &lt;code&gt;.git/config&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;find&lt;/span&gt; ~&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;debconf&lt;/span&gt; ~&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;my_sources ~&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;shared &lt;span style=&quot;color: #660033;&quot;&gt;-ipath&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;*.git/config&#039;&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-exec&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-H&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;url.*git\.debian&#039;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;{}&#039;&lt;/span&gt; \;&lt;/div&gt;

&lt;p&gt;Thanks to Jörg Jaspert (Ganneff) the Debconf repositories have all been &lt;a href=&quot;https://salsa.debian.org/debconf-team/public&quot;&gt;moved to Salsa&lt;/a&gt; now.&lt;br /&gt;
Hint: Bug him for his scripts if you need to do complex moves.&lt;/p&gt;

&lt;p&gt;Updating the URLs has been an hours work on my side and there is little you can do to speed that up if - as in the Debconf case - teams have used the opportunity to clean up and things are not as easy as using &lt;code&gt;sed -i&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;But there is no reason to do this more than once, so for the laptops...&lt;/p&gt;

&lt;h2&gt;Speeding up migration on multiple devices&lt;/h2&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;rsync &lt;span style=&quot;color: #660033;&quot;&gt;-armuvz&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--existing&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--include&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;*/&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--include&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;.git/config&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--exclude&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt; ~&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debconf&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt; laptop:debconf&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;will rsync the &lt;code&gt;.git/config&lt;/code&gt; files that you changed to other systems where you keep partial copies.&lt;/p&gt;

&lt;p&gt;On these a simple &lt;code&gt;git pull&lt;/code&gt; to get up to remote HEAD or using the &lt;code&gt;git_pull_all&lt;/code&gt; one-liner from &lt;a href=&quot;https://daniel-lange.com/archives/99-Managing-a-project-consisting-of-multiple-git-repositories.html&quot;&gt;https://daniel-lange.com/archives/99-Managing-a-project-consisting-of-multiple-git-repositories.html&lt;/a&gt; will suffice.&lt;/p&gt;

&lt;h2&gt;Git short URL&lt;/h2&gt;

&lt;p&gt;Stefano Rivera (tumbleweed) shared this clever trick:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;git config&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--global&lt;/span&gt; url.&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ssh://git@salsa.debian.org/&amp;quot;&lt;/span&gt;.insteadOf salsa:&lt;/div&gt;

&lt;p&gt;This way you can &lt;code&gt;git clone salsa:debian/htop&lt;/code&gt;.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sun, 25 Feb 2018 11:30:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/140-guid.html</guid>
    <category>bash</category>
<category>debian</category>
<category>find</category>
<category>git</category>
<category>gitlab</category>
<category>rsync</category>
<category>salsa</category>

</item>
<item>
    <title>tail -S (truncating lines to terminal width)</title>
    <link>https://daniel-lange.com/archives/134-tail-S-truncating-lines-to-terminal-width.html</link>
            <category>Open Source</category>
    
    <comments>https://daniel-lange.com/archives/134-tail-S-truncating-lines-to-terminal-width.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=134</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=134</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;The tail command has a quite glaring omission in that it can&#039;t truncate lines.
Thus it wraps long log line into multiple terminal lines regardless. Which makes them very hard to read.&lt;/p&gt;

&lt;p&gt;I used to work around this using &lt;code&gt;less -S&lt;/code&gt; and then hitting the &lt;tt&gt;[F]&lt;/tt&gt; key but that&#039;s interactive. &lt;code&gt;less +F &amp;lt;filename&amp;gt;&lt;/code&gt; is the little known work-around for the interactive issue but that still doesn&#039;t work well with pipes (&lt;code&gt;tail -f logfile | grep &quot;ERROR:&quot;&lt;/code&gt; etc).&lt;/p&gt;

&lt;p&gt;There is a &lt;a href=&quot;https://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00068.html&quot;&gt;bug report from 2004&lt;/a&gt; against GNU coreutils but that went nowhere.&lt;/p&gt;

&lt;p&gt;So we&#039;re not getting a &lt;code&gt;tail -S&lt;/code&gt; anytime soon.&lt;/p&gt;

&lt;h3&gt;Bash to the rescue: tail -S → tails&lt;/h3&gt;

&lt;p&gt;Hence I wrote this little script, &lt;a href=&quot;https://daniel-lange.com/software/tails&quot; title=&quot;Download the tails script&quot;&gt;&lt;strong&gt;tails&lt;/strong&gt;&lt;/a&gt; [1kB]:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#!/bin/bash -i&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# v2 from 170712: introduce loop to work around GNU coreutils issues with pipe/fifo/isatty&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-z&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;$COLUMNS&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #007800;&quot;&gt;MYCOL&lt;/span&gt;=$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;tput cols&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #007800;&quot;&gt;MYCOL&lt;/span&gt;=&lt;span style=&quot;color: #800000;&quot;&gt;${COLUMNS}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tail&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;$@&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;read&lt;/span&gt; line; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;$line&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; expand &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cut&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-c1-&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${MYCOL:-80}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;done&lt;/span&gt;﻿&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;

&lt;p&gt;Now, there are some interesting bits even in this tiny script:&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;bash -i&lt;/code&gt; results in &lt;code&gt;$COLUMNS&lt;/code&gt; being set within the script on sane Linux bash. Otherwise that variable wouldn&#039;t be available. Because it is a shell variable and not an environment variable. You knew that, right?&lt;/p&gt;

&lt;p&gt;Unfortunately the &lt;code&gt;bash -i&lt;/code&gt; doesn&#039;t get &lt;code&gt;$COLUMNS&lt;/code&gt; set on either MacOS (X) or FreeBSD, so that&#039;s where the &lt;code&gt;tput cols&lt;/code&gt; comes into play. It outputs the column width for the current terminal to stdout.&lt;/p&gt;

&lt;p&gt;If all that fails &lt;strong&gt;tails&lt;/strong&gt; will default to 80 columns.&lt;/p&gt;

&lt;p&gt;So &lt;code&gt;tails -f /var/log/apache/access.log&lt;/code&gt; will now look nice.&lt;/p&gt;

&lt;h3&gt;Corner case: color&lt;/h3&gt;

&lt;p&gt;If you use color codes somewhere (&lt;code&gt;grep --color=always&lt;/code&gt;, &lt;code&gt;dmesg --color=always&lt;/code&gt;) &lt;strong&gt;tails&lt;/strong&gt; will just truncate lines too short so they will still not wrap.&lt;br /&gt;
There is a slight risk that it may cut into half a color code escape sequence and mess up the terminal a bit.
You could change that by removing the &lt;code&gt;-i&lt;/code&gt; from the shebang line and setting $COLUMNS explicitly. But that then needs manual adjustment for each combination of colored lines (=count of ANSI sequences) and terminal width. Better to color after the &lt;strong&gt;tails&lt;/strong&gt; invocation then where possible, e.g. &lt;code&gt;tails -f /var/log/httpd/error.log | grep &#039;:error&#039;&lt;/code&gt; to watch for PHP errors and the like.&lt;/p&gt;

&lt;h3&gt;Mended corner cases: inconsistent tail behaviour&lt;/h3&gt;

&lt;p&gt;A first version of the script didn&#039;t use a loop but just had&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tail&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;$@&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; expand &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cut&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-c1-&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${MYCOL:-80}&lt;/span&gt;﻿&lt;/div&gt;

&lt;p&gt;This would break &lt;code&gt;tails -f&lt;/code&gt; on Debian (coreutils 8.23) / Ubuntu (coreutils 8.26) while removing the &lt;code&gt;|expand&lt;/code&gt; would make it work. On Fedora 25 (coreutils 8.25) I couldn&#039;t get &lt;code&gt;tails -f&lt;/code&gt; to work at all with that v1. The &lt;code&gt;cut&lt;/code&gt; (so just a single command chained) already broke the pipe &lt;img src=&quot;https://daniel-lange.com/plugins/serendipity_event_emoticate/img/emoticons/sad.png&quot; alt=&quot;:-(&quot; class=&quot;emoticon&quot; /&gt;. And nope, &lt;code&gt;stdbuf&lt;/code&gt; didn&#039;t help.&lt;/p&gt;

&lt;p&gt;If you have a more simple solution to work around the isatty / isfifo mess, please leave a comment!&lt;/p&gt;

&lt;h3&gt;Alternatives&lt;/h3&gt;

&lt;p&gt;If you want to show multiple log tails in parallel, highlight strings etc. &lt;a href=&quot;https://www.vanheusden.com/multitail/&quot;&gt;multitail&lt;/a&gt; is worth a look.&lt;/p&gt;

&lt;p&gt;Depending on what you want to achieve you could also tell your terminal emulator to not wrap lines:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;setterm&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-linewrap&lt;/span&gt; off; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;less&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-SR&lt;/span&gt; +F &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;log&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;apache&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;access.log; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;setterm&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-linewrap&lt;/span&gt; on&lt;/div&gt;
 
    </content:encoded>

    <pubDate>Wed, 12 Jul 2017 08:08:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/134-guid.html</guid>
    <category>bash</category>
<category>coreutils</category>
<category>gnu</category>
<category>script</category>
<category>tail</category>
<category>terminal</category>

</item>
<item>
    <title>Generate an indexed list of passwords</title>
    <link>https://daniel-lange.com/archives/107-Generate-an-indexed-list-of-passwords.html</link>
            <category>Other</category>
    
    <comments>https://daniel-lange.com/archives/107-Generate-an-indexed-list-of-passwords.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=107</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=107</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;Generating an indexed list of passwords without complex perl or python:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;pwgen &lt;span style=&quot;color: #660033;&quot;&gt;-y&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;20&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;30&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;nl&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-w&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-n&lt;/span&gt; rz &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; -&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Explanation:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;pwgen: -y = complex passwords (including symbols) ; 20 = length of password; 30 = number of passwords to generate&lt;/p&gt;

&lt;p&gt;nl: -w 2 = zero pad to a width of two characters; -n rz = print right-justified; -s - = use dash as a separator&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:616 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;394&quot; height=&quot;471&quot;  src=&quot;https://daniel-lange.com/uploads/entries/150809_generate_indexed_list_of_passwords.png&quot; title=&quot;nl ... old but golden&quot; alt=&quot;screenshot of pwgen | nl&quot; /&gt;&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sun, 09 Aug 2015 17:31:58 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/107-guid.html</guid>
    <category>bash</category>
<category>passwords</category>
<category>security</category>
<category>shell</category>

</item>
<item>
    <title>scp (secure copy) a file to the same path on a remote system</title>
    <link>https://daniel-lange.com/archives/95-scp-secure-copy-a-file-to-the-same-path-on-a-remote-system.html</link>
            <category>IT</category>
    
    <comments>https://daniel-lange.com/archives/95-scp-secure-copy-a-file-to-the-same-path-on-a-remote-system.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=95</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=95</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;I&#039;ve been copying files from one server to the symmetrical cluster partner a lot last week.&lt;/p&gt;

&lt;p&gt;It&#039;s always&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; scp /path/to/directory/file remote:/path/to/directory/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That gets boring after a while but does not really warrant setting up a full blown config management solution like salt, puppet or ansible.&lt;/p&gt;

&lt;p&gt;So here is &lt;a href=&quot;https://daniel-lange.com/software/scpover&quot; title=&quot;scpover script download&quot;&gt;scpover&lt;/a&gt;[1.5kB].&lt;/p&gt;

&lt;p&gt;It reduces the effort to&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; scpover /path/to/directory/file
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will copy &quot;file&quot; from &quot;/path/to/directory/&quot; into exactly the same directory on the remote cluster partner.
Which system to target is detected from the hostname of the local system and hard-coded into the script.&lt;/p&gt;

&lt;p&gt;Scpover can also take multiple filepaths on one command line so you can beam over a few related config files from multiple locations in one go.&lt;br /&gt;
Not an atomic change but at least all within a reasonably short timespan.&lt;/p&gt;
 &lt;a class=&quot;block_level&quot; href=&quot;https://daniel-lange.com/archives/95-scp-secure-copy-a-file-to-the-same-path-on-a-remote-system.html#extended&quot;&gt;Continue reading &quot;scp (secure copy) a file to the same path on a remote system&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 16 Jul 2014 07:00:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/95-guid.html</guid>
    <category>bash</category>
<category>cluster</category>
<category>scp</category>
<category>script</category>
<category>ssh</category>
<category>sync</category>

</item>
<item>
    <title>Encrypting files with openssl for synchronization across the Internet</title>
    <link>https://daniel-lange.com/archives/84-Encrypting-files-with-openssl-for-synchronization-across-the-Internet.html</link>
            <category>Linux</category>
    
    <comments>https://daniel-lange.com/archives/84-Encrypting-files-with-openssl-for-synchronization-across-the-Internet.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=84</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=84</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;Well, shortly after I wrote about &lt;a href=&quot;https://daniel-lange.com/83-Encrypting-files-with-gpg-for-synchronization-across-the-Internet.html&quot;&gt;encrypting files with a keyfile / passphrase with gpg&lt;/a&gt; people asked about a solution with openssl.&lt;/p&gt;

&lt;p&gt;You should prefer to use the gpg version linked above, but if you can&#039;t, below is a script offering the same functionality with openssl.&lt;/p&gt;

&lt;p&gt;You basically call &lt;code&gt;crypt_openssl &amp;lt;file&amp;gt; [&amp;lt;files...&amp;gt;]&lt;/code&gt; to encrypt &lt;code&gt;file&lt;/code&gt; to &lt;code&gt;file.aes&lt;/code&gt; using the same keyfile as used in the gpg script (&lt;code&gt;~/.gnupg/mykey001&lt;/code&gt; per default).&lt;/p&gt;

&lt;p&gt;A simple &lt;code&gt;crypt_openssl -d &amp;lt;file.aes&amp;gt; [&amp;lt;files.aes...&amp;gt;]&lt;/code&gt; will restore the original files from the encrypted AES256 version that you can safely transfer over the Internet even using insecure channels.&lt;/p&gt;

&lt;p&gt;Please note that you should feed compressed data to &lt;code&gt;crypt_openssl&lt;/code&gt; whenever you can. So use preferably use it on &lt;code&gt;.zip&lt;/code&gt; or &lt;code&gt;.tar.gz&lt;/code&gt; files.&lt;/p&gt;
 &lt;a class=&quot;block_level&quot; href=&quot;https://daniel-lange.com/archives/84-Encrypting-files-with-openssl-for-synchronization-across-the-Internet.html#extended&quot;&gt;Continue reading &quot;Encrypting files with openssl for synchronization across the Internet&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 23 Sep 2013 17:50:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/84-guid.html</guid>
    <category>bash</category>
<category>crypt</category>
<category>openssl</category>
<category>script</category>
<category>security</category>
<category>sync</category>

</item>
<item>
    <title>Encrypting files with gpg for synchronization across the Internet</title>
    <link>https://daniel-lange.com/archives/83-Encrypting-files-with-gpg-for-synchronization-across-the-Internet.html</link>
            <category>Linux</category>
    
    <comments>https://daniel-lange.com/archives/83-Encrypting-files-with-gpg-for-synchronization-across-the-Internet.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=83</wfw:comment>

    <slash:comments>6</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=83</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;Automatically transferring (syncing) files between multiple computers is easy these days. Dropbox, owncloud or &lt;a href=&quot;https://github.com/sickill/bitpocket&quot;&gt;bitpocket&lt;/a&gt; to name a few. You can imagine I use the latter (if you want a recommendation)&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;In any case you want to encrypt what you send to be stored in &quot;the cloud&quot; even if it is just for a short time. There are many options how to encrypt the &quot;in flight&quot; data. Symmetric ciphers are probably the safest and most widely researched cryptography these days and easier to use than asymmetric key pairs in this context as well.&lt;/p&gt;

&lt;p&gt;Encryption is notoriously hard to implement correctly and worthless when the implementation is flawed. So I looked at &lt;a href=&quot;http://www.gnupg.org/&quot;&gt;gpg&lt;/a&gt;, a well known reference implementation, and was amazed that it can neither use a proper keyfile for symmetric encryption (you can just supply a passphrase via &lt;code&gt;--passphrase-file&lt;/code&gt;) nor does it handle multiple files on the command line consistently.
You can use &lt;code&gt;--multifile&lt;/code&gt; (wondering...why does a command need that at all?) with &lt;code&gt;--decrypt&lt;/code&gt; and &lt;code&gt;--encrypt&lt;/code&gt; (asymmetric public/private key pair encryption) but not with &lt;code&gt;--symmetric&lt;/code&gt; (symmetric shared key encryption). Duh!&lt;/p&gt;

&lt;p&gt;With a bit of scripting around the gpg shortcomings, you end up with &lt;code&gt;crypt_gpg&lt;/code&gt; that can nicely encrypt or decrypt multiple files (symmetric cipher) in one go.&lt;/p&gt;

&lt;div class=&quot;footnotes&quot;&gt;
&lt;hr /&gt;
&lt;ol&gt;

&lt;li id=&quot;fn:1&quot;&gt;
&lt;p&gt;Dropbox is closed source so it cannot be assessed for its security. Owncloud needs a thorough code review before I would dare to run it on my systems.&amp;#160;&lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;
 &lt;a class=&quot;block_level&quot; href=&quot;https://daniel-lange.com/archives/83-Encrypting-files-with-gpg-for-synchronization-across-the-Internet.html#extended&quot;&gt;Continue reading &quot;Encrypting files with gpg for synchronization across the Internet&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Fri, 20 Sep 2013 16:00:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/83-guid.html</guid>
    <category>bash</category>
<category>crypt</category>
<category>gpg</category>
<category>script</category>
<category>security</category>
<category>sync</category>

</item>
<item>
    <title>Keeping IRC nicks active</title>
    <link>https://daniel-lange.com/archives/54-Keeping-IRC-nicks-active.html</link>
            <category>IRC</category>
    
    <comments>https://daniel-lange.com/archives/54-Keeping-IRC-nicks-active.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=54</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=54</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;Typical IRC services usually allow you to register with nickserv and link a number of nicks to a personal account. It&#039;s quite common to have nick, nick_ and nick__ as many IRC clients auto-append underscores if the primary nickname is already in use when connecting. Obviously you can set these alternate nicknames to almost anything you like in a decent client.&lt;/p&gt;

&lt;p&gt;Some folks also group a &quot;vanity&quot; nickname or two for whatever reason. To keep these active, people do the &quot;nick shuffle&quot; (/nick newnick, /nick oldnick) all the time:&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:530 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;967&quot; height=&quot;79&quot; src=&quot;https://daniel-lange.com/uploads/entries/100309_freenode_nick_shuffle.png&quot;  alt=&quot;nick shuffle on freenode&quot; /&gt;&lt;/p&gt;

&lt;p&gt;People who forget the occasional nick shuffle may end up losing a grouped nick because it became inactive. While freenode staff try to contact people before dropping linked nicks, there are occasional prunes of &quot;old data&quot; from the services database. And then nobody can really ask upfront.&lt;/p&gt;

&lt;p&gt;So before the next big purge comes up, I wrote a small bash script that logs into a nickserv account and cycles through the linked nicks.
A few friends and me have used it successfully for many months now.&lt;/p&gt;

&lt;p&gt;Grab a copy of &lt;a href=&quot;https://daniel-lange.com/software/keepnick&quot; title=&quot;keepnick bash script&quot;&gt;keepnick (2.4kB)&lt;/a&gt; and drop it into /usr/local/bin.&lt;/p&gt;

&lt;p&gt;Keepnick expects to have an accountname, the corresponding password and then a sequence of linked nicks given on its command line.&lt;/p&gt;

&lt;p&gt;Something like&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;local&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;keepnick accountname passw0rd linked_nick linked_nick_ vanity_nick MyOtherNick&lt;/div&gt;

&lt;p&gt;should work.&lt;/p&gt;

&lt;p&gt;For regular use, you need to set up a cron job to call keepnick e.g. every week. So put something like the following script into &lt;code&gt;/etc/cron.weekly/keepnicks_irc&lt;/code&gt; or create a corresponding crontab entry for &lt;code&gt;keepnicks_irc&lt;/code&gt; if you do not have the convenient cron.* directories set up:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# run keepnick for user(s) irc account(s)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# intended to be run from cron, e.g. through /etc/cron.weekly&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #007800;&quot;&gt;KEEPNICK&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/usr/local/bin/keepnick&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# better safe than sorry&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #007800;&quot;&gt;PATH&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;export&lt;/span&gt; PATH&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$KEEPNICK&lt;/span&gt; accountname1 passw0rd1 linked_nick1 linked_nick1_ linked_nick1__&lt;br /&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$KEEPNICK&lt;/span&gt; accountname2 passw0rd2 linked_nick1 linked_nick2_ linked_nick2__&lt;br /&gt;&amp;#160;&lt;/div&gt;

&lt;p&gt;You should see keepnick in action now every week like this:&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:529 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;758&quot; height=&quot;68&quot;  src=&quot;https://daniel-lange.com/uploads/entries/100306_keepnick_in_action.png&quot;  alt=&quot;keepnick in action&quot; /&gt;&lt;/p&gt;

&lt;p&gt;What happens here is that the IRC services package tells you, keepnick has just authenticated to your account and will now shuffle through all nicks you asked it to.
The big advantage is that is does this outside of channels, so not annoying any users. The cron job should make sure you don&#039;t forget the nick shuffle anymore.&lt;/p&gt;

&lt;h2&gt;Making sure your bash supports network connections&lt;/h2&gt;

&lt;p&gt;Stock bash will support network connections but on Debian and old (=pre-karmic) Ubuntu that capability was disabled at compile time.&lt;/p&gt;

&lt;p&gt;If you need to check whether your bash is compiled with network support, type &lt;code&gt;cat &amp;lt; /dev/tcp/time.nist.gov/13&lt;/code&gt; into a bash terminal.&lt;/p&gt;

&lt;p&gt;In case that gives you a &lt;a href=&quot;http://www.nist.gov/physlab/div847/grp40/its.cfm&quot; title=&quot;NIST Internet time service&quot;&gt;RFC-867 time string&lt;/a&gt;, you&#039;re all fine.
If not, re-compile your bash with &lt;code&gt;--enable-net-redirections&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now for something more advanced (but entirely optional):&lt;/p&gt;
 &lt;a class=&quot;block_level&quot; href=&quot;https://daniel-lange.com/archives/54-Keeping-IRC-nicks-active.html#extended&quot;&gt;Continue reading &quot;Keeping IRC nicks active&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 18 May 2010 21:50:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/54-guid.html</guid>
    <category>account</category>
<category>active</category>
<category>bash</category>
<category>cron</category>
<category>freenode</category>
<category>irc</category>
<category>network</category>
<category>nick</category>
<category>script</category>
<category>stunnel</category>
<category>updated</category>

</item>
<item>
    <title>zip2dir (expand a zip to a directory of the same name)</title>
    <link>https://daniel-lange.com/archives/47-zip2dir-expand-a-zip-to-a-directory-of-the-same-name.html</link>
            <category>IT</category>
    
    <comments>https://daniel-lange.com/archives/47-zip2dir-expand-a-zip-to-a-directory-of-the-same-name.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=47</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=47</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;I needed to expand a lot of jars (Java zips) and other zips of various names into directories of the same name for each file.
With 6,239 files of which some are jars, some other zips and many xml and other filetypes all not properly identified by a file extension, this gets a bit too much to do manually.&lt;/p&gt;

&lt;p&gt;So:&lt;br /&gt;
Finding candidates for these is easy with &lt;code&gt;find . -type f&lt;/code&gt;.&lt;br /&gt;
The file is most probably a zip archive if the first two characters are &quot;PK&quot;, good old &lt;a href=&quot;http://en.wikipedia.org/wiki/Phil_Katz&quot; title=&quot;Wikipedia: Phil Katz - the inventor of .zip&quot; target=&quot;_blank&quot;&gt;Phil Katz&#039;&lt;/a&gt; signature. A friendly &lt;code&gt;head -c 2&lt;/code&gt; checks that.&lt;br /&gt;
All combined with some rudimentary error checking:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# There is little data security here, so know what you&#039;re doing.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# All risks in using this code are yours. It moves and deletes files quite stupidly.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# (c) Daniel Lange, 2009, v0.01, released into the public domain&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$#&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-ne&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Error: $0 expects exactly one argument, a (fully qualified) path/to/a/zipfile&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;!&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-r&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$1&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Error: file does not exist or no read permission on $1&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;!&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-w&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;$(dirname $1)&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Error: cannot write to directory of $1&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exit&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;$(head -c 2 $1)&lt;/span&gt;&amp;quot;&lt;/span&gt; == &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;PK&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mv&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$1&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$1&lt;/span&gt;.tmp&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-p&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$1&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;unzip&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-d&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$1&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$1&lt;/span&gt;.tmp&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;rm&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$1&lt;/span&gt;.tmp&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;$1 is not a zipfile&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;

&lt;p&gt;Download available &lt;a href=&quot;https://daniel-lange.com/software/zip2dir&quot; title=&quot;zip2dir download&quot;&gt;here (1KB)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Typical usage:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&amp;#160;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;find&lt;/span&gt; . &lt;span style=&quot;color: #660033;&quot;&gt;-type&lt;/span&gt; f &lt;span style=&quot;color: #660033;&quot;&gt;-print0&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;xargs&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--null&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-n&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; zip2dir&lt;/div&gt;

&lt;p&gt;This will expand all zips under the current directory.&lt;br /&gt;
Leave the &lt;code&gt;zip2dir&lt;/code&gt; out for a dry run (xargs will just print to the tty then). Look at the &lt;code&gt;-exec&lt;/code&gt; switch when digging around a bit more into what &lt;code&gt;find&lt;/code&gt; can do for you.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 30 Jul 2009 21:51:40 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/47-guid.html</guid>
    <category>bash</category>
<category>decompress</category>
<category>directory</category>
<category>expand</category>
<category>script</category>
<category>unzip</category>
<category>zip</category>

</item>
<item>
    <title>Cool, command-line style blog design</title>
    <link>https://daniel-lange.com/archives/40-Cool,-command-line-style-blog-design.html</link>
            <category>Private</category>
    
    <comments>https://daniel-lange.com/archives/40-Cool,-command-line-style-blog-design.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=40</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=40</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;It&#039;s very seldom that a blog design catches my eye.&lt;/p&gt;

&lt;div class=&quot;serendipity_imageComment_right&quot; style=&quot;width: 110px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;a class=&#039;serendipity_image_link&#039; href=&#039;https://daniel-lange.com/uploads/entries/081217_BlogDesign_PeteHindle.png&#039; onclick=&quot;F1 = window.open(&#039;/uploads/entries/081217_BlogDesign_PeteHindle.png&#039;,&#039;Zoom&#039;,&#039;height=975,width=1277,top=32,left=9,toolbar=no,menubar=no,location=no,resize=1,resizable=1,scrollbars=yes&#039;); return false;&quot;&gt;&lt;!-- s9ymdb:524 --&gt;&lt;img class=&quot;serendipity_image_right&quot; width=&quot;110&quot; height=&quot;84&quot;  src=&quot;https://daniel-lange.com/uploads/entries/081217_BlogDesign_PeteHindle.serendipityThumb.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Screenshot of Pete Hindle&#039;s blog&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Most common templates for blog systems like Wordpress or Serendipity are very well honed. Usability, accessibility and visual design of these systems and their default templates are are as good as it gets for the time being. Trying to do better usually fails. But &lt;a href=&quot;http://code.google.com/p/wordpress-cli/&quot; title=&quot;Wordpress CLI Homepage at Google code&quot; target=&quot;_blank&quot;&gt;Wordpress-CLI&lt;/a&gt;, which I found at &lt;a href=&quot;http://www.petehindle.com/&quot; title=&quot;Pete Hindle&#039;s blog&quot; target=&quot;_blank&quot;&gt;Pete Hindle&#039;s blog&lt;/a&gt; manages to create a unique design. It may be inspired on the google shell (&lt;a href=&quot;http://goosh.org/&quot; title=&quot;Unofficial Google Shell&quot; target=&quot;_blank&quot;&gt;gosh&lt;/a&gt;) or older incarnations of the concept, e.g. &lt;a href=&quot;http://a-i-studio.com/cmd/&quot; title=&quot;WebCmd: web-based command-line interpreter (shell)&quot; target=&quot;_blank&quot;&gt;WebCmd&lt;/a&gt;, but it is unique because it requires poking and trying stuff to expose the full functionality. A bit like an old school &lt;a href=&quot;http://en.wikipedia.org/wiki/Roguelike&quot; title=&quot;Wikipedia: Rogue-like explained&quot; target=&quot;_blank&quot;&gt;rogue-like&lt;/a&gt; game, it inspires playing with it to find out more. And it reminds nicely of command interfaces to &lt;a href=&quot;http://en.wikipedia.org/wiki/Bulletin_board_system&quot; title=&quot;Wikipedia: BBS - Bulletin Board System&quot; target=&quot;_blank&quot;&gt;BBS&lt;/a&gt; systems although the authors chose a syntax to resemble a unix based shell. You can &lt;a href=&quot;http://thrind.xamai.ca/themes/&quot; title=&quot;Rob McFarland&#039;s themes for Wordpress&quot; target=&quot;_blank&quot;&gt;try out different sub-designs&lt;/a&gt; at &lt;a href=&quot;http://thrind.xamai.ca/&quot; title=&quot;Rob McFarland - the original theme author&#039;s blog&quot; target=&quot;_blank&quot;&gt;Rob McFarland&#039;s&lt;/a&gt; site. Obviously, usability still sucks, but it&#039;s worth it! Well done.
And Pete: Please write some interesting entries in that blog now &lt;img src=&quot;https://daniel-lange.com/plugins/serendipity_event_emoticate/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt;.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Tue, 16 Dec 2008 23:30:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/40-guid.html</guid>
    <category>bash</category>
<category>blog</category>
<category>design</category>

</item>
<item>
    <title>httpdate - set local date and time from a web server</title>
    <link>https://daniel-lange.com/archives/37-httpdate-set-local-date-and-time-from-a-web-server.html</link>
            <category>Linux</category>
    
    <comments>https://daniel-lange.com/archives/37-httpdate-set-local-date-and-time-from-a-web-server.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=37</wfw:comment>

    <slash:comments>5</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=37</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;While &lt;a href=&quot;http://www.ntp.org&quot; title=&quot;Network Time Protocol (NTP) home page&quot; target=&quot;_blank&quot;&gt;ntp&lt;/a&gt; may be a great protocol, I find it quite bloated and slow for the simple purpose of just setting a local date and time to a reference clock. I do not need 20ms accuracy on a notebook&#039;s clock &lt;img src=&quot;https://daniel-lange.com/plugins/serendipity_event_emoticate/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt;.
Thus I use(d) &lt;a href=&quot;http://packages.debian.org/stable/net/rdate&quot; title=&quot;Debian&#039;s rdate page in lack of a proper homepage for the tool itself&quot; target=&quot;_blank&quot;&gt;rdate&lt;/a&gt; for a decade now but the public rdate servers are slowly dying out. So I&#039;m replacing it more and more with &lt;a href=&quot;http://www.clevervest.com/htp/&quot; title=&quot;htpdate home page&quot;&gt;htpdate&lt;/a&gt; which works quite nicely. It&#039;s written in C and a perl alternative is available on the author&#039;s site. There is also a forked &lt;a href=&quot;http://www.rkeene.org/oss/htp/&quot; title=&quot;(Forked) alternative and Windows version of htpdate&quot; target=&quot;_blank&quot;&gt;windows version&lt;/a&gt; of it available.&lt;/p&gt;

&lt;p&gt;Developing a bit larger bash script (which syncs a few servers), I wondered whether I could realize the time sync part in bash as well.&lt;/p&gt;

&lt;p&gt;It&#039;s quite possible:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# open a tcp connection to www.google.com&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exec&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;&amp;gt;/&lt;/span&gt;dev&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;tcp&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;www.google.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;80&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# say hello HTTP-style&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-e&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;GET / HTTP/1.0&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# parse for a Date: line and with a bit of magic throw the date-string at the date command &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;LC_ALL&lt;/span&gt;=C &lt;span style=&quot;color: #007800;&quot;&gt;LANG&lt;/span&gt;=en &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;date&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--rfc-2822&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--utc&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;$(head &amp;lt;&amp;amp;3 | grep -i &amp;quot;Date: &amp;quot; | sed -e s/Date\:\ //I)&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# close the tcp connection&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-weight: normal; vertical-align:top;&quot;&gt;&lt;div style=&quot;font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;exec&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;&amp;amp;&lt;/span&gt;-&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;

&lt;p&gt;Simple, eh?&lt;/p&gt;
 &lt;a class=&quot;block_level&quot; href=&quot;https://daniel-lange.com/archives/37-httpdate-set-local-date-and-time-from-a-web-server.html#extended&quot;&gt;Continue reading &quot;httpdate - set local date and time from a web server&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 22 Oct 2008 21:55:13 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/37-guid.html</guid>
    <category>bash</category>
<category>htpdate</category>
<category>httpdate</category>
<category>ntp</category>
<category>rdate</category>
<category>updated</category>

</item>

</channel>
</rss>
