Some of those are from this repo, many thanks! https://github.com/razzius/fish-functions
Last active
December 15, 2019 16:17
-
-
Save henrycunh/207e1829d6d60940e77a6df30c528758 to your computer and use it in GitHub Desktop.
Useful Docker Functions
This file contains hidden or 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
function backup --argument filename | |
cp $filename $filename.bak | |
end | |
function restore --argument file | |
mv $file (echo $file | sed s/.bak//) | |
end | |
function mc | |
mkdir $argv | |
cd $argv | |
end | |
function note | |
if [ "$argv" != '' ] | |
echo $argv >>~/notes.org | |
else | |
pbpaste >>~/notes.org | |
echo >>~/notes.org | |
end | |
end | |
function notes | |
$EDITOR ~/notes.org | |
end | |
function new-notebook --argument _name | |
if [ "$argv" != '' ] | |
set name $_name | |
else | |
echo "Give a name to it!" | |
return | |
end | |
set ipynb ~/notebooks/$name.ipynb | |
test -e $ipynb; or cp ~/notebooks/template.ipynb ~/notebooks/$name.ipynb | |
echo "Notebook running at http://jupyter.local/notebooks/$name.ipynb" | |
end | |
function ga | |
if [ -z "$argv" ] | |
git add . | |
else | |
git add $argv | |
end | |
end | |
function gac | |
git add . | |
git commit -m "$argv" | |
end | |
function gc | |
if [ -z "$argv" ] | |
if test (git new-files | wc -l | tr -d ' ') = 1 | |
git commit -m "Add "(git diff --name-only --cached) | |
else if not git diff --cached --exit-code --quiet | |
echo "Add a commit message" | |
else | |
echo "Nothing staged" | |
end | |
else if [ "$argv" = - ] | |
echo 'git checkout -' | |
git checkout - | |
else | |
git commit -m (echo $argv) | |
end | |
end | |
function gcr | |
set ref (git current | cut -d / -f 2 | tr '[:lower:]' '[:upper:]') | |
git commit -m "[$ref] $argv" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment