https://github.com/daddye/gist
Repo as a gist
https://github.com/daddye/gist
Last synced: 4 months ago
JSON representation
Repo as a gist
- Host: GitHub
- URL: https://github.com/daddye/gist
- Owner: DAddYE
- Created: 2013-04-20T07:22:02.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-07-27T19:59:52.000Z (almost 13 years ago)
- Last Synced: 2025-05-14T13:18:44.144Z (about 1 year ago)
- Language: Nimrod
- Size: 191 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## BUILD YOUR OWN GIST REPO
Create a repo called `gist` then clone it somewhere (in my case) `/usr/src/extras/gist`, then add in
your `.bash_profile`
```sh
gist(){
cd /usr/src/extras/gist
$EDITOR $1
read -p 'Do you want push changes? (y/n) ' reply
if [[ $reply =~ ^[Yy]$ ]]; then
git add $1 && git commit -a && git push && (
echo
echo "**************************************************************************"
echo "Link: https://raw.github.com/DAddYE/gist/master/$1"
echo "Diff: https://github.com/DAddYE/gist/commit/`git rev-list head | head -n1`"
echo "**************************************************************************")
cd - > /dev/null
fi
}
```
If you want to add bash completion of content of your workingdir add in your `.bash_profile`
```sh
__gist_complete(){
local cur len wrkdir;
local IFS=$'\n'
wrkdir="/usr/src/extras/gist/"
cur=${COMP_WORDS[COMP_CWORD]}
len=$((${#wrkdir} + 2))
COMPREPLY=( $(compgen -df $wrkdir/$cur| cut -b $len-) )
}
complete -o nospace -F __gist_complete gist
```
Now you can use `gist [tab][tab]` and will autocomplete with the content of `/usr/src/extras/gist`
(in my case).
## Shortner
You may want to shortcut your gist files, so here a function:
```sh
gitio(){
curl http://git.io -siF "url=$1" | grep Location: | sed "s/Location: //"
}
```
You can add it in your bash profile and use like:
```sh
$ gitio http://github.com/daddye/gist
```
## License
DWYW: Do whatever you want!
## Author
* Github, Twitter: @DAddYE
* Website: http://daddye.it
* Email: info[-]daddye.it