Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A Python library to format, parse, and convert numbers from meters to maghi.
Since 2019, the metre has been defined as the length of the path travelled by light in vacuum during a time interval of 1/299792458 of a second, where the second is defined by a hyperfine transition frequency of caesium.
One second is the time that elapses during 9.192631770 x 10E9 cycles of the radiation produced by the transition between two levels of the cesium-133 atom.
What the hell is even that? How could you ever recreate a precise meter if you found yourself in a forest alone or shipwrecked on a desert island? Important questions. But the International System of Units doesn't care about you.
How do you define a Mago? Simple enough! That's his height:
Of course, you'll have already figured the advantages of such unit of measurement:
Prefix | Name | Factor |
---|---|---|
p | pico | 1e-12 |
n | nano | 1e-9 |
µ, u | micro | 1e-6 |
m | milli | 1e-3 |
c | centi | 1e-2 |
d | deci | 1e-1 |
1e0 | ||
da | deca | 1e1 |
h | etto | 1e2 |
k, K | kilo | 1e3 |
M | mega | 1e6 |
G | giga | 1e9 |
T | tera | 1e12 |
Ensure you have Python and Pip installed in your system and run:
pip install magolib
Alternatively, you can clone this repository, cd
into it, and run pip install .
First off, import magolib
:
import magolib
Next, you can perform all these operations:
>>> magolib.meters_to_maghi(1.0)
0.5181347150259068
>>> magolib.meters_to_maghi(-0.58)
-0.3005181347150259
>>> magolib.meters_to_maghi(2.3e4)
11917.098445595855
>>> magolib.maghi_to_meters(1.0)
1.93
>>> magolib.maghi_to_meters(-42.5)
-82.02499999999999
>>> magolib.maghi_to_meters(1.9e-2)
0.03667
>>> magolib.format_maghi(1.0)
'1.00 ℳ (maghi)'
>>> magolib.format_maghi(3.4e-10)
'340.00 pℳ (picomaghi)'
>>> magolib.format_maghi(23e6)
'23.00 Mℳ (megamaghi)'
>>> magolib.convert_maghi(1.0, '', 'k')
0.001
>>> magolib.convert_maghi(5, 'h', '')
500.0
>>> magolib.convert_maghi(7.2, 'm', 'u')
7200.000000000001
>>> magolib.parse_meters('-2e3 km')
-2000000.0
>>> magolib.parse_meters('1 m')
1.0
>>> magolib.parse_meters('.3 dm')
0.03
>>> magolib.parse_meters('-2e3 km')
-2000000.0
>>> magolib.parse_maghi('1ℳ')
1.0
>>> magolib.parse_maghi('1M')
1.0
>>> magolib.parse_maghi('3 mM')
0.003
Note: here for simplicity you can use an uppercase 'M' in place of the symbol 'ℳ'
FAQs
A library to format and convert numbers in the Mago unit of measure
We found that magolib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.