Skip to content

Instantly share code, notes, and snippets.

@dylanjcastillo
Last active March 16, 2026 13:45
Show Gist options
  • Select an option

  • Save dylanjcastillo/fe78ec60059ea44c184abd72daae3590 to your computer and use it in GitHub Desktop.

Select an option

Save dylanjcastillo/fe78ec60059ea44c184abd72daae3590 to your computer and use it in GitHub Desktop.
# If you come from bash you might have to change your $PATH. export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/dcast/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="refined"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Aliases
alias ls='eza -lh --group-directories-first --icons --hyperlink'
alias lsa='ls -a'
alias lt='eza --tree --level=2 --long --icons --git'
alias lta='lt -a'
alias sysinfo="system_profiler SPSoftwareDataType SPHardwareDataType"
alias start-redis="docker run --rm --name redis-local -p 6379:6379 redis"
alias n='nvim'
# Functions
function setup-ssh-key() {
set -e
KEY_NAME="$1"
ORIGIN_DIR="$(pwd)"
ORIGIN_KEY="$ORIGIN_DIR/$KEY_NAME"
DEST_DIR="$HOME/.ssh"
DEST_KEY="$DEST_DIR/$KEY_NAME"
mkdir -p "$DEST_DIR"
cp "$ORIGIN_KEY" "$DEST_KEY"
chmod 600 "$DEST_KEY"
eval "$(ssh-agent -s)"
ssh-add "$DEST_KEY"
echo "SSH key '$KEY_NAME' has been setup successfully."
}
function mov2mp4() {
speed=${2:-1}
ffmpeg -i "$1" -filter_complex "[0:v]setpts=1/${speed}*PTS[v];[0:a]atempo=${speed}[a]" -map "[v]" -map "[a]" -vcodec h264 -acodec aac "${1%.*}.mp4"
}
function gen-key-here() {
ssh-keygen -t ed25519 -C "$1" -f "./id_ed25519_$1"
}
function shrinkpdf() {
if [[ $# -ne 2 ]]; then
echo "Usage: compress_pdf <input_pdf> <compression_level>"
echo "Compression levels:"
echo " /screen (Low quality, suitable for viewing on screen)"
echo " /ebook (Medium quality, suitable for ebooks)"
echo " /printer (High quality, suitable for printing)"
echo " /prepress (Highest quality, color preserving)"
echo " /default (Default compression level)"
return 1
fi
local input_pdf="$1"
local compression_level="$2"
local output_pdf="${input_pdf%.*}_compressed.pdf"
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS="$compression_level" -dNOPAUSE -dBATCH -sOutputFile="$output_pdf" "$input_pdf"
echo "Compressed PDF saved as: $output_pdf"
}
function img2webp() {
# Check if the input file is provided or if help is requested
if [[ $# -lt 1 || "$1" == "--help" || "$1" == "-h" ]]; then
echo "Usage: img2webp input_image [quality]"
echo " input_image: Path to the input image file"
echo " quality: Quality of the output WebP image (0-100, default is 80)"
return 1
fi
local input="$1"
local quality="${2:-80}" # Default quality is 80 if not specified
local output="${input%.*}.webp"
# Convert the image to WebP using ffmpeg
ffmpeg -i "$input" -qscale:v "$quality" "$output"
# Check if the conversion was successful
if [[ $? -eq 0 ]]; then
echo "Successfully converted '$input' to '$output' with quality $quality."
else
echo "Failed to convert '$input' to WebP."
return 1
fi
}
export MAGICK_HOME="/opt/homebrew/Cellar/imagemagick/7.1.1-8"
. "$HOME/.cargo/env"
export GOPATH=$HOME/go
export PATH="$PATH:usr/local/go/bin:$GOPATH/bin"
# Add homebrew to PATH
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/opt/homebrew/sbin:$PATH"
# Add local/bin to PATH
export PATH="/usr/local/bin:$PATH"
# Add .local/bin to PATH
export PATH="$HOME/.local/bin:$PATH"
# Fix for missing python
export PATH="$(brew --prefix python)/libexec/bin:$PATH"
# Use rbenv for ruby
eval "$(rbenv init -)"
# Created by `pipx` on 2024-05-18 17:47:22
export PATH="$PATH:/Users/dcast/.local/bin"l
# direnv
eval "$(direnv hook zsh)"
# fnm
export PATH="/Users/dcast/Library/Caches/fnm_multishells/46341_1716826464997/bin":$PATH
export FNM_MULTISHELL_PATH="/Users/dcast/Library/Caches/fnm_multishells/46341_1716826464997"
export FNM_NODE_DIST_MIRROR="https://nodejs.org/dist"
export FNM_RESOLVE_ENGINES="false"
export FNM_COREPACK_ENABLED="false"
export FNM_DIR="/Users/dcast/Library/Application Support/fnm"
export FNM_LOGLEVEL="info"
export FNM_ARCH="arm64"
export FNM_VERSION_FILE_STRATEGY="local"
rehash
# pnpm
export PATH="/opt/homebrew/opt/pnpm/bin:$PATH"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/dcast/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/dcast/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/dcast/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/dcast/google-cloud-sdk/completion.zsh.inc'; fi
# The following lines have been added by Docker Desktop to enable Docker CLI completions.
fpath=(/Users/dcast/.docker/completions $fpath)
autoload -Uz compinit
compinit
# End of Docker CLI completions
#
export PATH="$PATH:/Applications/Docker.app/Contents/Resources/bin/"
# Autogenerated: Bash autocompletion
autoload bashcompinit && bashcompinit
# Autogenerated: Autocompletion for DDnA CLI
. ~/.ddna_cli_autocomplete.zsh
alias caf1='caffeinate -u -t 3600'
alias caf2='caffeinate -u -t 7200'
alias caf8='caffeinate -u -t 28800'
# opencode
export PATH=/Users/dcast/.opencode/bin:$PATH
# Added by LM Studio CLI (lms)
export PATH="$PATH:/Users/dcast/.cache/lm-studio/bin"
# End of LM Studio CLI section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment