Skip to content

Instantly share code, notes, and snippets.

View NedaMani's full-sized avatar
🙃
I may be slow to respond.

Alireza Mohamadzadeh (NedaMani) NedaMani

🙃
I may be slow to respond.
View GitHub Profile
@NedaMani
NedaMani / dns-changer.sh
Last active April 7, 2025 15:31
a fast way for dns change(based on systemd) - Especially for Iranians
#!/bin/bash
dns1=(78.157.42.100 78.157.42.101)
dns2=(178.22.122.100 185.51.200.2)
dns3=(172.29.2.100 172.29.0.100)
dns4=(185.55.226.26 185.55.225.25)
echo "0) Reset to default"
echo "1) Electro"
echo "2) Shecan"
@NedaMani
NedaMani / rectanglesInsideRectangles.js
Created March 5, 2024 14:46
rectanglesInsideRectangle
const rectanglesInsideRectangle = (M, N) => {
let rectangles = (M*(M+1)/2) * (N*(N+1)/2);
let min = Math.min(M, N);
let squares = min*(min+1)*(2*min+1)/6;
return rectangles + squares;
}
function ConvertToFaNumber(str: string): string {
const FaDigits = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹'];
return str.replace(/\d/g, d => FaDigits[parseInt(d)]);
}
function ConvertToEnNumber(str: string): string {
const FaDigits = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹'];
return str.replace(/[۰-۹]/g, d => FaDigits.indexOf(d).toString());
}