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
| parser=argparse.ArgumentParser() | |
| parser.add_argument('-k','--kwarg',nargs=3,action='append') | |
| args=parser.parse_args('-k mass 100 inf -k spin 0.5 1.0'.split()) | |
| Namespace(kwarg=[['mass', '100', 'inf'], ['spin', '0.5', '1.0']]) | |
| they could be converted to a dictionary with an expression like: | |
| vargs={key:(float(v0),float(v1)) for key,v0,v1 in args.kwarg} | |
| which could be passed to your function as: |
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 collections import defaultdict | |
| tree = lambda: defaultdict(tree) | |
| t = tree() | |
| t[1][2][3] = 4 | |
| t[1][3][3] = 5 | |
| t[1][2]['test'] = 6 |
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 argparse | |
| import time | |
| GB = 1024 * 1024 * 1024 | |
| def parse_cmd_args(): | |
| """ | |
| Parses command line args | |
| """ | |
| parser = argparse.ArgumentParser(description='Memory Eating utility for python') |
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 A | |
| { | |
| private: | |
| int _privInt = 0; | |
| int privFunc(){return 0;} | |
| virtual int privVirtFunc(){return 0;} | |
| protected: | |
| int _protInt = 0; | |
| int protFunc(){return 0;} | |
| public: |
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
| { | |
| "version": "0.1.0", | |
| "tasks": [ | |
| { | |
| "taskName": "Build", | |
| "command": "make", | |
| "args": ["-B"], | |
| "isShellCommand": true, | |
| "isBuildCommand": true | |
| } |
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
| bool areEqualRel(float a, float b, float epsilon) { | |
| return (fabs(a - b) <= epsilon * std::max(fabs(a), fabs(b))); | |
| } | |
| struct PointCompare | |
| { | |
| bool operator() (const Point3D< float >& lhs, const Point3D< float >& rhs) const | |
| { | |
| if (lhs[0] < rhs[0]) { | |
| return true; |
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 <iostream> | |
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <cmath> | |
| using namespace std; | |
| struct node { | |
| int key; | |
| node* next; |