Skip to content

Instantly share code, notes, and snippets.

@imyxh
Last active May 30, 2018 01:47
Show Gist options
  • Save imyxh/a0d63bceeaeffb235c4adf0e5bb0f318 to your computer and use it in GitHub Desktop.
Save imyxh/a0d63bceeaeffb235c4adf0e5bb0f318 to your computer and use it in GitHub Desktop.
#!/bin/sh
# pushes all dotfiles and scripts to gist
# uses https://github.com/defunkt/gist
#TODO: add parameters 'n stuff
# check if gist is installed
if ! type "gist" > /dev/null; then
echo "Gist isn't installed! https://github.com/defunkt/gist"
exit 1
fi
# create associative array where keys are gist IDs and values are their paths
typeset -A GISTS
GISTS=(
[ab83540c2d6729a04c9d1d154f66b2ed]=~/.aliases
[bc9ab3c9b51120489d35f792529fb80d]=~/.vimrc
[d525b61523843183eeaf591184072c0b]=~/.zshrc
[13a49a36798fc4870325169a384630af]=~/aur/gimp-git/gimp-git.install
[99fd4ccf1f7e4325889071d904c9ff1e]=~/aur/gimp-git/PKGBUILD
[062ba513c991f5fd3e5daca505115b32]=~/scripts/color_test.sh
[480af3f9b58360f245b6efe63b2511fa]=~/scripts/on_boot.sh
[a0d63bceeaeffb235c4adf0e5bb0f318]=~/scripts/gist_update.sh
)
for ID in "${!GISTS[@]}"; do
if ! gist -r $ID | cmp -s ${GISTS[$ID]} -; then
echo "${GISTS[$ID]} has changes; running gist -u $ID ${GISTS[$ID]}"
gist -u $ID ${GISTS[$ID]}
else
echo "${GISTS[$ID]} is up to date."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment