Skip to content

Instantly share code, notes, and snippets.

@rubeniskov
Last active September 29, 2022 00:39
Show Gist options
  • Save rubeniskov/492531bf3cfa162e9a3b21ffb0db6ca4 to your computer and use it in GitHub Desktop.
Save rubeniskov/492531bf3cfa162e9a3b21ffb0db6ca4 to your computer and use it in GitHub Desktop.
exec_remote() { wget -q -O- "$1" | bash -s "${@:2}"; }
cache_remote() { bn=`[ -n "$2" ] && echo "$2" || basename "$1"`; td=`echo /tmp/test`; mkdir -p $td; fn=$td/$bn; [ -f $fn ] || wget -q -O- "$1" > $fn; chmod +x $fn; echo $fn;}
import_remote() { cn=`cache_remote "$@"`; bn=`basename $cn`; fn="${bn%.*}"; eval "$fn() { bash -e $cn "\$@"; }"; }
alias resolve-gist-url='exec_remote https://bit.ly/2JGtC2R'
alias import='import_remote'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment