Last active
April 3, 2024 08:18
-
-
Save yasinuygun/d0931631d28941a94b07009330be6c56 to your computer and use it in GitHub Desktop.
.zshrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins=(git zsh-autosuggestions colored-man-pages zsh-syntax-highlighting) | |
alias ll='ls -alF' | |
alias lats='ls -lat | less' | |
alias dls='cd ~/Downloads' | |
alias dsk='cd ~/Desktop' | |
alias docs='cd ~/Documents' | |
alias cd..='cd ..' | |
alias op='open' | |
alias spark-shell='spark-shell --conf spark.driver.extraJavaOptions="-Dscala.color"' | |
alias rmsparkfiles='rm -rf spark-warehouse metastore_db derby.log' | |
alias hs='history | grep' | |
alias pbc="perl -0 -pe 's/\n\Z//' | pbcopy" | |
alias batp="bat --pager 'less'" | |
alias bat="bat --pager ''" | |
function learn() { | |
curl cheat.sh/$1 | |
} | |
compiletex() { | |
pdflatex --shell-escape -synctex=1 -interaction=nonstopmode $1.tex | |
bibtex $1 | |
pdflatex --shell-escape -synctex=1 -interaction=nonstopmode $1.tex | |
pdflatex --shell-escape -synctex=1 -interaction=nonstopmode $1.tex | |
} | |
split_file() { | |
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then | |
echo "Usage: split_file <file_name> <lines_per_file> [output_directory]" | |
return 1 | |
fi | |
file="$1" | |
lines_per_file="$2" | |
output_directory="${3:-.}" | |
mkdir -p "$output_directory" | |
base=$(basename "$file" .txt) | |
total_lines=$(wc -l < "$file") | |
total_parts=$(printf "%.0f" $(echo "scale=1; $total_lines / $lines_per_file" | bc -l)) | |
format_width=$(( $(echo -n $total_parts | wc -c) + 1 )) | |
for ((i=0; i < $total_parts; i++)); do | |
start=$((i * $lines_per_file + 1)) | |
end=$((start + $lines_per_file - 1)) | |
output_file=$(printf "%s/%s_part%0${format_width}d.txt" "$output_directory" "$base" $i) | |
sed -n "${start},${end}p" "$file" > "$output_file" | |
if [ "$(tail -n 1 "$output_file")" = "$(tail -n 1 "$file")" ]; then | |
break | |
fi | |
done | |
} | |
pythondata() { | |
python -c "import numpy as np; import pandas as pd; import matplotlib.pyplot as plt; from tqdm import tqdm; import code; code.interact(local=locals())" | |
} | |
bindkey \^U backward-kill-line | |
source ~/powerlevel10k/powerlevel10k.zsh-theme | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment