Skip to content

Commit a23ddc3

Browse files
added 14th Python tip, updated footer
1 parent 1dbaf22 commit a23ddc3

File tree

87 files changed

+177
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+177
-84
lines changed

100-page-python-intro-book-announcement/index.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ I'm addicted to reading fantasy/sci-fi books, so I have a [blog](https://learnby
5656

5757
## Tips
5858

59+
* [Python tip 14: sequence unpacking](https://learnbyexample.github.io/tips/python-tip-14/)
5960
* [Vim tip 12: save and restore sessions](https://learnbyexample.github.io/tips/vim-tip-12/)
6061
* [CLI tip 13: join lines of two files based on the first field](https://learnbyexample.github.io/tips/cli-tip-13/)
6162
* [Python tip 13: formatting numbers with underscore separation](https://learnbyexample.github.io/tips/python-tip-13/)

a-short-and-satisfying-bug-hunt/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@
4040
</span><span style=color:#5597d6;>Not</span><span> fine
4141
</span><span style=color:#5597d6;>$ </span><span style=color:#72ab00;>[</span><span>[ </span><span style=color:#d07711;>'a[5]'</span><span> == </span><span style=color:#d07711;>'a[5]' </span><span style=color:#72ab00;>]</span><span>] </span><span style=color:#72ab00;>&& </span><span style=color:#b39f04;>echo </span><span style=color:#d07711;>'fine'
4242
</span><span style=color:#5597d6;>fine
43-
</span></code></pre><p>Having a minimal failing case from terminal was a relief. I tried <code>set -x</code> but that didn't light a bulb either. Finally, somehow I thought perhaps characters in the output was causing the issue and when <code>[]</code> characters were not present, the comparison worked as expected.<p>I did think quoting could be the issue, but dismissed it at first as both sides of comparison had the same command. Then my recent experience from reviewing <a href=https://www.packtpub.com/application-development/command-line-fundamentals>Command Line Fundamentals</a> book came in handy. I remembered that if quotes aren't used on RHS of comparison operator, it is treated as <code>glob</code> matching instead of string matching. Phew.<h2 id=tl-dr>TL;DR<a aria-label="Anchor link for: tl-dr" class=zola-anchor href=#tl-dr>🔗</a></h2><p>Always <a href=https://unix.stackexchange.com/questions/131766/why-does-my-shell-script-choke-on-whitespace-or-other-special-characters>quote strings in bash</a> unless you have a very good reason for not using them.<p>After adding double quotes around the command substitution commands, the script worked as expected. I thanked the user for opening the issue. And then informed the author for cli fundamentals book as well.</div><div class=post-footer><div class=post-tags><a href=https://learnbyexample.github.io/tags/shell-scripting/>#shell scripting</a><a href=https://learnbyexample.github.io/tags/debugging/>#debugging</a><a href=https://learnbyexample.github.io/tags/corner-case/>#corner case</a></div><p>👉 Use <a href=https://learnbyexample.github.io/atom.xml>this link</a> for the Atom feed. <br> 👉 Follow me on <a href=https://twitter.com/learn_byexample>Twitter</a>, <a href=https://github.com/learnbyexample>GitHub</a> and <a href=https://www.youtube.com/channel/UCKdFGbeOUPYM9GocmrIFGcw/playlists>Youtube</a> for interesting tech nuggets.<hr color=#e6e6e6></div></article></div></main></div><script src=https://learnbyexample.github.io/even.js></script>
43+
</span></code></pre><p>Having a minimal failing case from terminal was a relief. I tried <code>set -x</code> but that didn't light a bulb either. Finally, somehow I thought perhaps characters in the output was causing the issue and when <code>[]</code> characters were not present, the comparison worked as expected.<p>I did think quoting could be the issue, but dismissed it at first as both sides of comparison had the same command. Then my recent experience from reviewing <a href=https://www.packtpub.com/application-development/command-line-fundamentals>Command Line Fundamentals</a> book came in handy. I remembered that if quotes aren't used on RHS of comparison operator, it is treated as <code>glob</code> matching instead of string matching. Phew.<h2 id=tl-dr>TL;DR<a aria-label="Anchor link for: tl-dr" class=zola-anchor href=#tl-dr>🔗</a></h2><p>Always <a href=https://unix.stackexchange.com/questions/131766/why-does-my-shell-script-choke-on-whitespace-or-other-special-characters>quote strings in bash</a> unless you have a very good reason for not using them.<p>After adding double quotes around the command substitution commands, the script worked as expected. I thanked the user for opening the issue. And then informed the author for cli fundamentals book as well.</div><div class=post-footer><div class=post-tags><a href=https://learnbyexample.github.io/tags/shell-scripting/>#shell scripting</a><a href=https://learnbyexample.github.io/tags/debugging/>#debugging</a><a href=https://learnbyexample.github.io/tags/corner-case/>#corner case</a></div><p>📰 Use <a href=https://learnbyexample.github.io/atom.xml>this link</a> for the Atom feed. <br> ✅ Follow me on <a href=https://twitter.com/learn_byexample>Twitter</a>, <a href=https://github.com/learnbyexample>GitHub</a> and <a href=https://www.youtube.com/c/learnbyexample42>Youtube</a> for interesting tech nuggets. <br> 📧 Subscribe to <a href=https://learnbyexample.gumroad.com/l/learnbyexample-weekly>learnbyexample weekly</a> for programming resources, tips, tools, free ebooks and more (free newsletter, delivered every Friday).<hr color=#e6e6e6></div></article></div></main></div><script src=https://learnbyexample.github.io/even.js></script>

about/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang=en><head><meta content="IE=edge" http-equiv=X-UA-Compatible><meta content="text/html; charset=utf-8" http-equiv=content-type><meta content="width=device-width,initial-scale=1.0,maximum-scale=1" name=viewport><title>learnbyexample</title><link href=https://learnbyexample.github.io/atom.xml rel=alternate title=RSS type=application/atom+xml><script src=https://cdnjs.cloudflare.com/ajax/libs/slideout/1.0.1/slideout.min.js></script><link href=https://learnbyexample.github.io/site.css rel=stylesheet><link href=https://learnbyexample.github.io/favicon.svg rel=icon><link rel="shortcut icon" href=https://learnbyexample.github.io/favicon.png><body><div class=container><div class=mobile-navbar id=mobile-navbar><div class=mobile-header-logo><a class=logo href=/>learnbyexample</a></div><div class="mobile-navbar-icon icon-out"><span></span><span></span><span></span></div></div><nav class="mobile-menu slideout-menu slideout-menu-left" id=mobile-menu><ul class=mobile-menu-list><li class=mobile-menu-item><a href=https://learnbyexample.github.io/books> Books </a><li class=mobile-menu-item><a href=https://learnbyexample.github.io/mini> Mini </a><li class=mobile-menu-item><a href=https://learnbyexample.github.io/tips> Tips </a><li class=mobile-menu-item><a href=https://learnbyexample.github.io/tags> Tags </a><li class=mobile-menu-item><a href=https://learnbyexample.github.io/about> About </a></ul></nav><header id=header><div class=logo><a href=https://learnbyexample.github.io>learnbyexample</a></div><nav class=menu><ul><li><a href=https://learnbyexample.github.io/books> Books </a><li><a href=https://learnbyexample.github.io/mini> Mini </a><li><a href=https://learnbyexample.github.io/tips> Tips </a><li><a href=https://learnbyexample.github.io/tags> Tags </a><li><a href=https://learnbyexample.github.io/about> About </a></ul></nav></header><main><div class=content id=mobile-panel><div class=about><p align=center><img alt=profile src=/images/lbe.png><p>Hello!👋<p>I'm <strong>Sundeep Agarwal</strong> and this is my super duper awesome programming blog. Use <a href=https://learnbyexample.github.io/atom.xml>this link</a> for the Atom feed.<p>I've written 12 <a href=https://learnbyexample.github.io/books/>programming books</a> and there's always another book that I'm working on. Visit <a href=https://learnbyexample.gumroad.com/>Gumroad</a> or <a href=https://leanpub.com/u/learnbyexample>Leanpub</a> to buy PDF/EPUB versions of my books. See <a href=https://github.com/learnbyexample/scripting_course#ebooks>this list</a> for free online versions.<p>Subscribe to <a href=https://learnbyexample.gumroad.com/l/learnbyexample-weekly>learnbyexample weekly</a> for programming resources, book announcements, deals and more (free newsletter, delivered every Friday).<p>See my <a href=https://learnbyexample.github.io/escapist-reviews/>Escapist reviews</a> blog for thoughts about fictional books (fantasy, sci-fi, etc).<p>Follow me on <a href=https://twitter.com/learn_byexample>Twitter</a>, <a href=https://github.com/learnbyexample>GitHub</a> and <a href=https://www.youtube.com/channel/UCKdFGbeOUPYM9GocmrIFGcw/playlists>Youtube</a> for interesting tech nuggets.</p><br><h2 id=acknowledgements>Acknowledgements</h2><ul><li>This blog has been generated using <a href=https://github.com/getzola/zola>zola</a> and uses <a href=https://github.com/getzola/even>even theme</a> with modifications<li><a href=https://commons.wikimedia.org/wiki/File:Warning_icon.svg>Warning</a> and <a href=https://commons.wikimedia.org/wiki/File:Info_icon_002.svg>Info</a> icons by <a href=https://commons.wikimedia.org/wiki/User:Amada44>Amada44</a> under public domain<li><a href=https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd>MDN: kbd</a> — CSS for <code>&LTkbd></code> tag<li><a href=https://inkscape.org/>Inkscape</a> for favicon<li><a href=https://pngquant.org/>pngquant</a> and <a href=https://github.com/RazrFalcon/svgcleaner>svgcleaner</a> for optimizing images<li>See <a href=https://github.com/learnbyexample/learnbyexample.github.io/releases/tag/v1.0>v1.0 tag</a> for the older version of the blog, which was based on <a href=https://github.com/mmistakes/so-simple-theme>So Simple Jekyll Theme</a></ul></div></div></main></div><script src=https://learnbyexample.github.io/even.js></script>
1+
<!doctype html><html lang=en><head><meta content="IE=edge" http-equiv=X-UA-Compatible><meta content="text/html; charset=utf-8" http-equiv=content-type><meta content="width=device-width,initial-scale=1.0,maximum-scale=1" name=viewport><title>learnbyexample</title><link href=https://learnbyexample.github.io/atom.xml rel=alternate title=RSS type=application/atom+xml><script src=https://cdnjs.cloudflare.com/ajax/libs/slideout/1.0.1/slideout.min.js></script><link href=https://learnbyexample.github.io/site.css rel=stylesheet><link href=https://learnbyexample.github.io/favicon.svg rel=icon><link rel="shortcut icon" href=https://learnbyexample.github.io/favicon.png><body><div class=container><div class=mobile-navbar id=mobile-navbar><div class=mobile-header-logo><a class=logo href=/>learnbyexample</a></div><div class="mobile-navbar-icon icon-out"><span></span><span></span><span></span></div></div><nav class="mobile-menu slideout-menu slideout-menu-left" id=mobile-menu><ul class=mobile-menu-list><li class=mobile-menu-item><a href=https://learnbyexample.github.io/books> Books </a><li class=mobile-menu-item><a href=https://learnbyexample.github.io/mini> Mini </a><li class=mobile-menu-item><a href=https://learnbyexample.github.io/tips> Tips </a><li class=mobile-menu-item><a href=https://learnbyexample.github.io/tags> Tags </a><li class=mobile-menu-item><a href=https://learnbyexample.github.io/about> About </a></ul></nav><header id=header><div class=logo><a href=https://learnbyexample.github.io>learnbyexample</a></div><nav class=menu><ul><li><a href=https://learnbyexample.github.io/books> Books </a><li><a href=https://learnbyexample.github.io/mini> Mini </a><li><a href=https://learnbyexample.github.io/tips> Tips </a><li><a href=https://learnbyexample.github.io/tags> Tags </a><li><a href=https://learnbyexample.github.io/about> About </a></ul></nav></header><main><div class=content id=mobile-panel><div class=about><p align=center><img alt=profile src=/images/lbe.png><p>Hello!👋<p>I'm <strong>Sundeep Agarwal</strong> and this is my super duper awesome programming blog. Use <a href=https://learnbyexample.github.io/atom.xml>this link</a> for the Atom feed.<p>I've written 12 <a href=https://learnbyexample.github.io/books/>programming books</a> and there's always another book that I'm working on. Visit <a href=https://learnbyexample.gumroad.com/>Gumroad</a> or <a href=https://leanpub.com/u/learnbyexample>Leanpub</a> to buy PDF/EPUB versions of my books. See <a href=https://github.com/learnbyexample/scripting_course#ebooks>this list</a> for free online versions.<p>Subscribe to <a href=https://learnbyexample.gumroad.com/l/learnbyexample-weekly>learnbyexample weekly</a> for programming resources, book announcements, deals and more (free newsletter, delivered every Friday).<p>See my <a href=https://learnbyexample.github.io/escapist-reviews/>Escapist reviews</a> blog for thoughts about fictional books (fantasy, sci-fi, etc).<p>Follow me on <a href=https://twitter.com/learn_byexample>Twitter</a>, <a href=https://github.com/learnbyexample>GitHub</a> and <a href=https://www.youtube.com/c/learnbyexample42>Youtube</a> for interesting tech nuggets.</p><br><h2 id=acknowledgements>Acknowledgements</h2><ul><li>This blog has been generated using <a href=https://github.com/getzola/zola>zola</a> and uses <a href=https://github.com/getzola/even>even theme</a> with modifications<li><a href=https://commons.wikimedia.org/wiki/File:Warning_icon.svg>Warning</a> and <a href=https://commons.wikimedia.org/wiki/File:Info_icon_002.svg>Info</a> icons by <a href=https://commons.wikimedia.org/wiki/User:Amada44>Amada44</a> under public domain<li><a href=https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd>MDN: kbd</a> — CSS for <code>&LTkbd></code> tag<li><a href=https://inkscape.org/>Inkscape</a> for favicon<li><a href=https://pngquant.org/>pngquant</a> and <a href=https://github.com/RazrFalcon/svgcleaner>svgcleaner</a> for optimizing images<li>See <a href=https://github.com/learnbyexample/learnbyexample.github.io/releases/tag/v1.0>v1.0 tag</a> for the older version of the blog, which was based on <a href=https://github.com/mmistakes/so-simple-theme>So Simple Jekyll Theme</a></ul></div></div></main></div><script src=https://learnbyexample.github.io/even.js></script>

0 commit comments

Comments
 (0)