Skip to content

Instantly share code, notes, and snippets.

View BesrourMS's full-sized avatar
🏠
Working from home

Mohamed Safouan Besrour BesrourMS

🏠
Working from home
View GitHub Profile
@BesrourMS
BesrourMS / ie.js
Created November 1, 2019 13:18
Check if user use Internet Explorer
function msieversion() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number
{
alert('Pour une meilleur utilisation de service, nous vous conseillons de télécharger Google Chrome');
}
return false;
}
@BesrourMS
BesrourMS / index.html
Created November 25, 2021 13:49
Plyr + WebTorrent
<video id="player" controls></video>
@BesrourMS
BesrourMS / get-solana-balance-web3-js.markdown
Created December 25, 2021 15:10
Get Solana Balance Web3.js
@BesrourMS
BesrourMS / tmpn.txt
Created January 29, 2024 13:31
Tunisian Mobile Phone Number
^(?:(?:+216|00216)\s?[2-9]\d{7}|[:2459]\d{7})$
@BesrourMS
BesrourMS / extract.py
Last active April 23, 2024 16:06
whois.tn
from bs4 import BeautifulSoup
import json
html_content = '''
<div dir="ltr">
<h1>Whois ? : Résultat de la vérification</h1>
<p><strong style="color:#C00;">Le nom de domaine kh.tn est déjà enregistré !</strong></p><p></p>
<h2><strong>Nom de domaine :</strong> <a href="http://www.kh.tn" target="_blank">kh.tn</a></h2>
<h3><p><strong>Détails:</strong></p></h3>
<ul><p></p><li><strong>Date création: </strong>13-12-2022 09:49:40 GMT+1</li></ul>
@BesrourMS
BesrourMS / main.py
Created January 7, 2025 11:50
Flights API
from fastapi import FastAPI, Query, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from datetime import datetime, timedelta
from enum import Enum
import httpx
from typing import Optional, List
from pydantic import BaseModel
import logging
# Configure logging
def generate_filename(title):
"""Generate a filename from the title by converting to lowercase, replacing spaces with hyphens, and keeping only alphanumeric characters and hyphens."""
filename = title.lower().replace(" ", "-")
filename = ''.join(c for c in filename if c.isalnum() or c == '-')
filename += ".md"
return filename
def create_md_file(title, date, description, youtube_id, content, template="post", filename=None):
"""
Create a Markdown file with YAML front matter, an image part, and content using external data.