2
0
mirror of https://github.com/alexanderepstein/Bash-Snippets synced 2018-11-08 02:59:35 +01:00
Bash-Snippets/README.md

505 lines
14 KiB
Markdown
Raw Normal View History

2017-06-27 02:18:07 +02:00
<div align="center">
2017-06-26 23:55:08 +02:00
# Bash-Snippets
2017-06-27 02:29:24 +02:00
<img src="https://cloud.githubusercontent.com/assets/2059754/24601246/753a7f36-1858-11e7-9d6b-7a0e64fb27f7.png" height="250px" width="250px">
2017-06-27 02:29:24 +02:00
2017-06-27 03:55:38 +02:00
##### A collection of small bash scripts for heavy terminal users with no dependencies
2017-06-27 02:18:07 +02:00
![Version](https://img.shields.io/github/release/alexanderepstein/Bash-Snippets.svg) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a4bf023a3d0d499abc9d2bf14b296a14)](https://www.codacy.com/app/alexanderepstein/Bash-Snippets?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=alexanderepstein/Bash-Snippets&amp;utm_campaign=Badge_Grade) [![Build Status](https://travis-ci.org/alexanderepstein/Bash-Snippets.svg?branch=master)](https://travis-ci.org/alexanderepstein/Bash-Snippets) ![platform](https://img.shields.io/badge/platform-OSX%2C%20Linux%20%26%20Windows-blue.svg) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=plastic)]()
2017-06-27 19:51:31 +02:00
2017-06-28 02:32:43 +02:00
2017-07-18 13:06:47 +02:00
### All of these scripts have been heavily tested on macOS and Linux
2017-07-04 03:55:22 +02:00
### Most of these scripts have been tested on Windows 10 and the official developer bash instance. Does not work with Cygwin or Mysys2.
2017-06-28 02:32:43 +02:00
2017-06-27 02:18:07 +02:00
</div>
2017-08-07 17:12:48 +02:00
## Tools
<details>
<summary>Cheat</summary>
2017-07-04 17:37:53 +02:00
2017-07-24 21:18:20 +02:00
The fastest way to find {command options|code pieces} you need
2017-07-04 17:37:53 +02:00
2017-07-24 21:18:20 +02:00
Supports multiple languages and many bash commands
2017-06-27 02:18:07 +02:00
2017-06-27 02:22:25 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/cheat/cheat.png?raw=true">
2017-06-27 02:22:25 +02:00
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-06-27 02:18:07 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Cloudup</summary>
2017-06-30 08:13:37 +02:00
2017-07-24 21:18:20 +02:00
A tool that facilitates backing up github repositories to bitbucket
2017-06-30 08:13:37 +02:00
2017-07-24 21:18:20 +02:00
If you have ever felt the fear of the github unicorn this could be your savior
Furthermore you can backup the repositories of any github user to your bitbucket.
Backup all github repositories of the designated user at once with the -a option.
Or run it with no flags and backup individual repositories.
2017-06-30 08:13:37 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/cloudup/cloudup.png?raw=true">
2017-06-30 08:13:37 +02:00
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-06-30 08:13:37 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Crypt</summary>
2017-06-30 08:13:37 +02:00
2017-07-24 21:18:20 +02:00
A wrapper for openssl that allows for quickly encrypting and decrypting files
2017-06-30 08:13:37 +02:00
2017-07-24 21:18:20 +02:00
```bash
crypt -e [original file] [encrypted file] # encrypts files
crypt -d [encrypted file] [output file] # decrypts files
```
#### Encryption Details
* Uses AES 256 level encryption
* Key is salted before creation
* Password is never in plain text, and OpenSSL generates key based on password
* Encrypted data is encoded in Base64, so it can be used as plain text in an email. (Not usually necessary if attached as a file)
2017-07-04 02:22:07 +02:00
2017-07-24 21:18:20 +02:00
**Tested With** .pdf, .txt, .docx, .doc, .png, .jpeg
2017-07-04 02:22:07 +02:00
2017-07-24 21:18:20 +02:00
**CAUTION** Make sure to use different filenames, otherwise your file will be overwritten!
2017-07-04 02:22:07 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/crypt/crypt.png?raw=true">
2017-07-04 02:22:07 +02:00
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-06-28 15:41:12 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Cryptocurrency</summary>
Converts Cryptocurrency based on realtime exchange rates
<div align="center">
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/cryptocurrency/cryptocurrency.png?raw=true">
</div>
If you want to bypass to guided input you can pass in 3 arguments and it will run from there
ex.```currency [baseCurrency] [exchangeToCurrency] [amountBeingExchanged]```
so a valid use case would be ```currency BTC USD 12.35```
2017-06-27 02:18:07 +02:00
2017-07-28 03:15:35 +02:00
Written by: [Jonas-Taha El Sesiy](https://github.com/elsesiy)
2017-08-07 17:12:48 +02:00
</details>
2017-07-28 03:15:35 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Currency</summary>
2017-06-27 02:18:07 +02:00
2017-07-24 21:18:20 +02:00
Converts currency based on realtime exchange rates
2017-06-27 02:22:25 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/currency/currency.png?raw=true">
2017-06-27 02:22:25 +02:00
</div>
2017-06-27 02:18:07 +02:00
2017-07-24 21:18:20 +02:00
If you want to bypass to guided input you can pass in 3 arguments and it will run from there
ex.```currency [baseCurrency] [exchangeToCurrency] [amountBeingExchanged]```
so a valid use case would be ```currency USD EUR 12.35```
2017-08-07 17:12:48 +02:00
</details>
2017-07-24 21:18:20 +02:00
2017-07-01 06:07:24 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Geo</summary>
2017-07-01 06:07:24 +02:00
2017-07-24 21:18:20 +02:00
Provides data for wan, lan, router, dns, mac, and ip geolocation
2017-07-01 06:07:24 +02:00
2017-07-24 21:18:20 +02:00
<div align="center">
2017-07-01 06:07:24 +02:00
2017-07-24 21:18:20 +02:00
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/geo/geo.png?raw=true">
2017-07-03 03:34:34 +02:00
2017-07-24 21:18:20 +02:00
</div>
2017-07-01 06:07:24 +02:00
2017-07-27 05:20:34 +02:00
Written by: [Jake Meyer](https://github.com/jakewmeyer)
2017-08-07 17:12:48 +02:00
</details>
2017-06-27 02:18:07 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Movies</summary>
2017-07-24 21:18:20 +02:00
Quick search that grabs relevant information about a movie
2017-06-27 02:18:07 +02:00
2017-06-27 02:22:25 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/movies/movies.png?raw=true">
2017-06-27 02:22:25 +02:00
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-06-27 02:18:07 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Newton</summary>
Performs numerical calculations all the way up to symbolic math parsing.
<div align="center">
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/newton/newton.png?raw=true">
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-07-04 15:35:20 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Qrify</summary>
2017-07-06 04:25:49 +02:00
2017-07-24 21:18:20 +02:00
Takes any string of text and turns it into a qr code
2017-07-06 04:25:49 +02:00
2017-07-24 21:18:20 +02:00
This is useful for sending links or saving a string of commands to your phone
2017-07-04 15:35:20 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/qrify/qrify.png?raw=true">
2017-07-04 15:35:20 +02:00
</div>
2017-07-27 05:20:34 +02:00
Written by: [Linyos Torovoltos](http://github.com/linyostorovovoltos)
2017-08-07 17:12:48 +02:00
</details>
2017-07-04 15:35:20 +02:00
2017-07-15 18:19:04 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Short</summary>
2017-07-15 18:19:04 +02:00
2017-07-24 21:18:20 +02:00
Gets the link that is being masked by a url shortner
2017-07-15 18:19:04 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/short/short.png?raw=true">
2017-07-15 18:19:04 +02:00
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-06-27 03:03:40 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Siteciphers</summary>
2017-06-27 19:55:20 +02:00
2017-07-24 21:18:20 +02:00
Check which ciphers are enabled / disabled for a given https site.
2017-06-27 19:55:20 +02:00
2017-07-24 21:18:20 +02:00
Sometimes ciphers are deemed vulnerable, so when you are changing configuration, this can be used to confirm that the cipher truly is disabled.
2017-06-27 19:55:20 +02:00
2017-07-24 21:18:20 +02:00
Some browsers (For example old versions of IE) don't support some of the newer ciphers, which would be a good example of when a SysAdmin would need a list of currently supported ciphers so that changes can be made.
2017-06-27 19:55:20 +02:00
2017-06-27 03:03:40 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/siteciphers/siteciphers.png?raw=true">
2017-06-27 03:03:40 +02:00
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-06-27 03:03:40 +02:00
2017-06-27 04:41:41 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Stocks</summary>
2017-07-24 21:18:20 +02:00
Provides information about a certain stock symbol
2017-06-27 04:41:41 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/stocks/stocks.png?raw=true">
2017-06-27 04:41:41 +02:00
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-06-27 02:18:07 +02:00
2017-07-03 03:34:34 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Taste</summary>
2017-07-03 03:34:34 +02:00
2017-07-24 21:18:20 +02:00
Recommendation engine that provides three similar items like the supplied item
2017-07-03 03:34:34 +02:00
2017-07-24 21:18:20 +02:00
Also can provide information on a given item
2017-07-03 03:34:34 +02:00
2017-07-24 21:18:20 +02:00
Valid items are: shows, books, music, artists, movies, authors, games
2017-07-05 19:12:40 +02:00
2017-07-03 03:34:34 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/taste/taste.png?raw=true">
2017-07-03 03:34:34 +02:00
</div>
2017-07-24 21:18:20 +02:00
### Needs an API Key (don't worry it's free)
2017-07-27 05:20:34 +02:00
* Get the API key [here](https://tastedive.com/account/api_access)
* After getting the API key run the following line ```export TASTE_API_KEY="yourAPIKeyGoesHere" >> ~/.bash_profile```
2017-08-07 17:12:48 +02:00
</details>
2017-07-24 21:18:20 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Todo</summary>
2017-07-16 02:59:29 +02:00
A simplistic command line todo list
<div align="center">
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/todo/todo.png?raw=true">
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-07-03 03:34:34 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Transfer</summary>
2017-08-04 14:24:24 +02:00
Quickly transfer files from the command line.
<div align="center">
<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/transfer/transfer.png?raw=true">
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-06-30 07:41:59 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Weather</summary>
2017-06-30 07:52:25 +02:00
2017-07-24 21:18:20 +02:00
Provides a 3 day forecast
2017-06-30 07:41:59 +02:00
2017-07-24 21:18:20 +02:00
With no arguments it will grab the weather for your location as determined by your ip
2017-06-30 07:52:25 +02:00
2017-06-30 07:41:59 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/weather/weather.png?raw=true">
2017-06-30 07:41:59 +02:00
</div>
2017-07-24 21:18:20 +02:00
With arguments you can pass in a city or country and get the weather in that area
2017-07-05 19:12:40 +02:00
2017-07-24 21:18:20 +02:00
Also can show the current moon phase
2017-07-05 19:12:40 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/weather/moon.png?raw=true">
2017-07-05 19:12:40 +02:00
</div>
2017-08-07 17:12:48 +02:00
</details>
2017-07-05 19:12:40 +02:00
2017-06-30 07:41:59 +02:00
2017-08-07 17:12:48 +02:00
<details>
<summary>Youtube-Viewer</summary>
2017-07-24 21:18:20 +02:00
Provides a way to watch youtube videos from the terminal.
You can use ```ytview -c [channel name]``` to see recent videos by that artist.
You can use ```ytview -s [videoToSearch]``` or just ```ytview [videoToSearch]``` to search for videos.
2017-06-30 17:18:49 +02:00
<div align="center">
2017-07-24 21:18:20 +02:00
<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/ytview/ytview.png?raw=true">
2017-06-30 17:18:49 +02:00
</div>
2017-06-30 07:41:59 +02:00
2017-07-27 05:20:34 +02:00
Written by: [Linyos Torovoltos](http://github.com/linyostorovovoltos)
2017-08-07 17:12:48 +02:00
</details>
2017-07-24 21:18:20 +02:00
2017-06-27 02:18:07 +02:00
## API's Used
2017-08-07 20:30:56 +02:00
<details>
<summary>All API's</summary>
* To get location based on ip address: [ipinfo](https://ipinfo.io)
* To get and print weather based on a location: [wttr](http://wttr.in)
* To grab the stock information in JSON format: [alphavantage](https://www.alphavantage.co)
* To grab the latest exchange rate between currencies: [fixer](http://fixer.io)
* To grab information on movies: [omdbapi](http://www.omdbapi.com/)
* To grab recommendations based on an item: [tastedive](https://tastedive.com)
* To determine masked link behind url shortner: [x.datasig](http://x.datasig.io)
* To grab cheatsheets for commands and languages: [cheat](http://cheat.sh/)
* To encode text into a qr code: [qrenco](http://qrenco.de)
* To grab a list of a users repositories: [github](https://developer.github.com/v3/)
* To upload a repository to bitbucket: [bitbucket](https://developer.atlassian.com/bitbucket/api/2/reference/)
2017-07-27 05:20:34 +02:00
* To get your WAN ip address: [ipify](https://www.ipify.org/)
2017-07-28 03:15:35 +02:00
* To grab the latest exchange rate between cryptocurrencies to standard currencies: [coinmarketcap](https://coinmarketcap.com/api/)
* To perform symbolic math and other computations: [newton](https://newton.now.sh)
2017-08-07 17:12:48 +02:00
* To transfer files: [transfer](https://transfer.sh)
2017-07-27 05:20:34 +02:00
2017-08-07 20:30:56 +02:00
</details>
2017-06-27 02:18:07 +02:00
2017-06-27 03:20:38 +02:00
## Installing
2017-08-07 20:30:56 +02:00
<details>
<summary>For macOS via homebrew / Linux via linuxbrew</summary>
```bash
2017-07-30 21:26:08 +02:00
brew install bash-snippets # installs all tools
brew install bash-snippets --without-all-tools --with-newton --with-weather # specifying install for individual tools
```
2017-08-07 20:30:56 +02:00
</details>
<details>
<summary>Arch Linux (AUR)</summary>
2017-07-29 12:16:02 +02:00
There is an AUR package for bash-snippets located [here](https://aur.archlinux.org/packages/bash-snippets/)
2017-07-15 19:29:49 +02:00
2017-08-07 20:30:56 +02:00
</details>
<details>
<summary>Sparrowhub</summary>
```bash
sparrow plg install [tool]
```
2017-08-07 20:30:56 +02:00
</details>
<details>
<summary>Git Install</summary>
2017-06-27 03:20:38 +02:00
* First clone the repository:
```bash
git clone https://github.com/alexanderepstein/Bash-Snippets
```
2017-06-27 03:20:38 +02:00
* Then cd into the cloned directory:
```bash
cd Bash-Snippets
```
* Git checkout to the latest stable release
```bash
2017-08-04 14:26:44 +02:00
git checkout v1.18.0
```
2017-06-28 04:48:23 +02:00
* Run the guided install script with
2017-06-27 03:20:38 +02:00
```bash
./install.sh
```
this will let you choose which scripts to install
2017-06-27 03:20:38 +02:00
* Install all the scripts
```bash
./install.sh all
```
* Install an individual script
```bash
./install.sh stocks
```
2017-06-28 04:48:23 +02:00
2017-08-07 20:30:56 +02:00
</details>
2017-06-28 04:48:23 +02:00
## Updating
2017-08-07 20:30:56 +02:00
<details>
<summary>For macOS if installed via homebrew / Linux if installed via linuxbrew</summary>
```bash
brew upgrade bash-snippets
```
2017-08-07 20:30:56 +02:00
</details>
<details>
<summary>Git Update</summary>
2017-06-28 04:48:23 +02:00
With any of the installed tools you can automate the update by running it with the -u option or passing in update as the arguments
Ex.
```bash
stocks update
```
or
```bash
stocks -u
```
This will clone the repository and install the new versions of scripts that were installed, if you didn't install a certain tool this script will not install the new version of that tool.
2017-08-07 20:30:56 +02:00
</details>
2017-06-27 03:20:38 +02:00
## Uninstalling
2017-08-07 20:30:56 +02:00
<details>
<summary>For macOS if installed via homebrew / Linux if installed via linuxbrew</summary>
```bash
brew uninstall bash-snippets
```
2017-08-07 20:30:56 +02:00
</details>
<details>
<summary>Git Uninstall</summary>
* If you don't have the Bash-Snippets folder anymore clone the repository:
```bash
git clone https://github.com/alexanderepstein/Bash-Snippets
```
2017-06-27 03:20:38 +02:00
* cd into the Bash-Snippets directory:
```bash
cd Bash-Snippets
```
2017-06-27 03:20:38 +02:00
2017-08-07 17:12:48 +02:00
2017-07-06 02:19:12 +02:00
#### To go through a guided uninstall
2017-06-27 03:20:38 +02:00
```bash
./uninstall.sh
```
#### To uninstall all installed bash-snippets
```bash
./uninstall.sh all
```
2017-08-07 20:30:56 +02:00
</details>
2017-06-27 02:18:07 +02:00
## Donate
If this project helped you in any way and you feel like buying a broke college kid a cup of coffee
[![Donate](https://img.shields.io/badge/Donate-Venmo-blue.svg)](https://venmo.com/AlexanderEpstein)
[![Donate](https://img.shields.io/badge/Donate-SquareCash-green.svg)](https://cash.me/$AlexEpstein)
2017-08-07 20:30:56 +02:00
#### Inspired by: [Ruby-Scripts](https://github.com/jakewmeyer/Ruby-Scripts)
2017-07-04 17:39:19 +02:00
2017-06-27 02:18:07 +02:00
## License
MIT License
Copyright (c) 2017 Alex Epstein
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.