Skip to content

Instantly share code, notes, and snippets.

@arnos-stuff
Last active December 7, 2022 22:13
Show Gist options
  • Save arnos-stuff/0f812069139763ac786225264506227d to your computer and use it in GitHub Desktop.
Save arnos-stuff/0f812069139763ac786225264506227d to your computer and use it in GitHub Desktop.
shell command that automatically submits a gist to your github account after opening vscode to ask for you to paste/write the gist's content
# the rest of your ~/.bashrc or ~/.bash_profile (even ~/.zshrc)
# ...
# ...
# aliases
# first parameter: extension (ex: py, gz, txt, js, ...)
# second parameter: filename (w/o extension)
# third parameter: description of the gist
alias ghgist='_ghgist(){ mkdir -p /tmp/ghghist ; code -w "/tmp/ghghist/$2.$1" ; cat /tmp/ghghist/$2.$1 | gh gist create -d "$3" -p -f "$2.$1" | rm -rf /tmp/ghghist/$2.$1}; _ghgist'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment