{"id":5464,"date":"2019-01-25T20:04:51","date_gmt":"2019-01-25T20:04:51","guid":{"rendered":"https:\/\/really.zonky.org\/?p=5464"},"modified":"2019-01-25T20:04:55","modified_gmt":"2019-01-25T20:04:55","slug":"silly-tools-for-the-graphical-terminal-flag","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=5464","title":{"rendered":"Silly Tools for The Graphical Terminal: Flag"},"content":{"rendered":"\n<p>If you are using the right kind of terminal that supports graphics inline (such as <a href=\"https:\/\/sw.kovidgoyal.net\/kitty\/\">KiTTY<\/a>), then you can write simple (or complex) tools that insert images into the terminal.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"422\" src=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/Screenshot-from-2019-01-25-19-53-09.png?resize=695%2C422&#038;ssl=1\" alt=\"\" class=\"wp-image-5465\" srcset=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/Screenshot-from-2019-01-25-19-53-09.png?resize=1024%2C622&amp;ssl=1 1024w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/Screenshot-from-2019-01-25-19-53-09.png?resize=300%2C182&amp;ssl=1 300w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/Screenshot-from-2019-01-25-19-53-09.png?resize=768%2C467&amp;ssl=1 768w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/Screenshot-from-2019-01-25-19-53-09.png?w=1264&amp;ssl=1 1264w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/figure>\n\n\n\n<p>Being able to display the flag of a country (if you know its two-letter ISO code) is kind of trivial but useful if you need it.<\/p>\n\n\n\n<p>And a shell function to do that is remarkably simple :-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function flag {\n    wget -o \/dev\/null -O \/var\/tmp\/flag.$$ http:\/\/flagpedia.net\/data\/flags\/normal\/${1}.png\n    if [ $? -eq 0 ]\n    then\n        kitty +kitten icat \/var\/tmp\/flag.$$ &amp;&amp; rm \/var\/tmp\/flag.$$\n    else\n        echo Not found\n    fi\n}<\/code><\/pre>\n\n\n\n<p>(that&#8217;s a Zsh function which may require adaption to Bash).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are using the right kind of terminal that supports graphics inline (such as KiTTY), then you can write simple (or complex) tools that insert images into the terminal. Being able to display the flag of a country (if you know its two-letter ISO code) is kind of trivial but useful if you need <a href='https:\/\/really.zonky.org\/?p=5464' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[4,209],"tags":[43,1836,1837,402],"class_list":["post-5464","post","type-post","status-publish","format-standard","hentry","category-it","category-linux-it","tag-linux","tag-maps","tag-shell-function","tag-terminal","category-4-id","category-209-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-1q8","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5464"}],"version-history":[{"count":1,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5464\/revisions"}],"predecessor-version":[{"id":5466,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5464\/revisions\/5466"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}