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
| #define WIN32_LEAN_AND_MEAN | |
| #define SECURITY_WIN32 | |
| #include <Windows.h> | |
| #include <WinCrypt.h> | |
| #include <Security.h> | |
| #include <stdio.h> | |
| #pragma comment(lib, "crypt32") | |
| #define skip(...) do { printf(__VA_ARGS__); goto out; } while (0) |
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
| >>> for line in data: | |
| ... print "checking", line, | |
| ... m = re.search("latitude.*'(.*)'", line) | |
| ... if m: | |
| ... print m.group(1) | |
| ... | |
| checking function geoip_country_code() { return 'RU'; } | |
| checking function geoip_country_name() { return 'Russian Federation'; } | |
| checking function geoip_city() { return 'Moscow'; } | |
| checking function geoip_region() { return '48'; } |
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
| def calc_jtt(start, end, now): | |
| now = now.datetime() | |
| end = end.datetime() | |
| start = start.datetime() | |
| hlen = (end - start).seconds/6.0 | |
| tnow = (now - start).seconds | |
| return tnow/hlen |
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
| proxy = None | |
| proxydict = urllib2.ProxyHandler().proxies | |
| for type in ["https", "http", "socks"]: | |
| if type not in proxydict: | |
| continue | |
| proxyline = proxydict[type] | |
| schemalen = length(type + 3) # "<schema>://" | |
| if proxyline[:schemalen] == "%s://" % type | |
| proxyline = proxyline[schemalen:] | |
| proxAddr, proxPort = proxyline.split(":") |
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
| #include <stdio.h> | |
| int a() { | |
| printf("a called\n"); | |
| return 0; | |
| } | |
| int b() { | |
| printf("b called\n"); | |
| return 0; |
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
| #include <stdio.h> | |
| #include <math.h> | |
| typedef unsigned long long int val_t; | |
| val_t naive_calc(val_t n, val_t min) { | |
| val_t k; | |
| for (k = min; k < n; k++) | |
| if (n / k == n / (k + 1)) | |
| return k; |
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
| #include <stdio.h> | |
| int data[] = { 3, 4, 6, 5, 11, 2, 19, 1}; | |
| int main() { | |
| int min, when_min, buy, sell; | |
| int i; | |
| int profit; | |
| profit = when_min = buy = sell = 0; | |
| min = data[0]; |
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
| long passed, next; | |
| /* adjust the transition */ | |
| do { | |
| passed = System.currentTimeMillis() - sync; | |
| Log.d(TAG, "Adjust at "+l2s(passed+sync)+", sync was at "+l2s(sync)+" "+passed+"ms passed"); | |
| if (tr.isEmpty()) { | |
| /* request more items */ | |
| exhausted(); | |
| if (tr.isEmpty()) { | |
| Log.d(TAG, "no transitions"); |
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
| do { | |
| rc = sqlite3_step(stm); | |
| switch (rc) { | |
| case SQLITE_ROW: | |
| data.iface = sqlite3_column_text(stm, 0); | |
| cnt->incoming_bytes = sqlite3_column_int64(stm, 1); | |
| cnt->outgoing_bytes = sqlite3_column_int64(stm, 2); | |
| if (info_cb(&data, user_data) == PCL_CANCEL) | |
| rc = SQLITE_DONE; /* emulate end of data */ | |
| break; |
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
| def is_black(p): | |
| return (p[0] | p[1] | p[2]) == 0 | |
| class FlatImage: | |
| def __init__(self, path): | |
| self.image = Image.open(path) | |
| self.labels = [[0]*100]*100 | |
| self.pix = self.image.load() | |
| self.flat = [] |