Skip to content

Commit

Permalink
Added a couple extra aliases and functions, and credits in README
Browse files Browse the repository at this point in the history
  • Loading branch information
felipenmoura committed Feb 24, 2018
1 parent 736488e commit 6d4ec21
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The perfect tool to optimize the JavaScript developer command line.
- [x] More tools, like time, battery and readOnly...
- [x] Extendable...you can customize your theme with any extra string, allowing you to use JavaScript to decide what to show
- [x] Create aditional, customizable parts for _$PS1_
- [x] Ignore duplicate commands in history
- [x] New terminal windows will have the history from brevious bash

## Installing it

Expand Down Expand Up @@ -400,6 +402,8 @@ And the results would be one of:
| desktop/desk | Equivalent to `cd ~/Desktop` |
| docs/d/documents | Equivalent to `cd ~/Documents` |
| downloads/down | Equivalent to `cd ~/Downloads` |
| emptytrash | Empty the Trash on all mounted volumes and the main HDD |
| pubkey | Copies your public key to clipboard |

### Functions

Expand All @@ -417,6 +421,7 @@ And the results would be one of:
| about | Shows info on the current serve/session/user | |
| targz | Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression | `path`: The path for the file to be compressed |
| googl/short | Shortens a URL using goo.gl service | `path`: The path for the file to be compressed`path`: The path for the file to be shrinked |
| datauri | Create a data URI from a file and copy it to the pasteboard | `path`: The file to be copied as base64 |

### Safety

Expand All @@ -441,6 +446,27 @@ Ask your questions in our issues with the title starting with "[QUESTION]".
Be sure your searched for similar issues that might also have been already closed by then.
Send suggestions opening issues with the title starting with "[SUGGESTION]".

### Influences

We noticed many well known developers share some of their aliases and customizations for terminal.
This has inspired us as well, bringing some of the best ideas to termtools.
Feel free to submit new ideas as well, by using the issues in this repository.

Some ideas for the aliases and functions were inspired by (or brought from):

- [@addyosmani](https://github.com/addyosmani) (Addy Osmani)
[https://github.com/addyosmani/dotfiles](https://github.com/addyosmani/dotfiles)
- [@alrra](https://github.com/alrra) (Cãtãlin Mariş)
[https://github.com/alrra/dotfiles](https://github.com/alrra/dotfiles)
- [@cowboy](https://github.com/cowboy) (Ben Alman)
[https://github.com/cowboy/dotfiles](https://github.com/cowboy/dotfiles)
- [@mathiasbynens](https://github.com/mathiasbynens) (Mathias Bynens)
[https://github.com/mathiasbynens/dotfiles](https://github.com/mathiasbynens/dotfiles)
- [@necolas](https://github.com/necolas) (Nicolas Gallagher)
[https://github.com/necolas/dotfiles](https://github.com/necolas/dotfiles)
- [@paulirish](https://github.com/paulirish) (Paul Irish)
[https://github.com/paulirish/dotfiles](https://github.com/paulirish/dotfiles)

### Contribute

We are welcoming new themes and all the help we might get.
Expand Down
27 changes: 27 additions & 0 deletions aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,36 @@ alias amioffline="ping www.google.com -c 1 2>/dev/null >/dev/null && echo \"No\"

alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'"
alias flush="dscacheutil -flushcache && killall -HUP mDNSResponder"
# Empty the Trash on all mounted volumes and the main HDD
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash;"
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | printf '=> Public key copied to pasteboard.\n'"
command -v md5sum > /dev/null || alias md5sum="md5"
command -v sha1sum > /dev/null || alias sha1sum="shasum"

# Ignore duplicate commands in the history
export HISTCONTROL=ignoredups
# Make new shells get the history lines from all previous
# shells instead of the default "last window closed" history
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"

# imported from @necolas's dotfiles
# Create a data URI from a file and copy it to the pasteboard
datauri() {
local mimeType=$(file -b --mime-type "$1")
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8"
fi
printf "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')" | pbcopy | printf "=> data URI copied to pasteboard.\n"
}
# Autocorrect typos in path names when using `cd`
shopt -s cdspell

# Check the window size after each command and, if necessary, update the values
# of LINES and COLUMNS.
shopt -s checkwinsize



function dog () {
cat $@ | less -FRNX
}
Expand Down

0 comments on commit 6d4ec21

Please sign in to comment.