Skip to content

Instantly share code, notes, and snippets.

View MohamedElashri's full-sized avatar

Mohamed Elashri MohamedElashri

View GitHub Profile
@MohamedElashri
MohamedElashri / compdef.md
Created May 1, 2024 04:54
Solution for /dev/fd/18:70: command not found: compdef in Mac zsh

Add these two lines to ~/.zshrc

autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
@MohamedElashri
MohamedElashri / latex_claude.user.js
Created April 14, 2024 11:23
Render latex in claude ai using mathjax
// ==UserScript==
// @name Claude AI MathJax Renderer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Render LaTeX math formulas on the page using MathJax
// @match https://claude.ai/*
// @grant none
// ==/UserScript==
(function() {
@MohamedElashri
MohamedElashri / plain_text.js
Created March 23, 2024 01:26
Plain text editor as bookmarklet (have new, load, save text features)
data: text / html;
charset = utf - 8, < !doctype html > < title > texed < /title><style>a,input{display:none}button,label{position:absolute;right:0;transform:translateY(-50%);box-sizing:border-box;width:3em;border-color:%23777;color:%23ddd;background:%23555;text-align:center;font:10pt sans-serif;cursor:pointer}input:checked+label{color:%237f7}</style > < body style = margin: 0;
background: % 23333 onload = t.focus() > < input id = f type = file > < a id = a download = text.txt > < /a><label id=g title="Text length in characters" style=top:10vh;width:3.75em;background:transparent;word-wrap:break-word;font-size:8pt;cursor:auto>0</label > < input id = w type = checkbox checked onchange = t.style.whiteSpace = w.checked && 'pre-wrap' || 'pre' > < label
for = w title = "Toggle word-wrap"
style = "top:25vh;padding:.2em 0" > Wrap < /label><button title="New text" style=top:40vh onclick="(!t.value||confirm('Clear existing text?'))&&(t.value='');l.dc=false;l.textContent='LF';t.focus()">New</button > < button title = "L
@MohamedElashri
MohamedElashri / HN_stories_change.user.js
Last active March 12, 2024 14:59
Story Rank Changes for HN
// ==UserScript==
// @name Story Rank Changes for HN
// @namespace http://tampermonkey.net/
// @version 0.0.1
// @description Enhance Hacker News experience with real-time story rank changes and new story icon for quick, visual navigation
// @author melashri
// @match https://news.ycombinator.com/
// @match https://news.ycombinator.com/news
// @match https://news.ycombinator.com/news?p=*
// @match https://news.ycombinator.com/?p=*
@MohamedElashri
MohamedElashri / physrev.mplstyle
Last active March 4, 2024 02:44
aps matplotlib
### Color scheme and line styles
#
# The default color scheme is the one from Mathematica
# https://mathematica.stackexchange.com/questions/54629/what-are-the-standard-colors-for-plots-in-mathematica-10
#
# Additional line style takes from
# https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html
#
axes.prop_cycle : (cycler('color', ['5d81b4', 'e09b24', '8eb031', 'eb6235', '8678b2', 'c46e1a', '5c9dc7', 'ffbf00', 'a5609c']) + cycler('ls', ['-', '--', '-.', (0, (1,0.85)), (0, (3, 1, 1, 1, 1, 1)), (0, (3, 1, 1, 1)), (0, (5, 1)), ':', (4, (10, 3))]))
@MohamedElashri
MohamedElashri / tmux.sh
Last active April 23, 2024 15:07
automatically start tmux when connecting to ssh (without affecting vscode ssh connection)
# Check if we are on an SSH connection
if [ -n "$SSH_CONNECTION" ]; then
# Check if this is not a VSCode SSH session
if [ -z "$VSCODE_SSH_SESSION" ]; then
# Check if tmux is not already running
if [ -z "$TMUX" ]; then
# Check if the session is interactive (terminal attached)
if [ -t 1 ]; then
# Extract client IP and port from SSH_CONNECTION
client_ip=$(echo $SSH_CONNECTION | awk '{print $1}')
@MohamedElashri
MohamedElashri / nerd_fonts.sh
Created February 29, 2024 19:50
Install Nerd fonts via homebrew
brew tap homebrew/cask-fonts
brew install --cask font-3270-nerd-font
brew install --cask font-fira-mono-nerd-font
brew install --cask font-inconsolata-go-nerd-font
brew install --cask font-inconsolata-lgc-nerd-font
brew install --cask font-inconsolata-nerd-font
brew install --cask font-monofur-nerd-font
brew install --cask font-overpass-nerd-font
brew install --cask font-ubuntu-mono-nerd-font
@MohamedElashri
MohamedElashri / news_blocklist.txt
Created February 8, 2024 16:40
news outlet dns blocklist
! Title: Custom News Outlet Blocklist
! Description: Blocks major world-famous news outlets published in English.
! Version: 1.0
||nytimes.com^
||theguardian.com^
||washingtonpost.com^
||bbc.co.uk^
||bbc.com^
||cnn.com^
||foxnews.com^
@MohamedElashri
MohamedElashri / hn_dracula.user.js
Last active March 21, 2024 13:05
My HN dracula custom userscript (and other things)
// ==UserScript==
// @name Hacker News Comprehensive Enhancements (Dracula)
// @namespace http://melashri.net/hn
// @version 1.3
// @description A comprehensive enhancement script for Hacker News
// @author melashri
// @match https://news.ycombinator.com/*
// @grant GM_addStyle
// ==/UserScript==
@MohamedElashri
MohamedElashri / nvchad_install.sh
Last active January 26, 2024 00:13
Use nvim as IDE with NvChad
#!/bin/bash
# Check if Neovim is installed
if ! command -v nvim &> /dev/null
then
read -p "Neovim is not installed. Do you have root access to install it globally? (y/n) " root_choice
case "$root_choice" in
y|Y )
# OS-specific Neovim installation
if [[ -x "$(command -v apt-get)" ]]; then