1
0
Fork 0
mirror of https://github.com/sbrl/bin.git synced 2018-01-10 21:33:46 +00:00

Merge branch 'master' of github.com:sbrl/bin

This commit is contained in:
Starbeamrainbowlabs 2017-07-31 20:04:42 +01:00
commit 63d2449bff
4 changed files with 67 additions and 22 deletions

View file

@ -32,3 +32,8 @@ HOST_COLOUR="${HC}${FYEL}"
# Whether we should disable hh integration or not.
# Useful if we're on a machine that doesn't have it installed.
NO_HH=false;
which hh;
if [[ "$?" -ne "0" ]; then
NO_HH=true;
fi

View file

@ -56,18 +56,30 @@ Here's a list of the most interesting ones, along with what they do and where th
- nautilus-here - A quick command that opens nautilus in the current directory. For lazy people :P
- ssh-retry - I forget where it came from, but this command reepeatedly calls ssh until it succeeds in connecting.
## `cloudjumper.sh`
`cloudjumper.sh` is a new script I'm writing to bring some of the customisations I store here in this repository to terminals on shared machines - where I can't modify `.bashrc`, for example.
## cloudsurfer.sh
`cloudsurfer.sh` is a new script I'm writing to bring some of the customisations I store here in this repository to terminals on shared machines - where I can't modify `.bashrc`, for example.
It's designed to be executed in a single bash context, and leave no trace on the host machine after the customisations are applied - just in case the bash process crashes! If need be, it can also be executed in multiple separate bash processes and will bring the customisations to each one separately - without interfering with the rest of the machine.
Due to it's transient nature, cloudjumper is bound to be more lightweight and be missing a few features of the full list that my main bin folder can provide, but the aim is to make a foreign terminal feel a bit more like home :smiley_cat:
Due to it's transient nature, cloudsurfer is bound to be more lightweight and be missing a few features of the full list that my main bin folder can provide, but the aim is to make a foreign terminal feel a bit more like home :smiley_cat:
Here's a list of things it currently supports:
- Aliases - by dynamically loading the main `.bash_aliases`
- Colouring the prompt to remind you that cloudsurfer is active
- _(Got an idea of something to include? File an issue, or open a pull request!)_
To use it, simply paste this into the target terminal:
```bash
cstemp=$(mktemp); curl -o ${cstemp} -L https://goo.gl/ZTtVRq; chmod +x ${cstemp}; source ${cstemp}; rm ${cstemp}; cstemp=;
```
and then to drop out of cloudsurfer again:
```bash
exec bash && reset
```
## Disclaimer
I don't own many of the tools in this repository. If you are an owner of one of these tools and I haven't linked to you, please let me know as I probably forgot.

View file

@ -1,18 +0,0 @@
#!/usr/bin/env bash
### Settings ###
aliases_url="https://raw.githubusercontent.com/sbrl/bin/master/.bash_aliases";
################
aliases_tmp_file=$(mktemp --suffix ".cloudjumper.sh");
curl -o "${aliases_tmp_file}" "${aliases_url}"
chmod u+x "${aliases_tmp_file}"
source "${aliases_tmp_file}"
rm "${aliases_tmp_file}"

46
cloudsurfer/cloudsurfer.sh Executable file
View file

@ -0,0 +1,46 @@
#!/usr/bin/env bash
echo -ne "Initialsing cloudsurfer: ";
### Settings ###
aliases_url="https://raw.githubusercontent.com/sbrl/bin/master/.bash_aliases";
################
echo -ne "s";
### Aliases file ###
aliases_tmp_file=$(mktemp --suffix ".cloudjumper.sh");
curl -o "${aliases_tmp_file}" "${aliases_url}" 2>/dev/null;
ec_alias_download="$?";
if [[ "${ec_alias_download}" -ne "0" ]]; then
echo "E";
echo "Error\! Got exit code ${ec_alias_download} from curl when downloading the bash_aliases file";
exit ${ec_alias_download};
fi;
chmod u+x "${aliases_tmp_file}";
source "${aliases_tmp_file}";
####################
echo -ne "+a";
### Prompt ###
# Set the prompt to a cyan / blue colour to let everyone know we've enabled cloudjumper successfully
PS1="\[\033[1m\]\[\033[34m\]${PS1}\[\033[0m\]";
##############
echo -ne "+p";
### Cleanup ###
rm "${aliases_tmp_file}" >/dev/null;
###############
echo -ne "+c";
echo " - done";