chezmoi-ify
This commit is contained in:
parent
e04f3e0fb8
commit
30847ce7ab
13 changed files with 5859 additions and 0 deletions
34
bin/executable_contract
Normal file
34
bin/executable_contract
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python2
|
||||
|
||||
import sys
|
||||
|
||||
loadfile = sys.stdin
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
print("No command to run")
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) == 3:
|
||||
if sys.argv[2] != "-":
|
||||
loadfile = open(sys.argv[2])
|
||||
|
||||
def add(x, y):
|
||||
return x + y
|
||||
|
||||
def sub(x, y):
|
||||
return x - y
|
||||
|
||||
def mult(x, y):
|
||||
return x * y
|
||||
|
||||
def div(x,y):
|
||||
return x / y;
|
||||
|
||||
lis = []
|
||||
for line in loadfile:
|
||||
if line.strip() is not "":
|
||||
x = float(line)
|
||||
lis.append(x)
|
||||
|
||||
print reduce(eval(sys.argv[1]), lis)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue