Skip to content

Instantly share code, notes, and snippets.

@hisrarul
hisrarul / add-rsync-to-git-bash.md
Created July 9, 2019 05:13 — forked from hisplan/add-rsync-to-git-bash.md
Add rsync to git bash for windows
@hisrarul
hisrarul / docker-compose.yml
Created March 9, 2020 12:15 — forked from thomasdarimont/docker-compose.yml
Docker OpenLDAP + phpldapadmin example
version: '2'
services:
openldap:
image: osixia/openldap:1.2.3
container_name: openldap
environment:
LDAP_LOG_LEVEL: "256"
LDAP_ORGANISATION: "Example Inc."
LDAP_DOMAIN: "example.org"
LDAP_BASE_DN: ""
@hisrarul
hisrarul / CopyDbTable.md
Last active April 1, 2020 07:27
Copy table from one database to another in MySQL

Chapter 1: How to copy table from one database to another in MySQL?

Scenario: I'm trying to build a Jenkins pipeline. According to the requirement, the pipeline should take backup the content from a database and restore it to the new mysql database running on Kubernetes.

Problem statement

When I have tried to restore the dump to new mysql server. It was creating a database which was backed up during the dump process. In a moment, I realised that my application is trying to hit another database for the content. In this case, I left with two options:

  • Update the code of the application
  • Create a database required by application and copy all the tables from one database to another.
@hisrarul
hisrarul / ConvertTxtToJson.md
Created April 7, 2020 16:16
How to convert plain text log to JSON format using bash scripting?

Chapter 2: How to convert plain text log to JSON format?

I wanted to send the metrics data of an application to the prometheus and grafana.

Problem statement

The application is generating logs in plain text. To send meaningful data to prometheus and grafana it is important to parse them.

Solution

@hisrarul
hisrarul / s3UsageandCost.md
Created April 25, 2020 06:36
Calculate the cost of data stored in AWS S3 Bucket

Chapter 1: Calculate the cost of data stored in AWS S3.

Scenario: There are so many buckets which we are consuming for data stroage. Some of these buckets are costing huge amount to us. Now, we need to find out which bucket is costing more amount so we can plan for data archive.

Problem statement

We need to create the excel sheet which will contain the name of the bucket and the storage occupied by the files in those bucket. The s3 service charges is $0.25 per GB so accordingly we can apply formula in our excel sheet.

Solution

@hisrarul
hisrarul / aws_cli_part1.md
Last active August 11, 2021 00:13
Learn AWS CLI in Easy way

Q.1 Create IAM user using aws cli and name of the user is "devops".

user='devops'
aws iam create-user --user-name $user

Q.2 Create IAM group using aws cli and name of the group is "devops".

group='devops'
aws iam create-group --group-name $group