Skip to content

Instantly share code, notes, and snippets.

View bugcy013's full-sized avatar
🪄
Focusing

Dhanasekaran Anbalagan bugcy013

🪄
Focusing
View GitHub Profile
@bugcy013
bugcy013 / get_imap_folders.py
Last active March 21, 2019 17:41
Get IMAP Folder from python
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()
@bugcy013
bugcy013 / Course-Kubernetes-Commands-and-YAML.txt
Created March 16, 2019 12:49
Course-Kubernetes-Commands-and-YAML.txt
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
@bugcy013
bugcy013 / editcap
Last active March 14, 2019 15:12
filter tcpdump msg ( based on timestamp. )
# 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
  • date +"%T.%N" returns the current time with nanoseconds. 06:46:41.431857000
  • date +"%T.%6N" returns the current time with nanoseconds rounded to the first 6 digits, which is microseconds. 06:47:07.183172
  • date +"%T.%3N" returns the current time with nanoseconds rounded to the first 3 digits, which is milliseconds. 06:47:42.773
# -*- 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
@bugcy013
bugcy013 / Kubernetes - Quick Command Reference.md
Last active March 3, 2019 10:10
Kubernetes - Quick Command Reference

Kubernetes - Quick Command Reference

Here's a run down of all (ok, most of) of the commands used in the Kubernetes Microservices course

Minikube

minikube start

starts minikube.

minikube stop

stops the minikube virtual machine. This may be necessary to do if you have an error when starting

minikube delete

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)
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')
@bugcy013
bugcy013 / logstash_conf.txt
Created September 11, 2018 23:26
logstash_conf
input {
file {
path => "/tmp/*.log"
}
}
filter {
if [message] =~ /ERROR/ {
mutate {
copy => { "path" => "path_tmp" }
@bugcy013
bugcy013 / gist:d28405c830740ed0c9cf1670004c81d3
Created July 24, 2018 14:31
pip install without internet
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