- matching groups
gawk '{
match($0, /ns0:OpenDate>(.+?)<\/ns0:OpenDate.+?ns0:CloseDate>(.+?)<\/ns0:CloseDate/, Arr)
printf "%s %s\n", Arr[1], Arr[2]
}' *
-Dcom.sun.management.jmxremote | |
-Dcom.sun.management.jmxremote.port=8086 | |
-Dcom.sun.management.jmxremote.ssl=false | |
-Dcom.sun.management.jmxremote.authenticate=false |
logconfig = { | |
"version": 1, | |
"disable_existing_loggers": 0, | |
"root": { | |
"level": "DEBUG", | |
"handlers": [ | |
"console", | |
"file", | |
"debugfile" | |
] |
gawk '{
match($0, /ns0:OpenDate>(.+?)<\/ns0:OpenDate.+?ns0:CloseDate>(.+?)<\/ns0:CloseDate/, Arr)
printf "%s %s\n", Arr[1], Arr[2]
}' *
Threads: | |
Thread is a small piece of code executed separately. | |
Threads are created with three pieces of information | |
Thread name | |
Runnable target - run() | |
stack size | |
Life cycle of a Thread: | |
By using Thread.getState() - we can know the state of the thread. | |
Thread.getState() returns enum state of a thread. |
setup tools: | |
when ever there isa source distribution which consists of setup.py file, we can directly install using the following command | |
# cd foo.1.0/ | |
# python setup.py install | |
if we need to split the build we can use the following commands | |
# python setup.py build | |
# python setup.py install | |
prefix, exec-prefix stands for the directories that Python is installed to, and where it finds its libraries at run-time. |
Install supervisor python3 | |
pip3 install git+https://github.com/Supervisor/supervisor | |
[supervisord] | |
nodaemon=false | |
[supervisorctl] |
import abc | |
class SuperclassMeta(type): | |
def __new__(mcls, classname, bases, cls_dict): | |
cls = super().__new__(mcls, classname, bases, cls_dict) | |
for name, member in cls_dict.items(): | |
if not getattr(member, '__doc__'): | |
member.__doc__ = getattr(bases[-1], name).__doc__ | |
return cls |
""" | |
The built-in __import__ function accomplishes the same goal as using the import statement, | |
but it's an actual function, and it takes a string as an argument. | |
""" | |
sys = __import__('sys') | |
os = __import__('os') | |
re = __import__('re') | |
unittest = __import__('unittest') |
$ sphinx-quickstart | |
In conf.py add the path of the project as follows | |
sys.path.insert(0, os.path.abspath('/home/pavan/code/kafka_project')) | |
# to generate rst files from modules, use the following command | |
$ sphinx-apidoc -o build_docs/api/ -f /home/pavan/code/kafka_project/framework | |
To build the module use the following command in root_directory of sphinx where conf.py, static and templates files are included. | |
$ sphinx-build . _build/ |