Skip to content

Instantly share code, notes, and snippets.

@sloppylopez
Last active April 10, 2019 18:03
Show Gist options
  • Save sloppylopez/c221a7763e8e80f62b000c84ca76db84 to your computer and use it in GitHub Desktop.
Save sloppylopez/c221a7763e8e80f62b000c84ca76db84 to your computer and use it in GitHub Desktop.
Collection of Fish functions
function cat
ccat $argv
end
function cleanDockerLocal
echo -e "Stoping Docker containers 💃" | colorStuff
docker kill (docker ps -q) | colorStuff
echo -e "Deleting Docker containers 🔥" | colorStuff
docker rm (docker ps -a -q) | colorStuff
echo -e "Deleting Docker images 💥" | colorStuff
docker rmi (docker images -q) | colorStuff
echo -e "cleanDockerLocal done! 🀄" | colorStuff
end
set -l symbols ◷ ◶ ◵ ◴
function clock
while sleep 0.5
echo -e -n "\b$symbols[1]" | colorStuff
set -l symbols $symbols[2..-1] $symbols[1]
end
end
function colorStuff
while read -l input
switch $input
case "*error*"
set_color red
echo $input
case "*warning*"
set_color yellow
echo $input
case "*"
set_color magenta
echo $input
end
end
set_color blue
end
function createServer
echo -e "Creating Python server 🐍" | colorStuff
python -m SimpleHTTPServer | colorStuff
end
function dps
echo -e "Listing Docker Containers 🐳" | colorStuff
docker ps $argv | colorStuff
end
function findByName
echo 'Finding by name' $argv[2] '@' $argv[1] '🍿' | colorStuff
sudo find $argv[1] -name $argv[2] | colorStuff
end
function lsa
echo "Listing 'ls -trhall' 🍺" | colorStuff
ls -thrall
end
function myIp
echo "My ip address is 🦄" | colorStuff
ipconfig getifaddr en0 | colorStuff
end
function resetLastNonPushedCommit
echo "Git: Removing last non-pushed commit from local 💩" | colorStuff
git reset --hard HEAD^
end
function seekAndDestroy
echo "Searchiiiiiiiing... seek and destroy 🎸" | colorStuff
kill (lsof -t -i :$argv[1])
end
function sourceAllFishFunctions
. colorStuff.fish sourceAllFishFunctions.fish cleanDockerLocal.fish createServer.fish dps.fish findByName.fish lsa.fish whoListenAt.fish
end
function whoListenAt
echo -e "Checking who is listening at" $argv[1] '🎳' | colorStuff
lsof -i :$argv[1]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment