Skip to content

Instantly share code, notes, and snippets.

@mCzolko
Last active September 7, 2022 23:32
Show Gist options
  • Select an option

  • Save mCzolko/81652a0be36286f46f526f4baf8243b9 to your computer and use it in GitHub Desktop.

Select an option

Save mCzolko/81652a0be36286f46f526f4baf8243b9 to your computer and use it in GitHub Desktop.

Revisions

  1. mCzolko revised this gist Sep 7, 2022. 1 changed file with 8 additions and 5 deletions.
    13 changes: 8 additions & 5 deletions md.sh
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,14 @@ const calculate = (arg) => {
    const o2percentage = Number(arg)
    const fO2 = o2percentage / 100

    const mod = (ppO2) => (((ppO2 / fO2) - 1) * 10).toFixed(2)
    const mod = (ppO2) => Number((((ppO2 / fO2) - 1) * 10).toFixed(2))

    console.log(`EAN${o2percentage} MOD on ppO2:`)
    console.log(` [1.4] ${mod(1.4)}m`)
    console.log(` [1.6] ${mod(1.6)}m (deco gas)`)
    console.log(`EAN${o2percentage} (content ${o2percentage}% oxygen)`)

    console.table({
    '': { ppO2: 1.4, m: mod(1.4) },
    deco: { ppO2: 1.6, m: mod(1.6) },
    }, ['ppO2', 'm'])

    if (process.argv.indexOf(arg) != process.argv.length - 1) {
    console.log('')
    @@ -17,4 +20,4 @@ const calculate = (arg) => {

    const [ runner, command, ...o2percentages ] = process.argv

    o2percentages.forEach(calculate)
    o2percentages.forEach(calculate)
  2. mCzolko revised this gist Sep 7, 2022. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions md.sh
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,4 @@ const calculate = (arg) => {

    const [ runner, command, ...o2percentages ] = process.argv

    o2percentages.forEach(o2p => {
    calculate(o2p)
    })
    o2percentages.forEach(calculate)
  3. mCzolko created this gist Sep 7, 2022.
    22 changes: 22 additions & 0 deletions md.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/bin/node

    const calculate = (arg) => {
    const o2percentage = Number(arg)
    const fO2 = o2percentage / 100

    const mod = (ppO2) => (((ppO2 / fO2) - 1) * 10).toFixed(2)

    console.log(`EAN${o2percentage} MOD on ppO2:`)
    console.log(` [1.4] ${mod(1.4)}m`)
    console.log(` [1.6] ${mod(1.6)}m (deco gas)`)

    if (process.argv.indexOf(arg) != process.argv.length - 1) {
    console.log('')
    }
    }

    const [ runner, command, ...o2percentages ] = process.argv

    o2percentages.forEach(o2p => {
    calculate(o2p)
    })