Skip to content

Instantly share code, notes, and snippets.

View AyemunHossain's full-sized avatar
🔥
Focusing on AWS

Ayemun Hossain AyemunHossain

🔥
Focusing on AWS
View GitHub Profile
@AyemunHossain
AyemunHossain / mysql_remove_linux.txt
Last active December 10, 2024 12:47
Remove mysql completely from linux
sudo -i
service mysql stop
killall -KILL mysql mysqld_safe mysqld
apt-get --yes purge mysql*
apt-get --yes autoremove --purge
apt-get autoclean
deluser --remove-home mysql
delgroup mysql
rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld ~/.mysql_history
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
@AyemunHossain
AyemunHossain / kill_.sh
Created November 19, 2024 15:49
Kill a port's process
#!/bin/bash
# Check if the user provided a port number
if [ -z "$1" ]; then
echo "Usage: $0 <PORT>"
exit 1
fi
# Extract the port number from the first argument
PORT=$1
@AyemunHossain
AyemunHossain / kineticCss.html
Last active August 28, 2024 04:45
Kinetic Css Loader
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
@AyemunHossain
AyemunHossain / cmd.txt
Created August 17, 2024 10:49
Install Node with nvm
sudo apt install curl
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.bashrc
nvm install 16.19.0
@AyemunHossain
AyemunHossain / nodeSocketRedisExample.txt
Created June 5, 2024 05:08
Nodejs Socket and redis example
1. Install dependencies:
npm install express socket.io redis
2. Nodejs Code:
const express = require('express');
const http = require('http');
const socketIo = require('socket.io');
const redis = require('redis');
@AyemunHossain
AyemunHossain / csvToReadmeQuestionAnswer.py
Created February 19, 2024 11:07
Convert CSV file to Githubreadme question answer pattern
import csv
# Read the CSV file
def read_csv(file_path):
rows = []
with open(file_path, newline='', encoding='utf-8') as csvfile:
reader = csv.reader(csvfile)
header = next(reader) # Skip header
for row in reader:
rows.append(row)
@AyemunHossain
AyemunHossain / shuffleCSV.py
Created February 15, 2024 08:11
Shuffle a csv file rows
import csv
import random
def clean_csv(input_file, output_file):
# Open the input CSV file for reading
with open(input_file, 'r', newline='') as csvfile:
reader = csv.reader(csvfile)
# Read all rows except the header
rows = list(reader)[1:]
@AyemunHossain
AyemunHossain / cheatsheet-elasticsearch.md
Last active October 10, 2023 09:03 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@AyemunHossain
AyemunHossain / file-upload-to-s3.js
Created September 14, 2023 11:30
Get all files form a directory and upload them s3
const directoryPath = __dirname;
const fs = require('fs');
const path = require('path');
const AWS = require('aws-sdk');
AWS.config.update({
endpoint: new AWS.Endpoint("**********************"),
accessKeyId: "**********************",
secretAccessKey: "********************",
});
const s3 = new AWS.S3();
@AyemunHossain
AyemunHossain / allCountryWithShortNameAndFullName.txt
Created September 14, 2023 05:28
All Country with short and full name
{
"ad": "Andorra",
"ae": "United Arab Emirates",
"af": "Afghanistan",
"ag": "Antigua and Barbuda",
"ai": "Anguilla",
"al": "Albania",
"am": "Armenia",
"ao": "Angola",
"aq": "Antarctica",