Skip to content

Instantly share code, notes, and snippets.

View hasanparasteh's full-sized avatar
:octocat:

Hasan Parasteh hasanparasteh

:octocat:
View GitHub Profile
use std::future::{ready, Ready};
use actix_web::{
body::EitherBody,
dev::{self, Service, ServiceRequest, ServiceResponse, Transform},
web, Error, HttpResponse,
};
use futures_util::future::LocalBoxFuture;
use crate::{types::GenericResponse, utils::is_request_length_valid};
@hasanparasteh
hasanparasteh / innodb-monit.sh
Created September 21, 2022 14:39
InnoDB MYSQL Monitoring Using MysqlShell. You just need to install `jq` and `mysql-shell` and save passwords only for first time
#/bin/sh
now=$(date +"%T")
servers=(server1 server2 server3)
selectedServer=${servers[ $RANDOM % ${#servers[@]} ]}
echo "Randmoly Selected $selectedServer for getting information..."
echo "Conntecting to the server..."
@hasanparasteh
hasanparasteh / ss.sh
Last active June 13, 2022 16:35
setups a simple shadowsocks server
#!/bin/bash
# upgrade ubuntu and install snapd
sudo apt update && apt upgrade -y
sudo apt install -y snapd
sudo snap install shadowsocks-libev
# server configurations
sudo mkdir -p /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev
@hasanparasteh
hasanparasteh / range-slider.vue
Created February 5, 2022 06:38
Range Slider Component With Labels #vue3
<template>
<div class="range-slider">
<span class="line"></span>
<span ref="fillLine" class="fill-line"></span>
<ul>
<li v-for="value in values" :key="value" @click="makeItemActive">
{{ value.title }}
</li>
</ul>
</div>
@hasanparasteh
hasanparasteh / bank-identify.js
Created January 24, 2022 22:26
A complete list of Iran ibans and cards number to identify bank
// List of all cards
const cards = [
{
62198619: {
persian: 'بلو',
english: 'blue',
},
},
{
603799: {
@hasanparasteh
hasanparasteh / fix-mtu.sh
Last active January 18, 2022 18:16
Fix MTU size in ArvanCloud servers permanently
#!/bin/sh
# Root access?
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
# set tab size to 4 spaces
tabs 4
echo "Enter your network name: "
read NETPLAN_NAME
@hasanparasteh
hasanparasteh / summation.py
Created December 4, 2021 05:42
Calculate summation of each row and whole matrix in parallel
import multiprocessing as mp
import random
from typing import List
class ParallelSummation:
def __init__(self) -> None:
self.matrix: List = []
def randomize_matrix(self, n: int, m: int) -> List:
@hasanparasteh
hasanparasteh / Table.vue
Created August 17, 2021 10:56
Table that works everywhere
<template>
<v-row no-gutters>
<v-col v-if="tableLength > 0" cols="12" style="width: 100%;overflow: auto;">
<div dir="rtl" role="table">
<slot name="header"></slot>
<slot name="body"></slot>
</div>
</v-col>
<v-col v-else>
<div style="width:100%;margin:0 auto">
@hasanparasteh
hasanparasteh / cloudSettings
Last active March 1, 2022 18:14
MP4 compressor using ffmpeg. it just scale down the video....
{"lastUpload":"2022-03-01T18:01:59.668Z","extensionVersion":"v3.4.3"}
@hasanparasteh
hasanparasteh / buildAndPush.yml
Created May 9, 2021 06:56
Build project and moves it into server via SCP
name: CI
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
build: