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/env python | |
| import itertools | |
| import unittest | |
| def primeGenerator(): | |
| """ | |
| Yields an array of primes. | |
| """ |
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
| """ | |
| We are trying to determine which offenses can be matched to a candidate. Candidates names' often do not match exactly to criminal records, but still represent the candidate. We are given a JSON file of possible criminal offenses and a candidate's aliases. We use a point system to judge how well a record matches to a candidate. | |
| The point system starts out at 100 (100% accurate) being an exact match. We can do 4 edit types to a record name to get to an exact match of one of the candidate's aliases. | |
| Edits: | |
| A middle name swapped with a first name subtracts 7 points | |
| A first name nickname swap subtracts 5 points | |
| A middle name nickname swap subtracts 3 points |
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
| from eventlet.green import socket | |
| from helpers import dict_merge | |
| SOH = u'\u0001' | |
| ETX = u'\u0003' | |
| alarm_category_code_mapping = dict( | |
| name = 'alarm/warning category', | |
| len = 2, | |
| format = 'AA', |
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/env python3 | |
| """ | |
| This is a 100% self-contained script to facilitate automated creation of bidirectional UDP pinholes. | |
| It should work as a non-root user assuming you use a high port number. | |
| All that is necessary is an SSH server with a Python environment. | |
| This script is ran on the client, and then the client runs it on the server dynamically. | |
| No permanent changes are made to the server. | |
| Basically we just open UDP connection from both ends, to the same port, and then exchange some tokens to verify connectivity. |
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
| ModelView | |
| --------- | |
| # field1 (->Model1), field2 (->Model2) filtered by field1 values | |
| column_filter_by = ('field2') | |
| form_widget_args = { | |
| 'field2': { | |
| 'data-filter-by': 'field1', | |
| } | |
| } |
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/env python | |
| def str_to_hex(string): | |
| return "-".join("{:02x}".format(ord(c)) for c in str(string)) | |
| def chunks(s, n): | |
| for start in range(0, len(s), n): | |
| yield s[start:start+n] | |
| delimiter = '%-12345X@PJL' |
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
| class FilterLowercase(BaseMongoEngineFilter): | |
| def apply(self, query, value): | |
| flt = {'%s__icontains' % self.column: value} | |
| return query.filter(**flt) | |
| def operation(self): | |
| return gettext('contains') | |
| class FilterLowercaseNot(BaseMongoEngineFilter): | |
| def apply(self, query, value): |
NewerOlder