Skip to content

Instantly share code, notes, and snippets.

View MohamedElashri's full-sized avatar

Mohamed Elashri MohamedElashri

View GitHub Profile
@MohamedElashri
MohamedElashri / com.melashri.ssid-dns.plist
Last active October 6, 2025 00:42
Change DNS servers on Mac based on SSID
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"\>
<plist version="1.0">
<dict>
<key>Label</key><string>com.melashri.ssid-dns</string>
<key>ProgramArguments</key>
<array>
<string>/Users/melashri/.local/bin/ssid-dns</string>
</array>
@MohamedElashri
MohamedElashri / README.md
Created October 2, 2025 03:44
Cross-platform Electron Apps Detector

Electron Apps Detector

A single-file, cross-platform script that detects Electron Apps and their versions — without external dependencies.

Works on:

  • macOS (via mdfind + strings)
  • Linux (Debian, Ubuntu, Fedora, Arch, Flatpak, AppImage)
  • Windows (via PowerShell)

Usage

@MohamedElashri
MohamedElashri / syntax_highlight.py
Created September 25, 2025 16:02
Syntax Highlighting CSS Generator for Zola from Pygments Themes
#!/usr/bin/env python3
"""
Syntax Highlighting CSS Generator for Zola from Pygments Themes
Description:
Generate a combined light/dark mode syntax highlighting CSS file for Zola.
This script takes one light theme and one dark theme from Pygments and produces
a CSS file in the same format as the existing highlight.css file.
Author: Mohamed Elashri
@MohamedElashri
MohamedElashri / root_benchmark.sh
Created July 4, 2025 19:48
Benchamrk new linux machines by compiling ROOT
#!/usr/bin/env bash
# root_benchmark.sh – compile a minimal ROOT and collect build metrics
set -euo pipefail
############### Color helpers ###############
bold=$(tput bold) || true
red=$(tput setaf 1) || true
green=$(tput setaf 2) || true
yellow=$(tput setaf 3) || true
@MohamedElashri
MohamedElashri / amdgcn_electrons_fix.md
Created April 24, 2025 08:51
Fixing Electron App Crashes Caused by `amdgcn--` Triple Errors on Linux

⚠️ Fixing Electron App Crashes Caused by amdgcn-- Triple Errors on Linux

🧩 Problem

Electron-based applications (e.g., 1Password, VSCode, Discord, etc.) crash on Linux systems where AMD's ROCm or amdgpu-install driver stack is present. A representative error message looks like this:

Cannot find target for triple amdgcn-- Unable to find target for this triple (no targets are registered)
...
[ERROR:gpu_process_host.cc(981)] GPU process exited unexpectedly: exit_code=139
@MohamedElashri
MohamedElashri / condor_q_cheatsheet.md
Created April 22, 2025 06:07
condor_q cheatsheet

Condor _q Cheatsheet


1. View & Summarize Jobs

Command What it Does Example
condor_q Batched summary (one line per cluster) condor_q
condor_q -nobatch Per‑job listing (one line per proc) condor_q -nobatch 195
@MohamedElashri
MohamedElashri / cron_jobs_cheatsheet.md
Created March 21, 2025 13:09
Cron Jobs Cheat Sheet

Cron Jobs Cheat Sheet

1. Cron Time Format (Crontab Syntax)

Field Allowed Values Special Characters Meaning Example
Minute 0–59 * , - / Minute of the hour 0 = top of the hour
Hour 0–23 * , - / Hour of the day 5 = 5 AM
Day 1–31 * , - / Day of the month 15 = 15th
@MohamedElashri
MohamedElashri / ROOT_Cheatsheet.md
Created March 20, 2025 11:57
ROOT CheatSheet.

ROOT Cheat Sheet

1. Interactive work

Command Description
root -h show help for root command
root [-l] open ROOT
root [-l] file.root open ROOT and load a file
.? show help in interactive ROOT
@MohamedElashri
MohamedElashri / README.md
Last active February 1, 2025 11:02
use inspirehep api to look into top cited papers in 2024 in hep-ph

INSPIRE HEP-PH Top Papers Analysis

This script fetches and analyzes the top cited High Energy Physics - Phenomenology (HEP-PH) papers from 2024 using the INSPIRE API. It focuses on papers with 10 or fewer authors and generates a detailed table of the most cited papers.

Requirements

  • Python 3.7+
  • Required packages:
    pip install requests pandas tabulate
@MohamedElashri
MohamedElashri / README.md
Last active December 4, 2024 23:11
ROOT CERN Conda Environment creation script

Setup ROOT Environment Script

This script automates the creation of a Conda environment for working with ROOT and Python, including optional configuration for additional packages, Conda channels, and Python versions. It also sets up environment variables for seamless integration with tools like VSCode and Jupyter Notebook.

Features

  • Automates Environment Creation: Creates a Conda environment with ROOT and Python.
  • Customizable Options: Allows specifying additional packages, Conda channels, and Python versions.
  • Jupyter Kernel Integration: Automatically registers the environment as a Jupyter kernel.
  • Environment Variable Management: Dynamically sets up and cleans up ROOT-specific environment variables.