date +"%T.%N"returns the current time with nanoseconds.06:46:41.431857000date +"%T.%6N"returns the current time with nanoseconds rounded to the first 6 digits, which is microseconds.06:47:07.183172date +"%T.%3N"returns the current time with nanoseconds rounded to the first 3 digits, which is milliseconds.06:47:42.773
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 imaplib | |
| user = '[email protected]' | |
| password = 'xxx' | |
| imap_url = 'imap.gmail.com' | |
| con = imaplib.IMAP4_SSL(imap_url) | |
| con.login(user=user, password=password) | |
| print con.list() |
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
| 1.a- kubectl run | |
| kubectl get pods | |
| kubectl run first-deployment --image=nginx | |
| kubectl get pods | |
| (maybe one more time to show the state changed from container creation to Running) | |
| (copy the pod name from get pods) | |
| kubectl exec -it pod-name -- /bin/bash | |
| echo Hello nginx! > /usr/share/nginx/html/index.html | |
| apt-get update |
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
| # how to take tcpdump | |
| $ tcpdump -i em2 -s0 -vv -w 20190313_1.pcap | |
| # how to filter the msg. | |
| $ editcap -F libpcap -A "2019-03-14 09:30:00" -B "2019-03-14 09:31:00" 20190314_0846.pcap 20190314_0846_m.pcap |
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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # All Vagrant configuration is done below. The "2" in Vagrant.configure | |
| # configures the configuration version (we support older styles for | |
| # backwards compatibility). Please don't change it unless you know what | |
| # you're doing. | |
| Vagrant.configure("2") do |config| | |
| # The most common configuration options are documented and commented below. | |
| # For a complete reference, please see the online documentation at |
Here's a run down of all (ok, most of) of the commands used in the Kubernetes Microservices course
starts minikube.
stops the minikube virtual machine. This may be necessary to do if you have an error when starting
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 redis | |
| import json | |
| import traceback | |
| def r_publisher(): | |
| try: | |
| r = redis.StrictRedis(host='localhost', port=6379) | |
| sample_dict = json.dumps(dict(x=5, y=0)) | |
| r.lpush("dhana", sample_dict) |
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 json | |
| import traceback | |
| import redis | |
| def r_subscriber(): | |
| try: | |
| r = redis.StrictRedis(host='localhost', port=6379) | |
| while r.llen('dhana') != 0: | |
| x = r.lpop('dhana') |
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
| input { | |
| file { | |
| path => "/tmp/*.log" | |
| } | |
| } | |
| filter { | |
| if [message] =~ /ERROR/ { | |
| mutate { | |
| copy => { "path" => "path_tmp" } |
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
| To Download package and store the local 'tmp' folder. | |
| $ pip download -d tmp conan | |
| To install package from chache folder. | |
| $ pip install -r requirements.txt --no-index --find-links file:///home/emadmin/dhana/conan | |