This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # typical to sum over your list of items perhaps | |
| # performing some calculation on each item | |
| normalizing_constant = \ | |
| sum([calc(item) for item in items if filter(item)]) | |
| r = random.random() | |
| for item in items: | |
| prob = get_probability(item) / normalizing_constant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import urllib,urllib2, sys | |
| BASE_URL = 'http://192.168.100.101:5000' | |
| ADMIN_PASS = 'YOUR ADMIN PASS' | |
| # Login to admin interface | |
| parameters = {'username' : 'admin', 'passwd':ADMIN_PASS,'service_type':'1'} | |
| request = urllib2.Request(BASE_URL+'/webman/modules/login.cgi', urllib.urlencode(parameters)) |
NewerOlder