This file contains 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
curl -X PUT laike9m.com:8080/customer/activate/txn_01jdnt4d10agejfz2cgecvg8ee |
This file contains 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
pdm run pytest [23:39:33] | |
================================================================== test session starts ================================================================== | |
platform darwin -- Python 3.7.12, pytest-6.2.5, py-1.10.0, pluggy-1.0.0 | |
rootdir: /Users/laike9m/Dev/Python/pdir2 | |
plugins: hypothesis-6.21.0, mypy-0.8.1 | |
collected 0 items / 1 error | |
======================================================================== ERRORS ========================================================================= | |
_____________________________________________________________ ERROR collecting test session _____________________________________________________________ | |
__pypackages__/3.7/lib/_pytest/config/__init__.py:570: in _importconftest |
This file contains 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 Solution { | |
public: | |
bool isLetter(char c) { | |
return c >= 'a' && c <= 'z'; | |
} | |
string minRemoveToMakeValid(string s) { | |
stack<pair<char, int>> sta; | |
string ans = ""; | |
string buffer; |
This file contains 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 file is for detecting whether the current interpreter has enabled computed gotos. | |
# See https://stackoverflow.com/q/61860463/2142577 for details. | |
import sys | |
def global_tracer(frame, event_type, arg): | |
assert event_type == "call" | |
print(f"computed gotos enabled: {frame.f_back.f_lasti == 40}") # Win: 38, Mac, Linux: 40 |
This file contains 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
/** | |
* The goal of this program is to obtain a HEALTHY | |
* and SUSTAINABLE relationship, darling. | |
* | |
* @author Cassie Wei from Mili | |
*/ | |
public class sustainPlusPlus { | |
public static void main(String[] args) { | |
World world = new World(); | |
Life me = new Ghost(); |
This file contains 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 Solution: | |
""" | |
@param s: the expression string | |
@return: the answer | |
""" | |
def calculate(self, s): | |
i = 0 | |
left_brac_indexes = [] | |
while i < len(s): |
This file contains 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
http://wiki.c2.com/?RawStrings | |
Raw string 是个通用概念。即 escape 不生效的 string,既然不生效,也无法 escape 掉 ending sequence。 | |
所有语言的 raw string 都面临一个问题,即如何处理 ending sequence | |
Python | |
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals | |
staring sequence: “ or ' | |
ending sequence: “ or ' | |
Python 的做法是允许 ‘, “ 出现,但需要用 \ escape 掉它们(相当于在 Python raw string里有唯一生效的escape就是\”和\’),并且 \ 依然会出现 |
This file contains 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
digraph "Cyberbrain Output" { | |
graph [forcelabels=true]; | |
node [label="\N"]; | |
subgraph "cluster_(0, 0, 0)" { | |
graph [color=lightgrey, | |
label="(0, 0, 0)", | |
overlap=scale, | |
style=filled | |
]; | |
node [color=white, |
This file contains 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
# Tests how EXTENDED_ARG works | |
import bytecode | |
import dis | |
import sys | |
from bytecode import ConcreteInstr, ConcreteBytecode | |
CONST_ARG = 0x1234567 # The real argument we want to set. | |
cbc = bytecode.ConcreteBytecode() | |
cbc.consts = [None] * (CONST_ARG + 1) # Make sure co_consts is big enough. |
This file contains 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 dis | |
import sys | |
def g(x, y): | |
# Code that analyzes outer frame to get passed in arguments. | |
outer_frame = sys._getframe(1) | |
instructions = list(dis.get_instructions(outer_frame.f_code)) | |
call_start_offset = None |
NewerOlder