Skip to content

Instantly share code, notes, and snippets.

@AlessandroMinali
Last active March 6, 2025 16:54
Show Gist options
  • 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
export NEXT_TELEMETRY_DISABLED=1
alias spotify="/Users/alessandro/Desktop/media/music/spotify.rb"
alias media="cd /Users/alessandro/Desktop/media && subl ."
alias timer="/Users/alessandro/Desktop/exercise/timer"
alias calorie="d && ruby calorie.rb && open calorie.txt"
alias p='ping google.ca'
alias km='function hack(){
echo "scale=1; $1 / 1.609" | bc
}; hack'
alias mi='function hack(){
echo "scale=1; $1 * 1.609" | bc
}; hack'
alias ft='function hack(){
echo "$1 * 0.3048" | bc
}; hack'
alias mm='function hack(){
echo "$1 / 0.3048" | bc
}; hack'
alias arc="wget -e robots=off -H -p -k"
alias mdns="sudo pkill mDNS"
shuffle(){
shuf -o $1 $1
}
alias sorted='function hack(){
ruby -e "
def sanitize(str); str.sub(/^[\+\-]\s*/, \"\").strip.downcase; end
ARGV.each do |f|
out = IO.readlines(f).sort_by{|a| sanitize(a)}
IO.write(f, out.join())
end
" $@
}; hack'
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 -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 compile='function hack(){
clang -Wall -pedantic -std=c99 "$1" && ./a.out
}; hack'
alias gccO='gcc -Wall -Wextra -pedantic -std=c99 -O2 -flto'
alias clang='clang -Wall -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 -E "(part|ytdl)$"'
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;
git add .; git commit -am "listen"; git push; clear;
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*
# CUSTOM #
set -e
export BASE="/Users/aminali/Desktop/alessandro"
# nav
alias d="cd ~/Desktop"
alias dd="cd $BASE/feed-reader"
alias media="cd $BASE/media && subl ."
# util
sorted() {
ruby -e "
def sanitize(str); str.sub(/^[\+\-]\s*/, '').strip.downcase; end
ARGV.each do |f|
out = IO.readlines(f).sort_by{|a| sanitize(a)}
IO.write(f, out.join())
end
" "$@"
}
# tools
alias timer="$BASE/exercise/timer"
alias duo="sleep 600 && say AAAALAAAAAARMMMMAAAALAAAAAARMMMMAAAALAAAAAARMMMM"
search() {
grep -ri "$*" .
}
# sublime
export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"
# movie
m() {
local save=$(pwd)
cd $BASE/media/movies
clear
./movie
cd $save
}
movie() {
cd $BASE/media
echo "$@" >> ./movies/done.txt
sorted ./movies/done.txt
}
# tv
tv() {
local save=$(pwd)
cd $BASE/feed-reader/utils
git pull && clear && ./tv && git add . && git commit -am "tv" && git push
clear
cd $save
}
# music
alias lofi="mpv --quiet --no-video --no-terminal \"https://www.youtube.com/watch?v=jfKfPfyJRdk\" &"
alias stop="killall mpv"
alias youtube="yt-dlp --no-mtime -x --audio-format mp3 -o \"$BASE/music/%(title)s.%(ext)s\""
music() {
local save=$(pwd)
cd $BASE/media/music/
./music
git add . && git commit -am 'music' && git push
cd $save
}
# audio - brew install switchaudio-osx
alias am="SwitchAudioSource -s \"MacBook Pro Speakers\""
alias as="SwitchAudioSource -s \"DELL U3425WE\""
alias ah="SwitchAudioSource -s \"Shure MV7+\""
# git
export PATH="$PATH:/Users/aminali/Desktop/alessandro/scripts/git-cmds"
# rails
alias r="rails"
alias rt="ruby $BASE/scripts/rail_and_tailwind.rb"
alias routes="rails routes | grep"
# reader
w() {
local save=$(pwd)
cd $BASE/feed-reader/utils
clear
./watch
cd $save
}
reader() {
local save=$(pwd)
cd $BASE/feed-reader/utils
git pull
clear
./client
git add . && git commit -am "read" && git push
clear
cd $save
}
alias yt="ps aux | grep yt-dlp"
# CUSTOM_END #
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
# homebrew
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/openssl/lib/
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
# odin docker-less
export PGGSSENCMODE="disable"
export DATABASE_HOST="localhost"
# odin
export MASTER="develop"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment