Skip to content

Instantly share code, notes, and snippets.

@AlessandroMinali
Last active October 21, 2023 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlessandroMinali/587ee8f7d0ec66448bd56125ef2f9406 to your computer and use it in GitHub Desktop.
Save AlessandroMinali/587ee8f7d0ec66448bd56125ef2f9406 to your computer and use it in GitHub Desktop.
dotfile
export BASH_SILENCE_DEPRECATION_WARNING=1
alias p='ping google.ca'
alias lofi="mpv https://www.youtube.com/watch?v=jfKfPfyJRdk --no-video --no-terminal &"
play(){
trap 'murder' 1 3 9 # cleanup when terminal closes
SAVEIFS=$IFS
IFS=$'\n' # allow for filenames with spaces
music=$(find ~/Downloads/music ~/Desktop/All\ Song/ -name "*.mp3" | shuf) # shuffle music files
for f in $music
do
afplay "$f" -v 0.5 # play the audio
done & # background the process
IFS=$SAVEIFS
clear
}
# kill the audio player to proceed to the next track
alias next='killall afplay && clear'
# stop the background process and all further playing
alias stop='kill %?afplay && sleep 0.1 && clear'
# track down and kill everything in sight
alias murder='killall mpv; kill %?afplay; while killall afplay; do :; done'
alias gcc='gcc -Wall -Wextra -Werror -pedantic -std=c99 -O2 -flto'
alias clang='clang -Wall -Wextra -Werror -pedantic -std=c99'
alias time='/usr/bin/time -lp'
alias kill='kill -9'
alias shrug="echo '¯\_(ツ)_/¯' | pbcopy"
alias flip="echo '(╯°□°)╯︵ ┻━┻' | pbcopy"
alias sound="ps aux | grep coreaudiod | awk '{print $2}' | xargs sudo kill -9"
kill_port(){
lsof -i ":$1" |
awk 'NR > 1 {print $2}' |
xargs sudo kill -9
}
alias gif="ffmpeg -i in.mov -s 800x600 -pix_fmt rgb24 -r 15 -f gif - | gifsicle --optimize=3 > out.gif"
alias font='function hack(){
strings $1 | grep FontName
}; hack'
alias d='cd ~/Desktop'
alias r="rails"
alias rbcop='cat <(git ls-files -o --exclude-standard) <(git diff --name-only --diff-filter=d) <(git diff --cached --name-only --diff-filter=d) | grep "\.\(rb\|rake\)" | grep -v schema | xargs rubocop -A'
alias rspec="rspec --format documentation"
alias spec="cat <(git ls-files -o --exclude-standard) <(git diff --name-only --diff-filter=d) | grep _spec.rb | xargs rspec"
alias prspec="parallel_test -t rspec spec"
alias redis='redis-server --daemonize yes'
alias hats="cd ~/Desktop/hats; rails server -p 50130"
alias dev="rake dev:komoju"
alias fg='echo "require \"factory_bot\"; FactoryBot.find_definitions; include FactoryBot::Syntax::Methods" | pbcopy'
export RETRY_RSPEC=false
export HATS=http://localhost:50130
export MERCHANT=degica-mart
export LOCALE=en
alias youtube='function hack(){
save=$(pwd);
cd ~/Downloads/music;
yt-dlp --no-mtime -x --audio-format mp3 $1;
cd $save;
}; hack'
alias playlist='function hack(){
yt-dlp --no-mtime -x --concat-playlist always --audio-format mp3 $1;
}; hack'
alias c='clear; ls ~/Desktop/feed-reader/videos/ | grep -Ev "(webm|mp4)$"'
alias l='clear; find ~/Desktop/feed-reader/videos/ -type f \( -iname \*.webm -o -iname \*.mp4 \) && find ~/Desktop/feed-reader/videos/ -type f \( -iname \*.webm -o -iname \*.mp4 \) | wc -l'
alias reader='function hack(){
save=$(pwd);
cd ~/Desktop/feed-reader/utils;
git pull
clear;
./client;
git add .; git commit -am "read"; git push; clear;
cd $save
}; hack'
alias tv='function hack(){
save=$(pwd);
cd ~/Desktop/feed-reader/utils;
git pull;
clear;
./tv;
git add .; git commit -am "tv"; git push; clear;
cd $save
}; hack'
alias w='function hack(){
save=$(pwd);
cd ~/Desktop/feed-reader/watch;
clear;
./watch;
git add .; git commit -am "watch"; git push; clear;
cd $save
}; hack'
alias m='function hack(){
save=$(pwd);
cd ~/Desktop/media/movies/ && ./movie;
cd $save
}; hack'
alias bcamp='function hack(){
save=$(pwd);
cd ~/Desktop/feed-reader/bcamp && ./bcamp $1;
cd $save
}; hack'
alias music='function hack(){
save=$(pwd);
cd ~/Desktop/media/music/ && ./music;
cd $save
}; hack'
alias t='function hack(){
save=$(pwd);
cd ~/Desktop/japanese_tools
ruby g_trans.rb $@
cd $save
}; hack'
alias j='ruby ~/Desktop/japanese_tools/jisho.rb'
alias b='function hack(){
save=$(pwd);
cd ~/Desktop/budget/;
clear;
./budget;
cd $save
}; hack'
alias gen='ruby /Users/alessandro/Desktop/scratch/gen.rb'
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"
export PATH=$PATH:/opt/riscv/bin
export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
export rvm_autoupdate_flag=0
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment