Skip to content

Instantly share code, notes, and snippets.

View musleh0001's full-sized avatar
🎯
Focusing

Md Musleh Uddin musleh0001

🎯
Focusing
  • W3 Engineers Ltd.
  • Dhaka, Bangladesh
  • 22:49 (UTC +06:00)
  • X @musleh_x_khan
View GitHub Profile
services:
db:
image: postgres:latest
container_name: db
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
ports:
@musleh0001
musleh0001 / style.css
Created July 21, 2022 17:26
CSS base style
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default margin */
* {
margin: 0;
@musleh0001
musleh0001 / ssh.sh
Created June 8, 2022 07:09
SSH Tutorial
# Create ssh server
sudo apt install openssh-server
sudo ufw allow ssh
# Connect
ssh username@host --> give password
ssh-copy-id user@host
ssh user@host
@musleh0001
musleh0001 / nginx.sh
Created June 5, 2022 18:18
Nginx Concept and Commands
Configuration files: /etc/nginx
Binary / executable files: /usr/sbin
Log directory of files: /var/log/nginx
Data or Document directory files: /usr/share/nginx
@musleh0001
musleh0001 / postgresql.sql
Last active May 27, 2022 14:56
PostgreSQL Commands
# Run using docker image
docker run --name db --rm -e POSTGRES_PASSWORD="mypasswd" -d postgres:alpine
docker exec -it db bash --> get inside container
# Copy file to docker container
docker cp foo.txt container_id:/foo.txt
docker run
--name postgresql
-e POSTGRES_USER=myusername
@musleh0001
musleh0001 / type-check.py
Created March 28, 2022 05:13
Python Typing - Type Hints & Annotations
# static code analysis (mypy)
# mypy main.py [check miss match]
from typing import List, Dict, Set, Optional, Any, Sequence, TypeVar
def add_numbers(a: int, b: int, c: int) -> None:
print(a + b + c)
add_numbers(1, 2, 3)
x: List[List[int]] = [[1, 2, 3], [1, 2, 3]] # nested list
@musleh0001
musleh0001 / docker.cmd
Last active May 27, 2022 19:21
Basic Docker Commands
docker --version [list docker version]
docker run hello-world
docker container ls
docker container ls -a
docker contianer rm -f $(docker container ls -aq) [remove all container]
docker image ls
docker images
docker image rm <image-name> [remove docker image]
@musleh0001
musleh0001 / vim.md
Last active July 21, 2022 17:35
vim command

*********** Vim Config **********

call plug#begin('~/.vim/plugged')

Plug 'tomasiser/vim-code-dark'
Plug 'pangloss/vim-javascript'
Plug 'scrooloose/nerdtree'
Plug 'morhetz/gruvbox'
Plug 'leafgarland/typescript-vim'
@musleh0001
musleh0001 / decorators.py
Created February 28, 2022 07:39
Decorator Example
from functools import wraps
def my_logger(orig_func):
import logging
logging.basicConfig(
filename="{}.log".format(orig_func.__name__), level=logging.INFO
)
@wraps(orig_func)
@musleh0001
musleh0001 / generators.py
Created February 28, 2022 06:13
Generator Memory Efficient
import memory_profiler as mem_profile
import random
import time
names = ["John", "Corey", "Adam", "Steve", "Rick", "Thomas"]
majors = ["Math", "Engineering", "CompSci", "Arts", "Business"]
print(f"Memory (Before): {mem_profile.memory_usage()}Mb")