Skip to content

Instantly share code, notes, and snippets.

View xei's full-sized avatar
👨‍💻
Coding...

Hamidreza Hosseinkhani xei

👨‍💻
Coding...
View GitHub Profile
@xei
xei / extract_frames_from_video.py
Created February 18, 2024 21:59
Extract a sampled range of frames from a video using OpenCV
import os
from typing import Optional
import cv2
from tqdm import tqdm
def extract_frames_from_video(
target_dir: str,
video_path: str,
@xei
xei / load-amazon-review-dataset.ipynb
Created August 10, 2023 18:12
Load Amazon Review Dataset.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xei
xei / healthz.py
Created June 25, 2023 10:40
A simple Python script to check if all the services are healthy and notify the issues.
import requests
skype_notifier_url = 'https://ml.hosseinkhani.me/skype-notifier/send-msg/chat/incident-group'
api_endpoints = {
'Service 1': 'http://ml.hosseinkhani.me/service1/healthz',
'Service 2': 'http://ml.hosseinkhani.me/service2/healthz',
}
@xei
xei / README.md
Last active June 25, 2023 10:22
Gitlab CI Runner

gitlab-runner

This repository contains a script to setup and register a Gitlab Runner container.

Setup Runner on the cluster

chmod +x start-runner.sh
./start-runner.sh
@xei
xei / README.md
Last active June 25, 2023 10:06
Traefik as ingress node for Docker swarm mode

traefik

This repository contains the docker-compose.yml file for deploying Traefik as a proxy for Docker swarm mode.

Create Traefik network

docker network create --driver=overlay traefik
@xei
xei / README.md
Created July 14, 2021 12:55
Generate an RSA-signed JWT
$ chmod +x jwt-generator.sh
$ ./jwt-generator.sh '{"alg": "RS256"}' '{"user_name": "xei", "iat": $(date +%s), "exp": 1859006535}' 'RSA256_PRIVATE_KEY.pem' $RSA_PASSPHRASE
location /mag {
proxy_pass http://mag.example.com;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
access_log /var/log/nginx/mag.example.com.access.log;
error_log /var/log/nginx/mag.example.com.error.log;
}
@xei
xei / HOST_NAME
Created September 24, 2020 09:10
Setup Nginx web server
### Server block - /etc/nginx/sites-available/HOST_NAME
### It sould be soft-linked form /etc/nginx/sites-enabled/HOST_NAME in order to be enabled.
server {
listen 80;
listen [::]:80;
server_name HOST_NAME;
return 301 https://$host$request_uri;
@xei
xei / mysql.md
Last active June 25, 2023 10:48
How to setup different databases (MySql, Postgres, Redis, ...)

Setup MySQL

MySQL is a relational database management system (RDBMS) that enables you to deliver high-performance and scalable Online Transaction Processing (OLTP) applications.

Install MySQL on Ubuntu

    $ sudo apt update
    $ sudo apt install mysql-server
@xei
xei / .gitlab-ci-node.yml
Last active January 17, 2023 10:10
Gitlab CI YML files. (react & node)
cache:
#key: "$CI_BUILD_REF_NAME"
paths:
- node_modules/
#- .npm/
Build App:
image: node:latest
stage: build
script: