Below you will find pages that utilize the taxonomy term “python”
Finding an Efficient Solution on Reading and Comparing CSV files
I have always worked with Linux Systems and thus Bash was my go to tool for some specific tasks. But now I am much more aware with Python than Bash as it does give me better grasp on things. I am not saying that for server scripting, Bash can not do some tasks. It can be used in a vast area of things to solve. But I am now comfortable with Python more.
Recently, I did stumble upon of a task that was related to comparing two huge CSV files.
SSH Config and Ansible Host Generator and Why I am doing it this way?
I am recently playing the role as an SRE and that is why I have to deal with a lot of servers. Not only cloud once or clusters but also bare metals as well as Virtual Machines. For more systematic environment preparation, I have Gitlab pipeline. But for basic tasks like change the config on demand or check a specific directory or search something or any other unpredictable or repeated tasks, I need Ansible for better grasp from my local machine or Bastion server. So, what do I have to do?
- Create an entry to the .ssh/config file
- Create an entry ansible host file as inventory
Repeated tasks? For me, yes. I needed to manage these. So, created a python script
My Understanding about RUN, CMD and ENTRYPOINT in Dockerfile
Containerization gives us many benefits from packaging to distribution and others. Thus, Docker is widely used as a containerization tool which is designed for running specific tasks and processes, not for hosting operating systems or like other virtualization tools like VMWare, VirtualBox etc. You create a container to serve a single unit task. Once it completes the given task, it stops. The container life-cycle depends on the ongoing process inside of it. Once the process stops,
Effective use of Redis with Python and Connection Pool
I have been working with redis and python for sometime. It is fun to play with python and redis. There are so many things can be solved by redis.
- Session persistency
- Caching
- Volatile Datastore
- Job or Message Queue
- Search
And many more. But recently I was thinking about using it as main database. I am not yet sure what kind of problem I might face or what things to optimize when it is about scalability or reliability. I will for sure share my experience.
Here I want to talk about –
How to run Python Flask Application?
I mostly use Python Flask when I need to develop a Web App or API.
Why? Because it is:
- lightweight
- Very Flexible
- Micro-Service Friendly
- Fast Development
These are one of the main reasons I choose Flask. But mostly I love to code with Flask. There are so many ways to run flask applications. I will write some of them here with code examples.
Apache Kafka in Docker Container and Implement it’s Functionalities with Python
According to the website, Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.
In this post, I am going to share a basic way to start using Apache Kafka with python.
Pythons datetime of a timezone
In python, we can use datetime module from standard library for manipulating dates and times. From the documentation, we can say, date and time objects may be categorized as “aware” or “naive” depending on whether or not they include timezone information. How can we get a datetime?
Again Fibonacci Series and Python
I have already wrote a piece about generating Fibonacci series in BASH, here in my blog. But today I am gonna do some practice stuff with Python.
We all I guess know about Fibonacci. It is connected to nature through the golden ratio and the spirals. It is a very interesting series to learn or research deeply. However, I came to know that there is a day declared as “Fibonacci Day” which is every 23rd, November. But why?
Multi line Log Parser in Python
So, I have a log file that is not single line log. It is kind of java stack trace. What I needed to do is read those log files and create some actions depending on them. I could use already built tools. But I thought why not just do this as simply as printing strings.
This is an example of the log format I wanted to play with. It seems too simple to pile up the Filebeats or elastic stack.
Some coding practice with Json, Itertools and Lambda in Python
I enjoy coding and solving problems. But as I go forward, I find myself in a sea of unknowns. Thus I decided to learn as much as possible to be confident. So, I am learning even the simplest it seems.
Other side of Python eval() function
The built-in function “eval()” of python is useful in many cases. But I am gonna talk about it’s negative one.
Let, you have a function that take arguments from user. If you do eval() on that input, it might create a havoc.
What does eval() do in Python?
I have always loved the fact that The Python interpreter has a number of functions and types built into it. I am going to explore “eval()” in this article.