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
| // 'xoshiro256**' algorithm from lua 5.4 implementation | |
| #include "random.h" | |
| #include <stdint.h> | |
| #include <assert.h> | |
| static inline uint64_t * | |
| state(struct prn_state *P) { | |
| assert(sizeof(*P) == sizeof(uint64_t) * 4); | |
| return (uint64_t *)P; | |
| } |
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/python3 | |
| import gzip | |
| import requests | |
| def find_gzip_level(url): | |
| r = requests.get(url, stream=True) | |
| if r.headers.get('Content-Encoding') != "gzip": | |
| return 0 | |
| data = r.raw.read() |
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
| -- This benchmark compares two ways of creating objects. | |
| -- Output commonly seen on the Lua demo site: | |
| -- | |
| -- Creation time: 0.16 | |
| -- Calling member function time: 0.11 | |
| -- Memory: 2868.8798828125 | |
| -- | |
| -- Creation time: 0.11 | |
| -- Calling member function time: 0.13 | |
| -- Memory: 1697.4736328125 |
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
| import ctypes | |
| import inspect | |
| def global_as_nonlocal(func): | |
| frame = inspect.currentframe().f_back | |
| def wrap_func(): | |
| try: | |
| return eval(func.func_code, frame.f_locals) | |
| except: | |
| raise |
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
| #encoding=utf-8 | |
| ''' | |
| 找出一个锯齿数组里长度大于5的子数组 | |
| 在符合要求的子数组里的数据里找出所有偶数 | |
| 如果数据小于10的话乘以2,大于10的除以2 | |
| 最后统计符合要求的数据的和 | |
| ''' | |
| inputdata = [ | |
| [2,8,9,13,72,67,88,35,44], | |
| [33,28,47,2,10,45,66,92], |