~razzi/fish-functions

b4b1331dc7a3bfa970f92e011e6e7a2b718afc1e — Razzi Abuissa 2 months ago 2263b15
Remove more unused functions, many macos specific
36 files changed, 0 insertions(+), 157 deletions(-)

D functions/after.fish
D functions/cd-root.fish
D functions/clear-dns.fish
D functions/clone.fish
D functions/colorpicker.fish
D functions/config.fish
D functions/defined.fish
D functions/dim.fish
D functions/docker-launch.fish
D functions/docker-shell.fish
D functions/dollar.fish
D functions/download-exercism.fish
D functions/draw-line.fish
D functions/ec.fish
D functions/edit-private.fish
D functions/file-sizes.fish
D functions/foreach.fish
D functions/get-source.fish
D functions/goto.fish
D functions/hack.fish
D functions/last-word.fish
D functions/new-vm.fish
D functions/notify.fish
D functions/nowifi.fish
D functions/open-action.fish
D functions/open-jupyter.fish
D functions/post.fish
D functions/ppgrep.fish
D functions/presskeys.fish
D functions/push.fish
D functions/redo.fish
D functions/see.fish
D functions/sleep-notify.fish
D functions/time-until.fish
D functions/ved.fish
D functions/wait-notify.fish
D functions/after.fish => functions/after.fish +0 -3
@@ 1,3 0,0 @@
function after --argument pattern
    awk "/$pattern/,0"
end

D functions/cd-root.fish => functions/cd-root.fish +0 -3
@@ 1,3 0,0 @@
function cd-root
    cd (git root)
end

D functions/clear-dns.fish => functions/clear-dns.fish +0 -3
@@ 1,3 0,0 @@
function clear-dns
    sudo killall -HUP mDNSResponder
end

D functions/clone.fish => functions/clone.fish +0 -3
@@ 1,3 0,0 @@
function clone --argument url
    clone-cd $url ~/forks/(repo-from-url $url)
end

D functions/colorpicker.fish => functions/colorpicker.fish +0 -6
@@ 1,6 0,0 @@
function colorpicker
    set rgb (osascript -e 'choose color' | string split ,)
    for color in $rgb
        printf %02x (math round $color / (printf %d 0x101))
    end
end

D functions/config.fish => functions/config.fish +0 -4
@@ 1,4 0,0 @@
function config --argument KEY VALUE
    echo export $KEY=\"$VALUE\" >>~/.profile
    source ~/.profile
end

D functions/defined.fish => functions/defined.fish +0 -3
@@ 1,3 0,0 @@
function defined --argument var
    set -q $var[1]
end

D functions/dim.fish => functions/dim.fish +0 -3
@@ 1,3 0,0 @@
function dim
    brightness 0
end

D functions/docker-launch.fish => functions/docker-launch.fish +0 -3
@@ 1,3 0,0 @@
function docker-launch
    docker run -it (docker build -q .)
end

D functions/docker-shell.fish => functions/docker-shell.fish +0 -6
@@ 1,6 0,0 @@
function docker-shell
    set tmpfile (mktemp)
    docker build . | tee $tmpfile # todo maybe do a --no-cache option
    set image_id (tail -1 $tmpfile | last-col)
    docker run --interactive --tty $image_id | tee -a (isodatetime).log
end

D functions/dollar.fish => functions/dollar.fish +0 -5
@@ 1,5 0,0 @@
function dollar --description 'Remove the starting $ from example shell commands'
    while read -l line
        eval (echo $line | cut -d ' ' -f 2-)
    end
end

D functions/download-exercism.fish => functions/download-exercism.fish +0 -6
@@ 1,6 0,0 @@
function download-exercism --argument track
    curl -LS https://exercism.io/tracks/$track/exercises | grep "/tracks/$track/exercises/" | awk '{print $3}' | cut -d/ -f5 | cut -d\" -f1 >~/Exercism/$track-exercises.txt
    cat ~/Exercism/$track-exercises.txt | while read -l exercise
        exercism download --exercise="$exercise" --track=$track
    end
end

D functions/draw-line.fish => functions/draw-line.fish +0 -4
@@ 1,4 0,0 @@
function draw-line
    seq $COLUMNS | string replace -r '\d+' - | string join ''

end

D functions/ec.fish => functions/ec.fish +0 -8
@@ 1,8 0,0 @@
# Defined in /var/folders/7v/b0z6dsqj1fx8k5rf8x121l580000gn/T//fish.egdHMw/ec.fish @ line 2
function ec
    touch $argv
    emacsclient -n $argv ^/dev/null
    if test $status = 1
        open -a /Applications/Emacs.app/ -- $argv
    end
end

D functions/edit-private.fish => functions/edit-private.fish +0 -8
@@ 1,8 0,0 @@
function edit-private --argument name
    mkdir -p ~/.config/fish/functions/private
    set file ~/.config/fish/functions/private/$name.fish
    echo "function $name" >>$file
    echo end >>$file
    $EDITOR $file
    source $file
end

D functions/file-sizes.fish => functions/file-sizes.fish +0 -4
@@ 1,4 0,0 @@
function file-sizes --argument _dir
    set dir (default $_dir .)
    du -sh $dir/* | gsort -h
end

D functions/foreach.fish => functions/foreach.fish +0 -5
@@ 1,5 0,0 @@
function foreach --argument command
    for arg in $argv[2..]
        fish -c "$command $arg"
    end
end

D functions/get-source.fish => functions/get-source.fish +0 -5
@@ 1,5 0,0 @@
function get-source --argument app
    set formula_path (brew edit --print-path $app)
    set github_url (cat $formula_path | grep github | coln 2 | string trim -c \")
    clone $github_url
end

D functions/goto.fish => functions/goto.fish +0 -3
@@ 1,3 0,0 @@
function goto --argument where
    cd (fd $where)
end

D functions/hack.fish => functions/hack.fish +0 -3
@@ 1,3 0,0 @@
function hack
    cd ~/hack
end

D functions/last-word.fish => functions/last-word.fish +0 -3
@@ 1,3 0,0 @@
function last-word
    awk '{print $NF}'
end

D functions/new-vm.fish => functions/new-vm.fish +0 -6
@@ 1,6 0,0 @@
function new-vm
    mkdir-cd ~/hack/vm-(isodatetime)
    vagrant init debian/bullseye64
    vagrant up
    vagrant ssh
end

D functions/notify.fish => functions/notify.fish +0 -3
@@ 1,3 0,0 @@
function notify
    say notify
end

D functions/nowifi.fish => functions/nowifi.fish +0 -3
@@ 1,3 0,0 @@
function nowifi
    networksetup -setairportpower en0 off
end

D functions/open-action.fish => functions/open-action.fish +0 -3
@@ 1,3 0,0 @@
function open-action
    open https://github.com/$GITHUB_USERNAME/(basename $PWD)/commit/(git commit-id)/checks
end

D functions/open-jupyter.fish => functions/open-jupyter.fish +0 -3
@@ 1,3 0,0 @@
function open-jupyter
    open http://localhost:8888
end

D functions/post.fish => functions/post.fish +0 -12
@@ 1,12 0,0 @@
function post
    cd ~/razzius.github.io/
    set title "$argv"
    set slug (echo $argv | sed 's/ /-/g' | string lower)
    set date (date +%Y-%m-%d)
    set filename _posts/$date-$slug.md

    echo >$filename ---
    echo >>$filename title: $title
    echo >>$filename date: $date
    echo >>$filename ---
end

D functions/ppgrep.fish => functions/ppgrep.fish +0 -3
@@ 1,3 0,0 @@
function ppgrep --argument pattern
    pgrep $pattern | xargs pstree
end

D functions/presskeys.fish => functions/presskeys.fish +0 -5
@@ 1,5 0,0 @@
function presskeys --argument keys
    osascript -e "tell application \"System Events\"
 keystroke \"$keys\"
end tell"
end

D functions/push.fish => functions/push.fish +0 -3
@@ 1,3 0,0 @@
function push --argument path
    git -C $path push
end

D functions/redo.fish => functions/redo.fish +0 -3
@@ 1,3 0,0 @@
function redo
    eval "$failed_command"
end

D functions/see.fish => functions/see.fish +0 -3
@@ 1,3 0,0 @@
function see --argument command
    less (which $command)
end

D functions/sleep-notify.fish => functions/sleep-notify.fish +0 -3
@@ 1,3 0,0 @@
function sleep-notify --argument time
    fish -c "sleep $time; notify" &
end

D functions/time-until.fish => functions/time-until.fish +0 -5
@@ 1,5 0,0 @@
function time-until --argument time
    set target (chrono $time -f %s)
    set now (date +%s)
    math $target - $now
end

D functions/ved.fish => functions/ved.fish +0 -7
@@ 1,7 0,0 @@
function ved
    if string-empty $VIM_TERMINAL
        vim $argv
    else
        vim-call Tapi_TerminalEdit $argv
    end
end

D functions/wait-notify.fish => functions/wait-notify.fish +0 -4
@@ 1,4 0,0 @@
function wait-notify --argument time
    set seconds (time-until $time)
    bash -c "sleep $seconds; notify" &
end