Skip to content

Instantly share code, notes, and snippets.

View MrMohebi's full-sized avatar
📚
Learning

MMMohebi MrMohebi

📚
Learning
View GitHub Profile
@MrMohebi
MrMohebi / deskicon.sh
Created July 30, 2022 04:51
create desktop icon and symbol link for executable file
#!/bin/bash
usage() {
__usage="
Usage: $(basename $0) [OPTIONS]
Options:
-p, executable path <string> [required] Absolute path to executable file
-i, icon path <string> [required] Absolute path ti icon file
-c, command <string> [required] Command shortcut name for executable file
@MrMohebi
MrMohebi / I'm an early 🐤
Last active October 3, 2023 01:14
📊 productive times
🌞 Morning 428 commits ███████▎░░░░░░░░░░░░░ 35.0%
🌆 Daytime 677 commits ███████████▌░░░░░░░░░ 55.3%
🌃 Evening 109 commits █▊░░░░░░░░░░░░░░░░░░░ 8.9%
🌙 Night 10 commits ▏░░░░░░░░░░░░░░░░░░░░ 0.8%
@MrMohebi
MrMohebi / 📊 Weekly development breakdown
Last active October 3, 2023 00:41
📊 Weekly development breakdown
TypeScript 6 hrs 48 mins ████████▌░░░░░░░░░░░░ 40.6%
JSON 3 hrs 53 mins ████▉░░░░░░░░░░░░░░░░ 23.3%
Vue.js 1 hr 40 mins ██░░░░░░░░░░░░░░░░░░░ 10.0%
YAML 1 hr 21 mins █▋░░░░░░░░░░░░░░░░░░░ 8.1%
SCSS 1 hr 18 mins █▋░░░░░░░░░░░░░░░░░░░ 7.8%
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
class HelloWorld {
public static void main(String[] args) {
String xOctals = "\\151\\152\\153\\226";
System.out.println(xOctals);
String[] xOctalsArr = xOctals.split("\\\\");
@MrMohebi
MrMohebi / Dockerfile-api
Created April 11, 2022 08:46
TEST DOCKER FILE
FROM php:8.0
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN apt-get update -y && apt-get upgrade -y && apt-get install git libssl-dev -y
# Install unzip utility and libs needed by zip PHP extension
RUN apt-get update && apt-get install -y \
zlib1g-dev \
libzip-dev \
@MrMohebi
MrMohebi / passedTime.ts
Last active April 5, 2022 07:07
convert timestamp to passed time from now in Persian
type ICal = (differenceSeconds: number) => string
interface IComparisons {
graterThan: number,
lessThan: number,
action: ICal
}
export function passedTime(timestamp: number, faNum: boolean = false): string {
@MrMohebi
MrMohebi / numToPersianString.js
Last active April 4, 2022 07:31
convert number in string to Persian string
const numberToString = (str:string):string=>{
let firstNum = (str.match(/\d+/) ?? [undefined])[0]
// couldn't find number
if(isNaN(+firstNum)) return str;
const num = parseInt(firstNum)
const stringNum = (num)=>{
switch (num) {
function WebConsole(element) {
var that = this;
this.element = element;
this.inputElement = null;
this.actions = {};
this.actionExitCode = {
ok: 'ok',
error: 'error',
@MrMohebi
MrMohebi / Docker
Created March 31, 2022 06:56
add fob proxy for installing gitlab libs in Docker file
RUN apt-get install -y netcat
RUN mkdir -p ~/.ssh/
RUN touch ~/.ssh/config
RUN echo 'Host gitlab.com' >> ~/.ssh/config
RUN echo 'ProxyCommand nc -X connect -x fodev.org:8118 %h %p' >> ~/.ssh/config
RUN git config --global http.proxy fodev.org:8118
@MrMohebi
MrMohebi / iranProvinceCities.js
Last active March 29, 2022 06:10
Iran province and cities list
const eastazarbaijan1 = ['آذرشهر' ,'اسکو' ,'اهر' ,'بستان‌آباد' ,'بناب' ,'تبریز' ,'جلفا' ,'چاراویماق' ,'سراب' ,'شبستر', 'مراغه'];
const westazarbaijan2 = ['ارومیه' ,'اشنویه' ,'بوکان' ,'پیرانشهر' ,'تکاب' ,'چالدران' ,'خوی' ,'سردشت' ,'سلماس' ,'شاهین‌دژ' ,'ماکو' ,'مهاباد' ,'میاندوآب' ,'نقده'];
const ardabil3 = ['اردبیل' ,'بیله‌سوار' ,'پارس‌آباد' ,'خلخال' ,'کوثر' ,'گِرمی' ,'مِشگین‌شهر' ,'نَمین' ,'نیر'];
const esfahan4 = ['آران و بیدگل' ,'اردستان' ,'اصفهان' ,'برخوار و میمه' ,'تیران و کرون' ,'چادگان' ,'خمینی‌شهر' ,'خوانسار' ,'سمیرم' ,'شهرضا' ,'سمیرم سفلی' ,'فریدن' ,'فریدون‌شهر' ,'فلاورجان' ,'کاشان' ,'گلپایگان' ,'لنجان' ,'مبارکه' ,'نائین' ,'نجف‌آباد' ,'نطنز'];
const ilam5 = ['آبدانان' ,'ایلام' ,'ایوان' ,'دره‌شهر' ,'دهلران' ,'شیروان و چرداول' ,'مهران'];
const booshehr6 = ['بوشهر' ,'تنگستان' ,'جم' ,'دشتستان' ,'دشتی','دیر' ,'دیلم' ,'کنگان' ,'گناوه'];
const tehran7 = ['اسلام‌شهر' ,'پاکدشت' ,'تهران' ,'دماوند' ,'رباط‌کریم' ,'ری' ,'ساوجبلاغ' ,'شمیرانات' ,'شهریار' ,'فیروزکوه' ,'ورامین'];
const