Archive

Archive for May, 2010

UFW Firewall HOWTO

May 25th, 2010

Add rule

root@firefly:/data/music# ufw allow from 10.200.80.132 to any port 3689

Delete rule by line number.

root@firefly:/data/music# ufw delete 1
Deleting:
allow 3689
Proceed with operation (y|n)? y
Rule deleted


View current rules

root@firefly:/data/music# ufw status
Status: active

To                         Action      From
–                         ——      —-
22                         ALLOW       Anywhere
21                         ALLOW       Anywhere
3689                       ALLOW       10.200.80.132

Uncategorized

Python: simple salary calc script

May 21st, 2010

#!/usr/bin/python

def main():
salary1 = input(”Enter Salary #1: “)
salary2 = input(”Enter Salary #2: “)

# SET GLOBAL TO SHARE VARS
global x
global y

if(salary1 < salary2):
x=salary1
y=salary2
else:
y=salary1
x=salary2

def make_percent():
global total

total = 100-(float(x)/float(y)*100)
total=int(round(total,0))
print “Total Difference:”,total,”%”

main()
make_percent()

root@donkey:~/tech/core# python calc_number_diff.py
Enter Salary #1: 75
Enter Salary #2: 76
Total Difference: 1 %

Uncategorized