Last active
October 4, 2022 21:07
-
-
Save Kambaa/f570ac29ba015b44b47333100a07a9ad to your computer and use it in GitHub Desktop.
My Bash Profile Code
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
####### UPDATED 2022 ########### | |
##For Linux: | |
###DOWNLOAD YT_DLP: https://github.com/yt-dlp/yt-dlp/releases/download/2022.10.04/yt-dlp_linux | |
#####################################START###################################### | |
alias cls='clear' | |
alias cd..='cd ..' | |
alias ci='mvn clean install' | |
alias q='exit' | |
# https://github.com/yt-dlp/yt-dlp | |
ytdlmp4(){ | |
exec="/home/yg/yt-dlp_linux" | |
out_dir="/home/yg/Videolar" | |
ffmpeg_location="/usr/bin/ffmpeg" | |
first=$1 | |
second="v" | |
shortFixedurl=${first/'shorts'/$second} | |
$exec $shortFixedurl -f '(bestvideo[height<=?1080]+bestaudio/best)[protocol^=http]' -o $out_dir'/%(title)s%(resolution)s.%(ext)s' --ffmpeg-location $ffmpeg_location --merge-output-format 'mp4' -k $2 | |
} | |
ytdlmp3(){ | |
exec="/home/yg/yt-dlp_linux" | |
out_dir="/home/yg/Videolar" | |
ffmpeg_location="/usr/bin/ffmpeg" | |
first=$1 | |
second="v" | |
shortFixedurl=${first/'shorts'/$second} | |
$exec $shortFixedurl -o $out_dir'/%(title)s.%(ext)s' -f '(bestvideo+bestaudio/best)[protocol^=http]' --ffmpeg-location $ffmpeg_location -x --audio-format 'mp3' -k $2 | |
} | |
ytdl(){ | |
exec="/home/yg/yt-dlp_linux" | |
out_dir="/home/yg/Videolar" | |
ffmpeg_location="/usr/bin/ffmpeg" | |
$exec $@ -o $out_dir'/%(title)s.%(ext)s' -f '(bestvideo+bestaudio/best)' --ffmpeg-location $ffmpeg_location --merge-output-format 'mp4' -k | |
} | |
2mp4(){ | |
ffmpeg_location="/usr/bin/ffmpeg" | |
$ffmpeg_location -y -i $1 -crf 20.0 -vcodec libx264 -filter:v scale=1280:720 -preset slow -acodec libvo_aacenc -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 $2 "$1.mp4" | |
} | |
PS1='\[\033[1;36m\]\u@\h:\[\033[0m\]\[\033[1;34m\]\w\[\033[0m\] \[\033[1;32m\]$(__git_ps1)\[\033[0m\]\$ ' | |
#####################################END###################################### | |
##For git bash for windows: | |
alias cls='clear' | |
alias cd..='cd ..' | |
alias ci='mvn clean install' | |
alias q='exit' | |
# https://github.com/yt-dlp/yt-dlp | |
ytdlmp4(){ | |
first=$1 | |
second="v" | |
shortFixedurl=${first/'shorts'/$second} | |
/c/Users/ygndz/ytdlp/yt-dlp.exe $shortFixedurl -f '(bestvideo[height<=?1080]+bestaudio/best)[protocol^=http]' -o '/c/Users/ygndz/Videos/%(title)s%(resolution)s.%(ext)s' --ffmpeg-location '/c/Users/ygndz/Documents/ffmpeg.exe' --merge-output-format 'mp4' -k $2 | |
} | |
ytdlmp3(){ | |
first=$1 | |
second="v" | |
shortFixedurl=${first/'shorts'/$second} | |
/c/Users/ygndz/ytdlp/yt-dlp.exe $shortFixedurl -o '/c/Users/ygndz/Videos/%(title)s.%(ext)s' -f '(bestvideo+bestaudio/best)[protocol^=http]' --ffmpeg-location '/c/Users/ygndz/Documents/ffmpeg.exe' -x --audio-format 'mp3' -k $2 | |
} | |
ytdl(){ | |
/c/Users/ygndz/ytdlp/yt-dlp.exe $@ -o '/c/Users/ygndz/Videos/%(title)s.%(ext)s' -f '(bestvideo+bestaudio/best)' --ffmpeg-location '/c/Users/ygndz/Documents/ffmpeg.exe' --merge-output-format 'mp4' -k | |
} | |
2mp4(){ | |
"/c/Users/ygndz/Documents/ffmpeg.exe" -y -i $1 -crf 20.0 -vcodec libx264 -filter:v scale=1280:720 -preset slow -acodec libvo_aacenc -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 $2 "$1.mp4" | |
} | |
PS1='\[\033[1;36m\]\u@\h:\[\033[0m\]\[\033[1;34m\]\w\[\033[0m\] \[\033[1;32m\]$(__git_ps1)\[\033[0m\]\$ ' | |
########### END OF FILE ########### | |
# MY BASH PROFILE CODE | |
# I'm using Mint and when developing, i use these stuff more than enough to make my life easier. | |
# I named this .bash_profile, but i usually copy this code at the end of ~/.bashrc file and this command: `source ~/.bashrc` | |
alias cls='clear' | |
alias cd..='cd ..' | |
# I use maven, and this helps me a lot! | |
alias ci='mvn clean compile' | |
# When developing in java, changing sdk's was pain in the butt. My coworker(namely Umut-Big Brother Umut) | |
# suggested and after some searching, sdkman.io is the greatest way to use multiple sdk's in local dev env. | |
# check their site out, install sdkman, download some jdk libs and change JDK's with one command! | |
# (list jdks via `sdk list java`, download with `sdk install java <JAVA_VERSION>`, learn more from `sdk help` command) | |
alias j8="sdk use java 8.0.292-open" | |
alias j11="sdk use java 11.0.11-open" | |
alias q='exit' | |
# I couldn't disable my touchpad for some reason, it become frustrating me so i wrote these to disable it. | |
gettouchpadid() { | |
xinput list --id-only "PS/2 Generic Mouse"; | |
} | |
alias distouch="xinput --disable $(gettouchpadid)" | |
alias entouch="xinput --enable $(gettouchpadid)" | |
# I use these commands the most so i wrote these to ease my pain. | |
getcurrentgitbranch() { | |
if [ -d .git ]; then | |
git symbolic-ref --short HEAD; | |
else | |
echo "getcurrentgitbranch Error: Not A Git Repository"; | |
fi; | |
} | |
gitpull() { | |
if [ -d .git ]; then | |
git pull origin $(getcurrentgitbranch) | |
else | |
echo "gitpull Error: Not A Git Repository"; | |
fi; | |
} | |
gitpush() { | |
if [ -d .git ]; then | |
git push origin $(getcurrentgitbranch) | |
else | |
echo "gitpush Error: Not A Git Repository"; | |
fi; | |
} | |
# This code I got from my coworker (named Semih), it displays the current git branch on terminal | |
PS1='\[\033[1;36m\]\u@\h:\[\033[0m\]\[\033[1;34m\]\w\[\033[0m\] \[\033[1;32m\]$(__git_ps1)\[\033[0m\]\$ ' | |
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! | |
export SDKMAN_DIR="/home/yg/.sdkman" | |
[[ -s "/home/yg/.sdkman/bin/sdkman-init.sh" ]] && source "/home/yg/.sdkman/bin/sdkman-init.sh" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment