Skip to content

Instantly share code, notes, and snippets.

View mehdi89's full-sized avatar

Mehedi Hasan mehdi89

  • TubeOnAI
  • Dhaka, Bangladesh
  • 01:23 (UTC -12:00)
View GitHub Profile

Here is you Trip Plan

Here is the detailed 7-day itinerary for the trip to Kashmir, India from Jan 25-Feb 15:

Day 1: Arrival and Check-in

  • Arrive at Srinagar Airport and transfer to Hotel Snow Land Srinagar, one of the popular luxury hotels in Kashmir. Get settled in and relax after the long journey.
  • Enjoy the local cuisine for dinner at the hotel's restaurant.
  • Budget: Flight cost - $166, Hotel - $120 per night, Meals - $30
@mehdi89
mehdi89 / create a user as ubuntu after creating a new droplet in digital ocean and allow ssh sudo.md
Created December 20, 2023 16:29
create a user as ubuntu after creating a new droplet in digital ocean and allow ssh sudo

To create a new user with sudo privileges and enable SSH access on an Ubuntu system after creating a new droplet, follow these steps:

  1. Log in to the Droplet: Use SSH to log in to the droplet as the root user.

    ssh root@your_droplet_ip
  2. Create a New User: Replace username with the desired username.

@mehdi89
mehdi89 / install_node_exporter.sh
Last active December 16, 2022 11:34
Install latest node_exporter in ubuntu with one command
wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
tar xvzf node_exporter-*.tar.gz
mv node_exporter-*/node_exporter /usr/local/bin/
# Create a node_exporter user
useradd --no-create-home --shell /bin/false node_exporter
# Set the ownership of the node_exporter binary to the node_exporter user
@mehdi89
mehdi89 / mysql_root.sh
Last active November 24, 2022 07:12
How to set mysql root password after install mysql-server in Ubuntu 22.04
# For DEV Server
sudo systemctl stop mysql.service
sudo systemctl status mysql.service
sudo systemctl set-environment MYSQLD_OPTS="--skip-networking --skip-grant-tables"
sudo systemctl start mysql.service
sudo systemctl status mysql.service
sudo mysql -u root
flush privileges;
@mehdi89
mehdi89 / generateDeployKey.sh
Created May 26, 2022 07:33
generate separate deploy keys for github repos in a os
#!/bin/sh
# This script generates a ssh key for a single repository
# and adds a custom configuration to the users (not global) ssh config file,
# and outputs the public key for you to copy and paste as the repo deploy key
# and outputs the url for you to clone the repo on the machine.
# Github docs ref:
# https://docs.github.com/en/developers/overview/managing-deploy-keys#using-multiple-repositories-on-one-server
#
# 1. Add the script to the user account of the machine. The home directory is fine.
# 2. Make the script executable by running the following command as the user:
@mehdi89
mehdi89 / pro_zsh.sh
Last active December 20, 2022 09:52
Pro ZSH
#!/bin/bash
sudo sed -i 's/auth required pam_shells.so/auth sufficient pam_shells.so/' /etc/pam.d/chsh
sudo apt install curl wget git zsh -y
sudo chsh -s $(which zsh)
#install ohmyzsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
/usr/bin/zsh
@mehdi89
mehdi89 / change_instance.sh
Last active February 11, 2023 07:42
Stop and start a AWS EC2 instance from terminal
#! /bin/bash
INSTANCEID="i-08b39a2442179285a"
INSTANCETYPE=$1
echo "instance id: $INSTANCEID"
echo "instance type: $INSTANCETYPE"
#2>&1 > /dev/null to suppress the cli output
# get instance details to check the current instance type
@mehdi89
mehdi89 / change_aws_instance_type.sh
Last active May 6, 2022 06:29
Change AWS instance type from terminal (stop -> change instance type -> start)
echo "instance id: $1"
echo "instance type: $2"
#2>&1 > /dev/null to suppress the cli output
echo "stopping instance"
aws ec2 stop-instances --instance-ids $1 2>&1 > /dev/null
echo "waiting for instance to stop"
aws ec2 wait instance-stopped --instance-ids $1
@mehdi89
mehdi89 / 01 Installing nginx, php, composer and laravel dependencies into ubuntu server
Last active March 31, 2021 16:06
Deploying simple Laravel Application in AWS with Nginx
sudo add-apt-repository ppa:nginx/stable -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt-get install nginx -y
sudo apt-get install zip unzip php7.4 php7.4-mysql php7.4-fpm php7.4-xml php7.4-gd php7.4-opcache php7.4-mbstring php7.4-zip -y
#install composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer