{"id":1964,"date":"2023-09-18T17:31:27","date_gmt":"2023-09-19T00:31:27","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1964"},"modified":"2023-09-18T17:40:53","modified_gmt":"2023-09-19T00:40:53","slug":"392-pipeline-in-bash-to-obtain-ratio-between-euro-and-usd","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2023\/09\/392-pipeline-in-bash-to-obtain-ratio-between-euro-and-usd\/","title":{"rendered":"#392 Pipeline in bash to obtain ratio between Euro and USD"},"content":{"rendered":"<p>Pipeline in bash to obtain ratio between Euro and USD:<\/p>\n<p>to run in Ubuntu:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nchmod a+x ex392.txt\r\n.\/ex392.txt\r\n<\/pre>\n<p>ex392.txt<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\necho &quot;min Euro\/USD:&quot;\r\ncurl -s https:\/\/www.ecb.europa.eu\/stats\/eurofxref\/eurofxref-hist.zip | gunzip \\\r\n| sqlite3 -csv ':memory:' '.import \/dev\/stdin stdin' &quot;select Date, USD from stdin order by USD asc limit 10;&quot;\r\necho &quot; &quot;\r\necho &quot;max USD\/Euro:&quot;\r\ncurl -s https:\/\/www.ecb.europa.eu\/stats\/eurofxref\/eurofxref-hist.zip | gunzip \\\r\n| sqlite3 -csv ':memory:' '.import \/dev\/stdin stdin' &quot;select Date, USD from stdin order by USD desc limit 10;&quot;\r\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nmin Euro\/USD:\r\n2000-10-26,0.8252\r\n2000-10-25,0.8307\r\n2000-10-27,0.8324\r\n2000-10-23,0.8377\r\n2001-07-06,0.8384\r\n2000-10-24,0.8386\r\n2000-11-27,0.8406\r\n2000-10-19,0.8411\r\n2000-10-31,0.8417\r\n2001-07-05,0.8422\r\n\r\nmax Euro\/USD:\r\n2008-07-15,1.599\r\n2008-04-23,1.594\r\n2008-04-22,1.5931\r\n2008-04-16,1.5928\r\n2008-07-22,1.5919\r\n2008-04-21,1.5898\r\n2008-07-16,1.5888\r\n2008-07-03,1.5885\r\n2008-04-10,1.5875\r\n2008-04-17,1.5872\r\n<\/pre>\n<p>1) \u0441url downloads official historical data published by the European Central Bank on the position of the euro relative to other currencies. (The -s flag is to not show a progress bar or error messages.)<\/p>\n<p>2) This data comes in the form of a zip file, which gunzip will extract.<\/p>\n<p>3) sqlite3 reads CSV. The :memory option of sqlite says to use the file in memory. After this, .import \/dev\/stdin stdin tells sqlite to load standard input into a table named stdin. The line following it is an SQL query.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pipeline in bash to obtain ratio between Euro and USD: to run in Ubuntu: chmod a+x ex392.txt .\/ex392.txt ex392.txt echo &quot;min Euro\/USD:&quot; curl -s https:\/\/www.ecb.europa.eu\/stats\/eurofxref\/eurofxref-hist.zip | gunzip \\ | sqlite3 -csv &#8216;:memory:&#8217; &#8216;.import \/dev\/stdin stdin&#8217; &quot;select Date, USD from stdin order by USD asc limit 10;&quot; echo &quot; &quot; echo &quot;max USD\/Euro:&quot; curl -s https:\/\/www.ecb.europa.eu\/stats\/eurofxref\/eurofxref-hist.zip [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"yes","_lmt_disable":"","jetpack_post_was_ever_published":false,"_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":""},"categories":[8,20],"tags":[],"class_list":["post-1964","post","type-post","status-publish","format-standard","hentry","category-bash","category-linux"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-vG","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":2219,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/06\/431-hypermesh-python-script-to-create-nodes-using-coordinates-from-csv-file\/","url_meta":{"origin":1964,"position":0},"title":"#431 HyperMesh python script to create nodes using coordinates from csv file","author":"gantovnik","date":"2024-06-24","format":false,"excerpt":"Finally, I read how to write a script for HyperMesh in python. In this example, the script reads the coordinates of points from a cvs file. [code language=\"python\"] import os import hm import hm.entities as e from hwx import gui import csv model=hm.Model() os.chdir(r\"D:\\projects\\wordpress\\ex431\") with open('ex431_coordinates.csv', mode ='r') as file:\u2026","rel":"","context":"In &quot;HyperMesh&quot;","block_context":{"text":"HyperMesh","link":"https:\/\/gantovnik.com\/bio-tips\/category\/hypermesh\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2024\/06\/ex431.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2857,"url":"https:\/\/gantovnik.com\/bio-tips\/2024\/07\/438-large-language-model-llm-library-transformers-for-natural-language-processing-nlp-in-python\/","url_meta":{"origin":1964,"position":1},"title":"#438 Large language model (LLM) library Transformers for natural language processing (NLP) in python","author":"gantovnik","date":"2024-07-20","format":false,"excerpt":"Transformers One of the most prominent libraries for modern natural language processing (NLP) model frameworks, Transformers comes from the NLP powerhouse Hugging Face. The variety of pre-trained models available in Transformers is vast, with both foundational and fine-tuned models designed for tasks such as text classification, translation, question answering, and\u2026","rel":"","context":"In &quot;machine learning&quot;","block_context":{"text":"machine learning","link":"https:\/\/gantovnik.com\/bio-tips\/category\/machine-learning\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1923,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/377-stacked-histogram-on-a-log-scale-using-seaborn\/","url_meta":{"origin":1964,"position":2},"title":"#377 Stacked histogram on a log scale using seaborn library","author":"gantovnik","date":"2023-08-10","format":false,"excerpt":"[code language=\"python\"] #Stacked histogram on a log scale import matplotlib.pyplot as plt import matplotlib as mpl #conda install -c anaconda seaborn import seaborn as sns sns.set_theme(style=\"ticks\") def main(): diamonds = sns.load_dataset(\"diamonds\") f, ax = plt.subplots(figsize=(7, 5)) sns.despine(f) sns.histplot( diamonds, x=\"price\", hue=\"cut\", multiple=\"stack\", palette=\"light:m_r\", edgecolor=\".3\", linewidth=.5, log_scale=True, ) ax.xaxis.set_major_formatter(mpl.ticker.ScalarFormatter()) ax.set_xticks([500, 1000,\u2026","rel":"","context":"In &quot;plot&quot;","block_context":{"text":"plot","link":"https:\/\/gantovnik.com\/bio-tips\/category\/plot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex377.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex377.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex377.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex377.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":996,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/10\/178-fractal-tree-using-python-turtle\/","url_meta":{"origin":1964,"position":3},"title":"#178 Fractal tree using python turtle","author":"gantovnik","date":"2021-10-06","format":false,"excerpt":"#178 Fractal tree using python turtle [code language=\"python\"] import turtle # Set up 'constants' # image size IMAGE_SIZE_X = 500 IMAGE_SIZE_Y = 500 # Determines depth of tree - try 2 and 1.25 as alternatives FACTOR = 1.45 def draw_tree(length, width=9): color = 'brown' if length < 1: return elif\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/10\/ex178.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":894,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/02\/160-max-and-min-using-argmax-and-argmax-in-python\/","url_meta":{"origin":1964,"position":4},"title":"#160 Max and min using argmax and argmax in python","author":"gantovnik","date":"2021-02-14","format":false,"excerpt":"#160 Max and min using argmax and argmax in python [code language=\"python\"] import numpy as np import matplotlib.pyplot as plt import os os.chdir(r'D:\\projects\\wordpress\\ex160') os.getcwd() def main(): N = 100 L = 1 def f(i, n): x = i * L \/ N lam = 2 * L \/ (n+1) return\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/02\/example160.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/02\/example160.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/02\/example160.png?resize=525%2C300 1.5x"},"classes":[]},{"id":575,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/06\/83-application-saving-the-data-to-csv-file\/","url_meta":{"origin":1964,"position":5},"title":"#83 Application, Saving the data to csv file","author":"gantovnik","date":"2020-06-13","format":false,"excerpt":"[code language=\"python\"] from datetime import datetime import os import csv import tkinter as tk from tkinter import ttk class LabelInput(tk.Frame): \"\"\"A widget containing a label and input together.\"\"\" def __init__(self, parent, label='', input_class=ttk.Entry, input_var=None, input_args=None, label_args=None, **kwargs): super().__init__(parent, **kwargs) input_args = input_args or {} label_args = label_args or {} self.variable\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/06\/2020-06-13_025234.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/06\/2020-06-13_025234.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/06\/2020-06-13_025234.jpg?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=1964"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1964\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}