My zsh config made from scratch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

# Just a funky little collection of more or less useful aliases
#Various impractical jokes and tools
if [ -n "$LOCALCITY" ]; then
alias weatherfetch="curl -sf https://wttr.in/$LOCALCITY | head -n 7 && echo ''"
fi
if [ -n "$DESKTOP_SESSION" ]; then
# winver is a thing, so here's linver
alias linver="nohup zenity --info --text=\"Linux version: \\n$(uname -srm)\" > /dev/null"
# tools to manipulate xclip easier
alias paste="xclip -o -selection clipboard"
alias copy="xclip -o | xclip -i -selection clipboard"
fi
# unless you're using vim to this day, this is what most people do
alias vim="nvim"
function nojail() {
# specific tool for firejail to disable jailing at all
PATH=`echo $PATH | sed "s/:\/usr\/local\/bin//g" | sed "s/:\/usr\/local\/sbin//g"` $@
}
# Set a default music path
if [ -z "$MUSIC_PATH" ]; then
export MUSIC_PATH="$HOME/Music/"
fi
# Try to be sensible about youtube-dl downloader
if ! which yt-dlp > /dev/null; then
if ! which youtube-dl > /dev/null; then
alias yt-dlp="echo Unable to execute: youtube-dl or yt-dlp not found; false "
else
# No, really. Not even an ad, it just runs faster because people keep fixing the throttling issue, which youtube-dl got stuck on.
alias yt-dlp="echo youtube-dl is heavily outdated, consider installing yt-dlp; youtube-dl "
fi
fi
function ytdl() {
# Download and convert to audio a youtube video
if [ -z "$1" ]; then
echo "USAGE: ytdl <video name or URL>"
return
fi
mkdir -p $MUSIC_PATH/ytdl
yt-dlp -x --default-search "ytsearch:" --output "$MUSIC_PATH/ytdl/%(title)s.%(ext)s" $1
}
function scdl() {
# Download audio from soundcloud
if [ -z "$1" ]; then
echo "USAGE: scdl <audio name or URL>"
return
fi
mkdir -p $MUSIC_PATH/soundclown
yt-dlp -x --default-search "scsearch:" --output "$MUSIC_PATH/soundclown/%(title)s.%(ext)s" $1
}
function countlines() {
if [ -z "$1" ]; then
echo "USAGE: countlines <file extension>"
return
fi
for file in $(find . -name \*.$1); do
cat $file
done | wc -l
}