-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.zshrc
More file actions
665 lines (617 loc) · 27.2 KB
/
Copy path.zshrc
File metadata and controls
665 lines (617 loc) · 27.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# Zsh options
setopt correct # Auto correct mistakes
setopt extendedglob # Extended globbing. Allows using regular expressions with *
setopt nocaseglob # Case insensitive globbing
setopt rcexpandparam # Array expension with parameters
setopt nocheckjobs # Don't warn about running processes when exiting
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt nobeep # No beep
setopt appendhistory # Immediately append history instead of overwriting
setopt histignorealldups # If a new command is a duplicate, remove the older one
setopt autocd # if only directory path is entered, cd there.
setopt inc_append_history # Dont repeat cmds in histfile
set umask 077 # File perms mask groups and others
# Shell History
HISTSIZE=10000
HISTFILESIZE=20000
SAVEHIST=10000
HISTFILE=~/.zsh_history
HISTCONTROL=ignoreboth # ignore lines starting with spaces, and duplicates
## ls colours
# Set LS_COLORS: directories in orange (38;5;214), files in white (38;5;15)
# export LS_COLORS="di=38;5;214:fi=38;5;15"
# TODO: make this vars so we can swap colours easier
LS_COLORS='rs=0:di=01;31:ln=01;31:mh=00:pi=40;31:so=01;32:do=01;32:bd=40;31;01:cd=40;31;01:or=40;31;01:mi=31:su=31;41:sg=30;43:ca=00:tw=30;42:ow=31;42:st=31;31:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;32:*.jpg=01;32:*.jpeg=01;32:*.mjpg=01;32:*.mjpeg=01;32:*.gif=01;32:*.bmp=01;32:*.pbm=01;32:*.pgm=01;32:*.ppm=01;32:*.tga=01;32:*.xbm=01;32:*.xpm=01;32:*.tif=01;32:*.tiff=01;32:*.png=01;32:*.svg=01;32:*.svgz=01;32:*.mng=01;32:*.pcx=01;32:*.mov=01;32:*.mpg=01;32:*.mpeg=01;32:*.m2v=01;32:*.mkv=01;32:*.webm=01;32:*.webp=01;32:*.ogm=01;32:*.mp4=01;32:*.m4v=01;32:*.mp4v=01;32:*.vob=01;32:*.qt=01;32:*.nuv=01;32:*.wmv=01;32:*.asf=01;32:*.rm=01;32:*.rmvb=01;32:*.flc=01;32:*.avi=01;32:*.fli=01;32:*.flv=01;32:*.gl=01;32:*.dl=01;32:*.xcf=01;32:*.xwd=01;32:*.yuv=01;32:*.cgm=01;32:*.emf=01;32:*.ogv=01;32:*.ogx=01;32:*.aac=00;93:*.au=00;93:*.flac=00;93:*.m4a=00;93:*.mid=00;93:*.midi=00;93:*.mka=00;93:*.mp3=00;93:*.mpc=00;93:*.ogg=00;93:*.ra=00;93:*.wav=00;93:*.oga=00;93:*.opus=00;93:*.spx=00;93:*.xspf=00;93:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:';
export LS_COLORS
## Autocomplete features
# Saved commands are added to the history immediately, otherwise only when shell exits.
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
zstyle ':completion:*' rehash true # Automatically find new executables in path
# Speed up completions
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word
# Fancy auto-complete
autoload -Uz compinit
zstyle ':completion:*' menu select=0
zmodload zsh/complist
zstyle ':completion:*' format '>>> %d'
compinit
_comp_options+=(globdots) # hidden files are included
## Vi mode
bindkey -v
# Navigate words with ctrl+arrow keys
bindkey '^[Oc' forward-word #
bindkey '^[Od' backward-word #
bindkey '^[[1;5D' backward-word #
bindkey '^[[1;5C' forward-word #
bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace
bindkey '^[[Z' undo # Shift+tab undo last action
# Bind UP and DOWN arrow keys to history substring search
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
## Keybindings section
bindkey -e
bindkey '^[[7~' beginning-of-line # Home key
bindkey '^[[H' beginning-of-line # Home key
if [[ "${terminfo[khome]}" != "" ]]; then
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
fi
bindkey '^[[8~' end-of-line # End key
bindkey '^[[F' end-of-line # End key
if [[ "${terminfo[kend]}" != "" ]]; then
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
fi
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[3~' delete-char # Delete key
bindkey '^[[C' forward-char # Right key
bindkey '^[[D' backward-char # Left key
bindkey '^[[5~' history-beginning-search-backward # Page up key
bindkey '^[[6~' history-beginning-search-forward # Page down key
# Navigate words with ctrl+arrow keys
bindkey '^[Oc' forward-word #
bindkey '^[Od' backward-word #
bindkey '^[[1;5D' backward-word #
bindkey '^[[1;5C' forward-word #
bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace
bindkey '^[[Z' undo # Shift+tab undo last action
## Term functions
# Set terminal window and tab/icon title
#
# usage: title short_tab_title [long_window_title]
#
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
# Fully supports screen and probably most modern xterm and rxvt
# (In screen, only short_tab_title is used)
function title {
emulate -L zsh
setopt prompt_subst
[[ "$EMACS" == *term* ]] && return
# if $2 is unset use $1 as default
# if it is set and empty, leave it as is
: ${2=$1}
case "$TERM" in
xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*)
print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name
;;
screen*|tmux*)
print -Pn "\ek${1:q}\e\\" # set screen hardstatus
;;
*)
# Try to use terminfo to set the title
# If the feature is available set title
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
echoti tsl
print -Pn "$1"
echoti fsl
fi
;;
esac
}
# Runs before showing the prompt
function mzc_termsupport_precmd {
[[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
# Runs before executing the command
function mzc_termsupport_preexec {
[[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
emulate -L zsh
# split command into array of arguments
local -a cmdargs
cmdargs=("${(z)2}")
# if running fg, extract the command from the job description
if [[ "${cmdargs[1]}" = fg ]]; then
# get the job id from the first argument passed to the fg command
local job_id jobspec="${cmdargs[2]#%}"
# logic based on jobs arguments:
# http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
# https://www.zsh.org/mla/users/2007/msg00704.html
case "$jobspec" in
<->) # %number argument:
# use the same <number> passed as an argument
job_id=${jobspec} ;;
""|%|+) # empty, %% or %+ argument:
# use the current job, which appears with a + in $jobstates:
# suspended:+:5071=suspended (tty output)
job_id=${(k)jobstates[(r)*:+:*]} ;;
-) # %- argument:
# use the previous job, which appears with a - in $jobstates:
# suspended:-:6493=suspended (signal)
job_id=${(k)jobstates[(r)*:-:*]} ;;
[?]*) # %?string argument:
# use $jobtexts to match for a job whose command *contains* <string>
job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
*) # %string argument:
# use $jobtexts to match for a job whose command *starts with* <string>
job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
esac
# override preexec function arguments with job command
if [[ -n "${jobtexts[$job_id]}" ]]; then
1="${jobtexts[$job_id]}"
2="${jobtexts[$job_id]}"
fi
fi
# cmd name only, or if this is sudo or ssh, the next cmd
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
local LINE="${2:gs/%/%%}"
title '$CMD' '%100>...>$LINE%<<'
}
autoload -U add-zsh-hook
add-zsh-hook precmd mzc_termsupport_precmd
add-zsh-hook preexec mzc_termsupport_preexec
# oh-my-zsh
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
ZSH_THEME_TERM_TITLE_IDLE="%n@%m:%~"
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Install oh-my-zsh
# cp ~/.zshrc /dev/shm && sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && mv /dev/shm/.zshrc ~/.zshrc
# Path to your oh-my-zsh installation.#
export ZSH="$HOME/.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="robbyrussell"
# 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=7
# 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"
# ZSH_CUSTOM=/path/to/new-custom-folder
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
plugins=(
vi-mode
git
dotenv
python
branch
timer
archlinux
)
#Perms
source $ZSH/oh-my-zsh.sh
## Home
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_MUSIC_DIR="$HOME/music"
# export XDG_RUNTIME_DIR="$HOME"
# Compilation flags
export ARCHFLAGS="-arch x86_64"
# Keyboard
export LANGUAGE=en_GB.UTF-8
export LANG=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8
# Qemu
export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/
# Colours
autoload -U colors && colors
# zsh prompt
if ! [[ -d ~/.oh-my-zsh ]] ; then
# fallback custom prompt
# [rodfer@archbox]-[~]
# >>> |
PS1="%{$fg[cyan]%}%B[%b%{$fg[white]%}%n%{$fg[cyan]%}%B@%b%{$fg[white]%}%m%{$fg[cyan]%}%B]-%b%{$fg[cyan]%}%B[%b%{$fg[white]%}%~%{$fg[cyan]%}%B]%b
%{$fg[cyan]%}%B>>>%b%{$reset_color%} "
fi
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
alias v="$EDITOR"
#alias vi="$EDITOR"
#alias vim="$EDITOR"
alias nvim="$EDITOR"
if [[ "$EDITOR" == nvim ]]; then
alias vimdiff='nvim -d'
fi
alias screen='screen -U'
alias tmux="tmux -2 -f '$XDG_CONFIG_HOME/tmux/tmux.conf'"
alias t="tmux"
alias tmuxa='tmux attach || tmux new-session'
## envvars configs
# browser
#if [ -z "$BROWSER" ]; then
# xdg-settings set default-web-browser firejail_librewolf.desktop
#fi
#mkdir -p "$XDG_DATA_HOME/librewolf"
#export BROWSER="firejail-librewolf"
export BROWSER="/usr/bin/librewolf"
#export OPEN_BROWSER="$HOME/scripts/web/firejail_librewolf.sh"
#export OPEN_BROWSER="/usr/bin/firejail-librewolf $@"
export OPEN_BROWSER="/usr/bin/librewolf $@"
# editor
export EDITOR="nvim"
# /usr/bin first
PATH=$(echo $PATH | cut -d":" -f3):$(echo $PATH | cut -d":" -f1-2):$(echo $PATH | cut -d":" -f4-)
# python3 pip user binaries
export PATH=$PATH:"$HOME/.local/bin"
# golang user binaries
export PATH=$PATH:"$HOME/.go/bin"
# Java
export JAVA_HOME=/usr/lib/jvm/java-24-openjdk
export PATH="$PATH:$JAVA_HOME/bin"
#export JAVA_HOME="/usr/lib/jvm/java-22-openjdk"
#export PATH=$JAVA_HOME/bin:$PATH
# Haskell
#PATH="$HOME/.cabal/bin:$PATH"
# ghcup env
[ -f "/home/rodfer/.ghcup/env" ] && . "/home/rodfer/.ghcup/env" # ghcup-env
PATH="$PATH:$HOME/.ghcup/bin"
# Scala
# >>> coursier install directory >>>
export PATH="$PATH:$HOME/.local/share/coursier/bin"
# <<< coursier install directory <<<
# ruby
export PATH=$PATH:"$HOME/.local/share/gem/ruby/3.0.0/bin"
# libvirtd
export LIBVIRT_DEFAULT_URI=qemu:///system
# GPG
GNUPGHOME="$HOME/.gpg"
# signatures
alias gpgup="gpg --keyserver-options auto-key-retrieve --verify"
# off the land commands
alias cp="cp -i" # Confirm before overwriting something
alias df='df -h' # Human-readable sizes
alias du='du -h' # Human-readable sizes
alias free='free -m' # Show sizes in MB
alias c="clear" # Clear char cmd
alias cd..="cd .." # Autocorrect
alias ..='cd ..'
alias 2..='cd ../..'
alias 3..='cd ../../..'
alias 4..='cd ../../../..'
alias 5..='cd ../../../../..'
alias awget="wget -c --user-agent 'noleak'" # No User-Agent leak wget
alias acurl="curl --user-agent 'noleak'" # No User-Agent leak curl
alias curl-dl="curl --user-agent 'noleak' --location --remote-name" # HTTP no UA leak curl download to PWD
alias scurl="curl --user-agent 'noleak' --tlsv1.3 --proto 'https'" # HTTPS no UA leak curl
alias scurl-dl="curl --user-agent 'noleak' --tlsv1.3 --proto 'https' --location --remote-name" # TLS no UA leak curl download to PWD
alias grep="grep --color=always"
alias l="ls -lhArt" # ls all char by last mod rev cmd
alias lsc="ls -A | wc -l" # count number of files in PWD
alias lst="tree"
alias r="reset" # reset char cmd
alias shred="shred -n 42 -zf" # shred zero fill file location
#alias vi="vim" # vi is vim
alias sl="ls" # Autocorrect ls
alias dd="dd status=progress" # Display status on dd
alias rm="rm -i" # Confirm before deleting
alias mv="mv -i" # Confirm before overwritting
alias lsd="du -d 1" # Count dirs size at PWD
alias lookup="grep -rn "./" -e" # Lookup file/dir by name in PWD
alias ps="ps --forest" # ps trees subprocesses
alias psa="ps -aux" # ps all
alias rs="rsync -avxP"
alias timestamp="date +'%Y-%m-%dT%H:%M:%S.%3NZ'"
alias ns="netstat -anp"
alias sst="ss -tulpn"
alias ssp="ss -plant"
alias murder="~/scripts/system/murder.sh"
alias psn="~/scripts/system/psn.sh"
alias scratch="~/scripts/system/scratch.sh"
alias bgp="~/scripts/system/bgp.sh"
alias ppath="echo "$PATH" | sed 's/:/\n/g'"
alias mksh="~/scripts/code/mksh.sh"
mkcd () {
\mkdir -p "$1"
cd "$1"
}
alias straightquote="~/scripts/code/straightquote.sh"
## Fix my own mistakes
alias ,,='cd ..'
alias ..l='cd .. && ls'
alias :q='exit'
alias q="exit"
alias cd..='cd ..'
alias mdkir='mkdir'
alias dc='cd'
alias sl='ls'
alias sudp='sudo'
## Python3 venv and tools
PYTHON3_VENV="$HOME/.local/share/python3-venv"
PYTHON3="$PYTHON3_VENV/bin/python3"
PIP3="$PYTHON3_VENV/bin/pip3"
alias python310="/usr/bin/python3.10"
alias pyvenv="yes | rm -rf $PYTHON3_VENV/* ; python -m pip cache purge; python3 -m venv $PYTHON3_VENV"
alias py="$PYTHON3_VENV/bin/python3"
alias pypip="$PYTHON3_VENV/bin/python3 -m pip"
alias pytest="$PYTHON3_VENV/bin/pytest"
alias pyclear='find . -name "__pycache__" -type d -exec rm -rf {} +'
alias autopep="autopep8 --recursive --in-place --indent-size 2 --ignore E226,E24,E704,W503 --max-line-length 79 .
"
alias ruf="ruff format --config $XDG_CONFIG_HOME/ruff/ruff.toml --preview; ruff check --config $XDG_CONFIG_HOME/ruff/ruff.toml --preview"
## Scripts and alias
# video
#alias mpv="mpv --vo=gpu --gpu-api=opengl"
# Data parsing
alias nato="~/scripts/parsing/nato.py | less"
alias hexdumpstr="hexdump -e '1/1 \"%02x\"'"
alias rand_keygen="~/scripts/parsing/rand_keygen.sh"
# IDEs
alias code="setsid -f vscodium >/dev/null 2>&1 . &"
alias ide="setsid -f idea . >~/.local/share/idea/ide.log 2>&1 &"
#troubleshoot
alias journalerr="sudo journalctl -p 3 -xe"
alias journal="sudo journalctl -xe"
alias sysfail="systemctl --failed; sudo systemctl --failed"
# todo helpers
alias timer="~/scripts/system/timer.sh"
alias discord_todo="$HOME/scripts/discord/todo.sh"
alias datelog="date -u +'%Y-%m-%dT%H:%M:%S+0000'"
# cache cleanup
alias cachecl="yes | rm -rf ~/.cache/* ; yes | rm -rf ~/.cache/.*"
alias binit="$HOME/scripts/rubbish/binit.sh"
alias bincl="$HOME/scripts/rubbish/bincl.sh"
alias binmv="$HOME/scripts/rubbish/binmv.sh"
# sleep function
alias sus="systemctl suspend"
alias hibernate="systemctl hibernate"
# updates
alias firmware-update="~/scripts/updates/firmware_update.sh"
alias update="~/scripts/updates/arch_update.sh"
alias simple-update="~/scripts/updates/simple_arch_update.sh"
# screenshots
alias screenshot="~/scripts/screen/screenshot.sh"
# clipboard
#alias clip="xclip -selection clipboard"
#alias pst="xclip -o >>"
alias copy="wl-copy"
alias pasta="wl-paste"
alias upper="tr '[:lower:]' '[:upper:]'"
alias lower="tr '[:upper:]' '[:lower:]'"
alias catfiles='find . -type f -exec sh -c "echo -e \"\n--- File: \$1 ---\"; cat \"\$1\"" _ {} \;'
# installs
alias yaydl="~/scripts/system/yaydl.sh"
# monitors
alias dualmon="~/scripts/monitor/dualmon.sh"
alias desktopmon="~/scripts/monitor/desktopmon.sh"
# files
alias mva="~/scripts/system/mva.sh"
alias ocr="~/scripts/image/ocr.py"
alias purgemeta="~/scripts/image/purge_metadata.sh"
alias open="~/scripts/system/open.sh"
tempe () {
cd "$(mktemp -d)"
chmod -R 0700 .
if [[ $# -eq 1 ]]; then
\mkdir -p "$1"
cd "$1"
chmod -R 0700 .
fi
}
# web
serve() {
python3 -m http.server -b 127.0.0.1 1337 >/dev/null 2>&1 &
# Capture the PID of the last background process ($!)
local PID="$!"
if ps -p "$PID" > /dev/null; then
echo "[*] Python3 HTTP server running on http://127.0.0.1:1337 (PID: $PID)"
else
echo "[!] Failed to start the HTTP server." >&2
fi
}
alias kserve="pkill -f 'python3 -m http.server -b 127.0.0.1 1337'"
nvim-guide() {
# Added -d for explicit directory targeting
python3 -m http.server -b 127.0.0.1 1337 -d ~/.config/nvim/html >/dev/null 2>&1 &
local PID="$!"
if ps -p "$PID" > /dev/null; then
echo "[*] Python3 HTTP server running on http://127.0.0.1:1337 (PID: $PID)"
# Automatically open the browser
xdg-open http://127.0.0.1:1337/nvim_guide.html >/dev/null 2>&1
else
echo "[!] Failed to start the HTTP server." >&2
fi
}
kill-nvim-guide() {
# Look for the exact background process and kill it safely
if pgrep -f "python3 -m http.server -b 127.0.0.1 1337" > /dev/null; then
pkill -f "python3 -m http.server -b 127.0.0.1 1337"
echo "[*] Guide server shut down successfully."
else
echo "[!] No guide server found running on port 1337."
fi
}
alias edgeshark="~/containers/edgeshark/edgeshark.sh"
alias grepipv4="~/scripts/networks/grepipv4.sh"
alias "?"="~/scripts/web/lynx_google.sh"
alias httpstatus="~/scripts/web/httpstatus.sh"
alias hackernews="~/scripts/web/hackernewscli.py"
alias url="~/scripts/web/url.sh"
alias wdl="~/scripts/web/wdl.sh"
alias portkill="~/scripts/networks/port_kill.sh"
#alias chromium="~/scripts/web/firejail_chromium.sh"
alias chromium="/usr/bin/chromium"
alias chrome="chromium"
# audio services control
mpdinit() {
if [ ! -f "${HOME}/.cache/mpd/database" ]; then
mkdir -p "${HOME}/.cache/mpd" && touch "${HOME}/.cache/mpd/database" && systemctl --user restart mpd
fi
}
mpdinit
alias mpdstop="systemctl --user stop mpd.service"
alias bluetooth="~/scripts/xorg/bluetooth/bluetooth.sh"
# window-manager
alias refresh-hyprpaper="killall -w hyprpaper; hyprpaper & disown"
# radio
alias radio-lofi="mpv --really-quiet https://live.hunter.fm/lofi_low"
alias radio-rock="mpv --really-quiet https://live.hunter.fm/rock_stream"
alias radio-80s="mpv --really-quiet https://live.hunter.fm/80s_stream"
alias yt-lofi="mpv --no-video --really-quiet https://www.youtube.com/watch\?v\=jfKfPfyJRdk"
alias radio-trance="mpv --really-quiet http://ubuntu.hbr1.com:19800/trance.ogg"
# video and audio
alias shrink-video="~/scripts/video/shrink_video.sh"
alias music-meta="~/scripts/audio/music-meta.sh"
alias wav2mp3="~/scripts/audio/wav2mp3.sh"
alias mp4_to_mp3="~/scripts/audio/mp4_to_mp3.sh"
alias tvshow_rename="~/scripts/video/tvshow_rename.sh"
alias tvseries_rename="~/scripts/video/tvseries_rename.sh"
alias webm2mp3="~/scripts/video/webm2mp3.sh"
alias webm2mkv="~/scripts/video/webm2mkv.sh"
alias webm2mov="~/scripts/video/webm2mov.sh"
alias cwd-webm2mp3='for file in $(ls); do [ -f "$file" ] && ~/scripts/video/webm2mp3.sh "$file";done'
alias imgr90="~/scripts/video/img_rotate_90.sh"
alias tomp3="~/scripts/video/toMp3.sh"
alias ytdlv="~/scripts/video/ytdl-video.sh"
alias ytdlp="~/scripts/video/ytdl-playlist.sh"
alias ytdla="~/scripts/audio/ytdl-audio.sh"
alias ytdlm="~/scripts/audio/ytdl-music.sh"
alias ytdlap="~/scripts/audio/ytdl-audio-playlist.sh"
alias ytdlmob="~/scripts/video/ytdl-mobile.sh"
alias mpv-ssc="mpv --ytdl-raw-options=no-check-certificate="
# compilers
alias gcc="gcc -mshstk" # enable shadow stack to prevent memory RCE exploits
alias clang="clang -mshstk"
# docker
alias upbuild="docker compose up -d --build"
alias vdown="docker compose down --volumes --remove-orphans"
# git
alias gitc="git checkout"
alias gitbc="git checkout -b"
alias gitreb="git rebase -i origin/master"
alias gitinit="~/scripts/git/git_init.sh"
alias gitpush="~/scripts/git/git_push.sh"
alias gitup="~/scripts/git/git_upstream_push.sh"
alias gitreset="~/scripts/git/git_reset.sh"
alias gitsave="git add . && git commit -m"
git-fworktree () {
cd "$(git worktree list | fzf | awk '{print $1}')"
}
# backup
alias backup="~/scripts/backup/backup/backup.sh"
alias backup-workspace="~/scripts/backup/backup_workspace/backup_workspace.sh"
alias backup-anarchybox="~/scripts/backup/backup_anarchybox/backup_anarchybox.sh"
alias build-dotfiles="~/scripts/backup/build_dotfiles/build_dotfiles.sh"
alias burniso="~/scripts/backup/burn_iso/burn_iso.sh"
# devices
alias formatdev="~/scripts/devices/formatdev.sh"
alias formatstoragedev="~/scripts/devices/formatstoragedev.sh"
alias testdev="~/scripts/devices/testdev.sh"
alias rescandevs"~/scripts/devices/rescandevs.sh"
alias wipedev="~/scripts/devices/wipedev.sh"
alias fastwipedev="~/scripts/devices/fastwipedev.sh"
alias tempram="mkdir -p /mnt/ram; mount -t tmpfs tmpfs /mnt/ram -o size=8192M"
usermount() {
if [[ $# -lt 2 ]]; then
echo "Usage: usermount <device> <mount_point>"
return 1
fi
# sudo mount -o uid=$UID,gid=$UID "$1" "$2"
sudo mount "$1" "$2"
sudo chown -R $USER:$USER "$2"
}
usermount_hdd() {
if [[ $# -lt 2 ]]; then
echo "Usage: usermount_hdd <device> <mount_point>"
return 1
fi
# sudo mount -o uid=$UID,gid=$UID,big_writes "$1" "$2"
sudo mount -o big_writes "$1" "$2"
sudo chown -R $USER:$USER "$2"
}
unmount() {
if [[ $# -lt 1 ]]; then
echo "Usage: unmount <mount_point>"
return 1
fi
sudo sync
sudo umount "$1"
sudo udisksctl power-off -b "$1"
}
# diagnostics
alias disk="df -h | grep '/$'"
alias iommu="~/scripts/diagnostics/iommu.sh"
# vms and virt
alias libvirt-start="sudo systemctl start libvirtd-admin.socket libvirtd-ro.socket libvirtd.socket"
alias libvirt-stop="sudo systemctl stop libvirtd-admin.socket libvirtd-ro.socket libvirtd.socket"
alias aarch64-install="~/scripts/virt/aarch64/install.sh"
alias aarch64-run="~/scripts/virt/aarch64/run.sh"
alias x86_64-install="~/scripts/virt/x86_64/install.sh"
alias x86_64-run="~/scripts/virt/x86_64/run.sh"
# containers
alias sudocker="sudo usermod -aG docker $USER; newgrp docker"
alias docker-start="sudo systemctl start docker.socket docker.service"
alias docker-stop="sudo systemctl stop docker.socket docker.service"
alias dockerip="docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'"
dockersh() {
docker exec -it $1 /bin/sh
}
# nvim packages
alias strudelrm="rm -rf /home/rodfer/.local/share/nvim/lazy/strudel.nvim"
# disk
dush() {
## List by size both hidden and normal files
local dir="${1:-.}"
setopt localoptions nullglob
du -sh "$dir"/* "$dir"/.* 2>/dev/null | sort -h
}
# vms
alias kali="~/scripts/vms/vnc_kali_vm.sh"
alias alarm-stop="ssh anarchybox -t '/home/webmaster/scripts/cron/stop_alarm.sh'"
# embedded
alias get_idf=". $HOME/.espressif/esp-idf/export.sh"
# Autosuggestions
source $HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh || git clone https://github.com/zsh-users/zsh-autosuggestions $HOME/.zsh/zsh-autosuggestions && source $HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# Syntax highlighting
source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.zsh/zsh-syntax-highlighting --depth 1 && source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Apdate keyboard and tty
source $HOME/.zprofile
neofetch