Skip to content

Instantly share code, notes, and snippets.

View miladj3's full-sized avatar
💭
I loved microsoft

milad jafari miladj3

💭
I loved microsoft
View GitHub Profile
@miladj3
miladj3 / irping.sh
Created November 14, 2024 09:13 — forked from ArmanTaheriGhaleTaki/irping.sh
using https://check-host.net/check-ping ping API to check if a IP is accessible from Iran
irping() {
ip=$1
nodes=("ir1" "ir3" "ir5" "ir6")
for node in "${nodes[@]}"; do
# Make the API request and store the response
response=$(curl -s -H "Accept: application/json" "https://check-host.net/check-ping?host=${ip}&node=ir1.node.check-host.net&node=ir3.node.check-host.net&node=ir5.node.check-host.net&node=ir6.node.check-host.net")
# Check for "limit_exceeded" error in the response
error_message=$(echo "$response" | jq -r '.error')
if [ "$error_message" == "limit_exceeded" ]; then
@miladj3
miladj3 / automatic_FFMPEG_script
Created November 14, 2024 09:13 — forked from ArmanTaheriGhaleTaki/automatic_FFMPEG_script
this is a bash script that compress MP4 formatted videos in a folder automatically and name the output as [Videoname] _compressed.mp4
#!/bin/bash
VIDEOS=$(ls *.mp4)
for VIDEO in $VIDEOS
do
ffmpeg -i $VIDEO -vcodec libx265 -crf 28 -f mp4 ${VIDEO%%.*}_compressed.mp4
done
@miladj3
miladj3 / myAngular.html
Created November 2, 2024 13:08 — forked from faustinoaq/myAngular.html
Front-end libraries (React, Vue, Angular) and the basic principles of how they work, all in a single file using pure JavaScript (VanillaJS).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Angular from Scratch</title>
<style>
.my-component {
font-family: Arial, sans-serif;
@miladj3
miladj3 / retryDynamicImport.ts
Created October 13, 2024 12:15 — forked from mberneti/retryDynamicImport.ts
This utility function retryDynamicImport enhances React’s lazy loading mechanism by adding retry logic with a versioned query parameter. It retries importing a component multiple times in case of failure, which can be useful for bypassing browser cache or dealing with intermittent network issues. It can be used as a drop-in replacement for React…
// Usage:
// Replace React.lazy(() => import('x'));
// with retryDynamicImport(() => import('x'));
import { ComponentType, lazy } from 'react';
const MAX_RETRY_COUNT = 15;
const RETRY_DELAY_MS = 500;
// Regex to extract the module URL from the import statement
@miladj3
miladj3 / openwrt-setup.md
Created July 5, 2024 15:56 — forked from ahbanavi/openwrt-setup.md
My OpenWrt Initial Setup (Passwall2 + extroot + vnstat)

My OpenWrt Initial Setup

My Router Info

  • Model: Linksys EA8100
  • Memory: 256MB
  • Storage: Using 16GB thumb drive as extroot
  • OpenWrt Version: OpenWrt 23.05.3 r23809-234f1a2efa / LuCI openwrt-23.05 branch git-24.073.29889-cd7e519

Extroot

const body = document.body;
console.log('ddddd');
const iframe = document.createElement('iframe');
iframe.src = 'https://embeded.receptstatus.nl';
iframe.setAttribute('width', '100%');
iframe.setAttribute('height', '500');
function slowmo(rate = 10) {
window._raf = window.requestAnimationFrame
window.requestAnimationFrame = f => window._raf(t => f(t/rate))
Date._now = Date.now
Date.now = () => Date._now() / rate
performance._now = performance.now
performance.now = () => performance._now()/rate
}
slowmo()
@miladj3
miladj3 / bd3d4befe38185704bf0fc875e9deed6\configuration.json
Last active May 16, 2020 16:26
Visual Studio Code Settings Sync Gist
{"contents":{"launch":{"version":"0.2.0","configurations":[{"type":"vslsRemoteLaunch","name":"BasketikWeb","request":"attach","projectID":"697c5987-d2ff-48ea-929b-f2d2f80fe7c8"},{"type":"vslsRemoteLaunch","name":"BasketikWeb.Test","request":"attach","projectID":"15fada41-2315-48b0-a194-b0c4bfa5cc75"}]}},"overrides":[],"keys":["launch.version","launch.configurations"]}
@miladj3
miladj3 / audiocrawl-interactive-masthead.markdown
Created May 18, 2018 17:25
AudioCrawl Interactive Masthead