Skip to content

Instantly share code, notes, and snippets.

View MuhammadSawalhy's full-sized avatar
📚
أحوال أن أزداد علما ما حييت

محمد الصوالحي MuhammadSawalhy

📚
أحوال أن أزداد علما ما حييت
View GitHub Profile
@MuhammadSawalhy
MuhammadSawalhy / index.tex
Created April 19, 2021 23:02
My English language report - a template.
\documentclass[14pt]{article}
\usepackage{amsmath}
\usepackage{cite}
\usepackage{extsizes}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{url}
\usepackage{setspace}
import requests
import os
from tqdm import tqdm
from bs4 import BeautifulSoup
gucians = []
page_URL = 'https://commits.top/egypt.html'
r = requests.get(page_URL)
soup = BeautifulSoup(r.content, "html.parser")
@MuhammadSawalhy
MuhammadSawalhy / unique-square--lowest-cost.py
Last active July 30, 2021 10:51
3x3 2D Array that contains numbers from range(1,10). The goal is to make each number unrepeated, appears only one time, with the lowest total value changes (lowest cost).
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'formingMagicSquare' function below.
@MuhammadSawalhy
MuhammadSawalhy / happy-eid.js
Created August 9, 2021 16:21
كل عام وأنت بخير
console.log(
[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]
@MuhammadSawalhy
MuhammadSawalhy / get-terms.sh
Created November 20, 2021 11:33
techtionary.thinktech.sa technical terms stored here, 15/4/1443, 20/11/2021
#!/bin/bash
for page in {1..173}; do
curl -L "https://techtionary.thinktech.sa/api/terms?page=$page" |
jq .data > /tmp/terms.$page.json
done
node -p 'JSON.stringify(Array.from({length: 173}).map((_,index)=> require("/tmp/terms." + (index + 1) + ".json")).flat())' |
jq > ~/myp/mobadarah/techtionary.thinktech.sa__terms.json
@MuhammadSawalhy
MuhammadSawalhy / postman-pre-request-refresh-acces-token.js
Last active February 24, 2022 19:02
أكواد تُنفذ ما قبل الطلبات في البوستمان لتحديث رمز الموصول، أنا كسول لدرجة كتابة هذا ليقوم مقامي ويرفع عن حمل تسجيل الدخول
const backendURL = pm.collectionVariables.get("back_url");
const tokens = getTokens(); // from the collection variables
updateAccessIfNeeded(); // and set to the collection variables
// --------------------------------------------------
// check and (create or refresh)
// --------------------------------------------------
function updateAccessIfNeeded() {
if (!isTokenExpired(tokens.decoded.access)) return;
@MuhammadSawalhy
MuhammadSawalhy / debug.hpp
Created July 12, 2022 06:09
أكواد مساعدة لفحص الحلول والبحث عن الخلل
#pragma once
#include <bits/stdc++.h>
using namespace std;
int indent = 1;
string indent_str = "\t";
void __indent() {
@MuhammadSawalhy
MuhammadSawalhy / list-code-images.py
Last active July 25, 2022 19:03
Replace images in a pdf using python
import math
import glob
from PIL import Image
for img in glob.glob("images/*.png"):
# for img in ["imageroot-014.png"]:
with Image.open(img) as im:
x = math.floor(im.size[0]/2)
px = im.getpixel((x,-1))
if px == (12,12,12):