Skip to content

Instantly share code, notes, and snippets.

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

Evan Davies mrevjd

🏠
Working from home
View GitHub Profile
@mrevjd
mrevjd / fix_vim_mouse.sh
Created October 10, 2025 00:29
Debian VIM Visual mouse fix
#!/usr/bin/env bash
# Disables mouse going into Visual mode on copy/paste in VIM
grep -Fxq 'autocmd VimEnter * set mouse=' /etc/vim/vimrc.local 2>/dev/null || echo 'autocmd VimEnter * set mouse=' | sudo tee -a /etc/vim/vimrc.local > /dev/null
@mrevjd
mrevjd / 1000-custom.conf
Created November 16, 2024 00:19
Sysctl Tweaks
# vi /etc/sysctl.d/1000-custom.conf
# sysctl -p /etc/sysctl.d/1000-custom.conf
# Or
# vi /etc/sysctl.conf and append to end of file
# sysctl -p
# Max connections
net.core.somaxconn = 65536
# Implement RFC 1337 fix
@mrevjd
mrevjd / calc_php-fpm.sh
Created June 2, 2024 22:52
Calculate FPM Workers
#!/usr/bin/env bash
RESERVED_MEM_GB=${1:-0}
PHP_FPM_MEM=$(ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | grep php-fpm|grep pool| awk '{sum+=$1; count++} END {print sum/count}')
TOTAL_MEM_GB=$(free -m | awk '/^Mem:/{print $2}')
MEM_RATIO=$(echo "scale=2; ($TOTAL_MEM_GB - $RESERVED_MEM_GB) / $PHP_FPM_MEM" | bc)
echo "Total Workers: $MEM_RATIO"
@mrevjd
mrevjd / install_cursor.sh
Last active February 20, 2025 00:13
Cursor Setup for WSL
source /etc/os-release
OS=$NAME
if [[ "$OS" =~ Ubuntu ]]; then
echo "Ubuntu found"
DISTRO=UB
elif [[ "$OS" =~ Debian ]]; then
echo "Debian found"
DISTRO=DEB
elif [[ "$OS" =~ AlmaLinux ]]; then
echo "AlmaLinux found"
@mrevjd
mrevjd / README.txt
Created February 7, 2023 09:31
Powerline Setup Tips and Tricks
Good Article on setting up
https://medium.com/earlybyte/powerline-for-bash-6d3dd004f6fc
https://wiki.archlinux.org/title/Powerline
https://powerline.readthedocs.io/en/master/commands/daemon.html
@mrevjd
mrevjd / docker_ce_ub2204.txt
Last active September 14, 2022 06:56
Install docker CE on WSL 2 UB 22.04
sudo apt -y remove docker docker-engine docker.io containerd runc
sudo apt update
sudo apt -y install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
@mrevjd
mrevjd / git_config.txt
Last active August 30, 2022 01:45
Git Global Config
# GIT Defaults:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global color.ui auto
git config --global push.default simple
git config --global alias.ci commit
git config --global alias.stat status
git config --global core.editor vim
git config --global init.defaultBranch main
@mrevjd
mrevjd / kate_win64.txt
Created July 31, 2022 03:23
Win64 Kate Builds
Latest stable build of Kate for Windows
https://binary-factory.kde.org/view/Windows%2064-bit/job/Kate_Release_win64/lastStableBuild/
@mrevjd
mrevjd / update_php.txt
Last active November 18, 2025 22:16
Update php to 8.x
# PHP Upgrade 7.4 to 8.1
# This can be used for other versions.
# Just need to replace the from version and/or the new version
apt update
apt -y install software-properties-common
add-apt-repository ppa:ondrej/php
apt update
# Lists all packages installed in relation to php7.4
@mrevjd
mrevjd / .bash_aliases
Last active November 2, 2025 05:46
Starship or Powerline Prompt with .bashrc
# =========================
# ~/.bash_aliases
# =========================
# ----- General -----
alias cls='clear'
alias ll='ls -la'
alias lls='ls -la --sort=size'
alias llt='ls -la --sort=time'
alias df='df -h'