Difference between revisions of "Miscellaneous"

From Useful Things
Jump to: navigation, search
 
Line 4: Line 4:
 
</pre>
 
</pre>
  
== Currency converter ==
+
== Bash currency converter ==
 
<pre>
 
<pre>
 
cconv() {
 
cconv() {

Latest revision as of 13:11, 14 April 2015

How many additional threads did a process spawn?

strace <process_name> 2>&1 | grep -e fork -e clone | wc -l

Bash currency converter

cconv() {
	wget -qO- "https://www.google.com/finance/converter?a=$1&from=$2&to=$3" |  sed '/res/!d;s/<[^>]*>//g';
}
eclipse ~ # cconv 11 usd eur
11 USD = 10.3103 EUR
eclipse ~ # cconv 3 usd nzd
3 USD = 3.9888 NZD
eclipse ~ # cconv 1 usd nzd
1 USD = 1.3296 NZD
eclipse ~ # cconv 1 nzd usd
1 NZD = 0.7523 USD