Skip to content

luasenvy/ulauncher-expr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ulauncher Expr

demo

ulauncher Extension for A Python Expression Evaluator.

Features

Evaluate the formula using Python eval().

Useful Examples

Arithmetic Operation:

expr 1 + 1 = 2
expr 2 * 4 = 8

Math Functions:

expr math.pow(2, 5)   = 32.0
expr math.floor(10.5) = 10.0

Python String Expression:

expr 1000 >> 1  = 500
expr 'x' == 'x' = True

Python String Format

Python String Format Examples:

expr '{0}, {1}!'.format('hello', 'world') = hello, world!
expr '%s, %s!' % ('hello', 'world')       = hello, world!
expr 'py' * 3                             = pypypy
expr '{:,}'.format(10000000)              = 10,000,000

More Informations

When you want float result, concat .0 to expression:

expr 10 / 3   = 3
expr 10 / 3.0 = 3.33333333

You can use braket:

expr 2 + 2 * 2     = 6
expr ( 2 + 2 ) * 2 = 8

IMPORTANT Restricted to use only math Functions:

expr dir()         // name 'dir' is not defined

Risks of eval()

IMPORTANT Python's eval function can be dangerous. global variables are restricted to use only math Functions. But use careful.

There are a variety of issues with the vulnerability, but the following documents provide a brief overview.

Requirements

Install

Open ulauncher preferences window -> extensions -> add extension and paste the following url:

https://github.com/luasenvy/ulauncher-expr

Icon

Calculator Icon by Eezy in E-commerce And Shopping find with iconfinder

Creative Commons (Attribution-Share Alike 3.0 Unported)

Development

git clone https://github.com/luasenvy/ulauncher-expr
cd ~/.local/share/ulauncher/extensions/
ln -s <repo_location>

To see your changes, stop ulauncher and run it from the command line with:

ulauncher -v

License

MIT

About

Ulauncher Extension - Python Expression Evaluator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages