master 581a6b4ea681 cached
66 files
376.9 KB
114.0k tokens
1 requests
Download .txt
Showing preview only (396K chars total). Download the full file or copy to clipboard to get everything.
Repository: alexanderepstein/Bash-Snippets
Branch: master
Commit: 581a6b4ea681
Files: 66
Total size: 376.9 KB

Directory structure:
gitextract_7784tk_y/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── stale.yml
│   └── workflows/
│       └── shellcheck.yml
├── .gitignore
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── bak2dvd/
│   └── bak2dvd
├── bash-snippets/
│   └── bash-snippets
├── bash-snippets.1
├── bash-snippets.1.html
├── bash-snippets.1.ronn
├── changelog.md
├── cheat/
│   └── cheat
├── cloudup/
│   └── cloudup
├── crypt/
│   └── crypt
├── cryptocurrency/
│   └── cryptocurrency
├── currency/
│   └── currency
├── extras/
│   ├── Linux/
│   │   └── maps/
│   │       └── maps
│   └── README.md
├── geo/
│   └── geo
├── gist/
│   ├── README.md
│   └── gist
├── install.sh
├── lyrics/
│   └── lyrics
├── meme/
│   └── meme
├── movies/
│   ├── movies
│   └── tmdb
├── newton/
│   └── newton
├── pwned/
│   └── pwned
├── qrify/
│   └── qrify
├── short/
│   └── short
├── siteciphers/
│   └── siteciphers
├── skeleton
├── skeleton.bats
├── stocks/
│   └── stocks
├── taste/
│   └── taste
├── tests/
│   ├── bak2dvd.bats
│   ├── cheat.bats
│   ├── cloudup.bats
│   ├── crypt.bats
│   ├── cryptocurrency.bats
│   ├── currency.bats
│   ├── geo.bats
│   ├── gist.bats
│   ├── meme.bats
│   ├── movies.bats
│   ├── newton.bats
│   ├── qrify.bats
│   ├── short.bats
│   ├── siteciphers.bats
│   ├── stocks.bats
│   ├── taste.bats
│   ├── todo.bats
│   ├── transfer.bats
│   ├── weather.bats
│   └── ytview.bats
├── todo/
│   └── todo
├── transfer/
│   └── transfer
├── uninstall.sh
├── weather/
│   └── weather
└── ytview/
    └── ytview

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: [alexanderepstein]


================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
**Issue Label:**
* [ ] Bug
* [ ] New feature
* [ ] Enhancement
* [ ] New component

**Description:**



### If its a bug make sure to include this section.
**OS and OS version:**
* [ ] Mac
* [ ] Linux 32 Bit
* [ ] Linux 64 Bit
* [ ] Windows 32 Bit
* [ ] Windows 64 Bit

OS Version:


================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
**Pull Request Label:**
* [ ] Bug
* [ ] New feature
* [ ] Enhancement
* [ ] New component
* [ ] Typo

**Pull Request Checklist:**
- [ ] Have you followed the [guidelines for contributing](https://github.com/alexanderepstein/Bash-Snippets/blob/master/CONTRIBUTING.md)?
- [ ] Have you checked that there aren't other open [pull requests](https://github.com/alexanderepstein/Bash-Snippets/pulls) for the same fix or component?
- [ ] Have you ran the tests locally with `bats tests`?

-----


================================================
FILE: .github/stale.yml
================================================
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 175
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 5
# Issues with these labels will never be considered stale
exemptLabels:
  - New Component
# Label to use when marking an issue as stale
staleLabel: Stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
  This issue has been automatically marked as stale because it has not had
  recent activity. It will be closed if no further activity occurs. Thank you
  for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
  This issue has been automatically closed because it has been 
  inactive for 180 days.


================================================
FILE: .github/workflows/shellcheck.yml
================================================
on: push
jobs:
  shellcheck:
    name: Shellcheck
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Run ShellCheck
        uses: ludeeus/action-shellcheck@master


================================================
FILE: .gitignore
================================================
# IDE
.idea

# Meta files
.DS_Store
Thumbs.db

================================================
FILE: .travis.yml
================================================
language: bash

matrix:
  include:
    - os: linux
      dist: trusty
      sudo: required
    - os: osx
  allow_failures:
    - os: linux

before_install:
  - sudo ./install.sh all
  - export TASTE_API_KEY='290044-Taste-QIQUQKOZ'

install:
  - if [ $TRAVIS_OS_NAME = linux ]; then sudo add-apt-repository ppa:duggan/bats --yes; fi
  - if [ $TRAVIS_OS_NAME = linux ]; then sudo apt-get update; fi
  - if [ $TRAVIS_OS_NAME = linux ]; then sudo apt-get install -qq bats; else brew install bats; fi
  - if [ $TRAVIS_OS_NAME = linux ]; then sudo apt-get install -qq openssl; else brew install openssl; fi

script:
  - bats tests


================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at epsteina@wit.edu. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing

### First off, thank you for considering contributing to Bash-Snippets.

#### Where do I go from here?

If you've noticed a bug or have a question, search the <a href="https://github.com/alexanderepstein/Bash-Snippets/issues">issue tracker</a> to see if someone else in the community has already created a ticket. If not, go ahead and <a href="https://github.com/alexanderepstein/Bash-Snippets/issues/new">make one</a>!

#### Otherwise if implementing a fix, feature or new component go through these steps
#### 1. Fork & Clone The Repository
* Fork the repository
* It is assumed you are on either a Unix or Linux system in which are there are no dependencies
* To download the full source code after forking
```bash
git clone https://github.com/yourusernamehere/Bash-Snippets
```   


#### 2. Implement your fix, feature or new component

###### Fix/Feature
At this point, you're ready to make your changes!

###### New Component
* Decide on a short but sweet name for your tool
* Create a folder in the Bash-Snippets root directory named after the tool
* Copy over the Bash-Snippets tool [skeleton](https://github.com/alexanderepstein/Bash-Snippets/blob/master/skeleton) to the newly created folder
* Rename the skeleton in the new directory to the name of the tool
* Using newly copied over file as a basis (with the name of your tool) code your new component!

Feel free to ask for help; everyone is a beginner at first :smile_cat:
Make sure to make your commit messages informative and concise.


#### 3. Check The Script Runtime

If you changed the weather script for example try running it and see if it works as intended. Run ```bats tests``` when inside the Bash-Snippets directory to test the tools.
If you added a new script/tool test it to see if it works.

#### 4. Create A Pull Request

First make sure to commit and push your changes to your forked repository.
Check to see if there are any conflicts with the main repository and your fork.
If there are none submit the request and give details as to what you changed or added.

#### 5. Bask In All The Glory Of Adding To A FOSS Application
![Had to do it to em](https://68.media.tumblr.com/2dfc3369827df9b981e111d7fd8fc732/tumblr_mvemcyarmn1rslphyo1_400.gif)


================================================
FILE: 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.


================================================
FILE: README.md
================================================
<div align="center">

# Bash-Snippets

<img src="https://cloud.githubusercontent.com/assets/2059754/24601246/753a7f36-1858-11e7-9d6b-7a0e64fb27f7.png" height="250px" width="250px">

##### A collection of small bash scripts for heavy terminal users with no dependencies

![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)]()



### All of these scripts have been heavily tested on macOS and Linux
### Most of these scripts have been tested on Windows 10 and the official developer bash instance. Does not work with Cygwin or Mysys2.

#### Looking for maintainers: I have been and probably will forever be too busy to maintain this properly on my own. I am looking for a few others to help out, if you want to be a maintainer either email me or raise an issue. I will probably only accept maintainers who have made a few contributions (no matter how small) and seem to understand the vision of this project.

</div>

## Tools

<details>
<summary>Cheat</summary>

The fastest way to find {command options|code pieces} you need

Supports multiple languages and many bash commands

<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/cheat/cheat.png?raw=true">

</div>
</details>

<details>
<summary>Cloudup</summary>

A tool that facilitates backing up github repositories to bitbucket

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.

<div align="center">

<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/cloudup/cloudup.png?raw=true">

</div>
</details>


<details>
<summary>Crypt</summary>

A wrapper for openssl that allows for quickly encrypting and decrypting files

```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)

**Tested With**  .pdf, .txt, .docx, .doc, .png, .jpeg

**CAUTION**  Make sure to use different filenames, otherwise your file will be overwritten!


<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/crypt/crypt.png?raw=true">

</div>
</details>


<details>
<summary>Cryptocurrency</summary>

Converts Cryptocurrency based on realtime exchange rates of the top 10 cryptos

<div align="center">

<img max-height="500px" max-width="505px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/cryptocurrency/cryptocurrency.png?raw=true">

</div>

Originally written by: [Jonas-Taha El Sesiy](https://github.com/elsesiy)
Heavy modifications by: [Alex Epstein](https://github.com/alexanderepstein)
</details>


<details>
<summary>Currency</summary>

Converts currency based on realtime exchange rates

<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/currency/currency.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 USD EUR 12.35```
</details>


<details>
<summary>Geo</summary>

Provides data for  wan, lan, router, dns, mac, and ip geolocation


<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/geo/geo.png?raw=true">

</div>

Written by: [Jake Meyer](https://github.com/jakewmeyer)
</details>

<details>
<summary>Gist</summary>

Manage your gist like a pro

Clone your owned gists and starred gists as git repos, and Fetch/Create/Edit/Delete them with Github API. It also supports quick search with hashtag and contents.

For more information, please go through the [guide](gist/README.md)

<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/gist/gist.png?raw=true">

</div>

Written by: [typebrook](https://github.com/typebrook)
</details>

<details>
<summary>Lyrics</summary>

Grab lyrics for a given song quickly from the command line.


<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/lyrics/lyrics.png?raw=true">

</div>

</details>

<details>
<summary>Meme</summary>

A lightning fast meme generator.


<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/meme/meme.png?raw=true">

</div>

</details>

<details>
<summary>Movies</summary>

Quick search that grabs relevant information about a movie

<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/movies/movies.png?raw=true">

</div>
</details>


<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>
</details>


<details>
<summary>Qrify</summary>

Takes any string of text and turns it into a qr code

This is useful for sending links or saving a string of commands to your phone


<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/qrify/qrify.png?raw=true">

</div>

Written by: [Linyos Torovoltos](http://github.com/linyostorovovoltos)
</details>


<details>
<summary>Short</summary>

Gets the link that is being masked by a url shortner

<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/short/short.png?raw=true">

</div>
</details>

<details>
<summary>Siteciphers</summary>

Check which ciphers are enabled / disabled for a given https site.

Sometimes ciphers are deemed vulnerable, so when you are changing configuration, this can be used to confirm that the cipher truly is disabled.

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.

<div align="center">

<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/siteciphers/siteciphers.png?raw=true">

</div>
</details>


<details>
<summary>Stocks</summary>

Provides information about a certain stock symbol


<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/stocks/stocks.png?raw=true">

</div>
</details>


<details>
<summary>Taste</summary>

Recommendation engine that provides three similar items like the supplied item

Also can provide information on a given item

Valid items are: shows, books, music, artists, movies, authors, games

<div align="center">

<img max-height="500px" max-width="500px" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/taste/taste.png?raw=true">

</div>

### Needs an API Key (don't worry it's free)
* 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```
</details>


<details>
<summary>Todo</summary>

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>
</details>


<details>
<summary>Transfer</summary>

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>
</details>


<details>
<summary>Weather</summary>

Provides a 3 day forecast

With no arguments it will grab the weather for your location as determined by your ip

<div align="center">

<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/weather/weather.png?raw=true">

</div>

With arguments you can pass in a city or country and get the weather in that area


Also can show the current moon phase

<div align="center">

<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/weather/moon.png?raw=true">

</div>
</details>


<details>
<summary>Youtube-Viewer</summary>

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.


<div align="center">

<img height="75%" width="75%" src="https://github.com/alexanderepstein/Bash-Snippets/blob/master/ytview/ytview.png?raw=true">

</div>

Written by: [Linyos Torovoltos](http://github.com/linyostorovovoltos)
</details>

## API's Used

<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: [ki.tc](http://ki.tc)
* 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/)
* To get your WAN ip address: [ipify](https://www.ipify.org/)
* 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)
* To transfer files: [transfer](https://transfer.sh)
* To grab lyrics from a song: [lyrics.ovh](http://docs.lyricsovh.apiary.io)
* To generate memes: [MemeGen](https://memegen.link)
* To get a chart of the top 10 cryptocurrencies [rate.sx](http://rate.sx)

</details>


## Installing

[![Packaging status](https://repology.org/badge/vertical-allrepos/bash-snippets.svg)](https://repology.org/project/bash-snippets/versions)

<details>
  <summary>AUR</summary>
  
bash-snippets is available in two different AUR packages: `bash-snippets` and `bash-snippets-git`.

```bash
yay -S bash-snippets # or bash-snippets-git
```

</details>

<details>
  
<summary>APT Package Manager</summary>

```bash
sudo add-apt-repository ppa:navanchauhan/bash-snippets # add bash-snippets PPA
sudo apt update # update package list
sudo apt install bash-snippets # install bash-snippets package
```

</details>

<details>
  
  <summary>homebrew (macOS) / linuxbrew (Linux)</summary>

```bash
brew install bash-snippets # installs all tools
brew install bash-snippets --without-all-tools --with-newton --with-weather # specifying install for individual tools
```

</details>

<details>
  
  <summary>From Source</summary>

```bash
git clone https://github.com/alexanderepstein/Bash-Snippets # clone the repository
cd Bash-Snippets # cd into the cloned directory
git checkout v1.23.0 # Git checkout to the latest stable release
```
```bash
./install.sh all # install all scripts
```

or

```bash
./install.sh stocks # to install individual scripts
```
</details>

## Updating

<details>

<summary>AUR</summary>

```bash
yay -S bash-snippets # or bash-snippets-git
```
</details>


<details>
  
<summary>APT Package Manager</summary>

```bash
sudo apt update # update package list
sudo apt upgrade bash-snippets # upgrade bash-snippets package
```

</details>

<details>
  
<summary>homebrew (macOS) / linuxbrew (Linux)</summary>

```bash
brew install bash-snippets --without-all-tools --with-newton --with-weather # specifying install for individual tools
```

</details>

<details>
  
  <summary>From Source</summary>

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.

`stocks update`

or

`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.

</details>

## Uninstalling

<details>
  
  <summary>AUR</summary>

```bash
pacman -Rns bash-snippets # or bash-snippets-git
```

</details>

<details>
  
  <summary>APT Package Manager</summary>

```bash
sudo apt purge bash-snippets # you can also use remove instead of purge
```

</details>

<details>
  
  <summary>homebrew (macOS) / linuxbrew (Linux)</summary>

```bash
brew uninstall bash-snippets
```

</details>

<details>
  
  <summary>Git Uninstall</summary>
  
```bash
git clone https://github.com/alexanderepstein/Bash-Snippets # If you don't have the Bash-Snippets folder anymore clone the repository
cd Bash-Snippets # cd into the Bash-Snippets directory:
```

</details>

<details>
  
<summary>To go through a guided uninstall</summary>
```bash
./uninstall.sh
```

##### To uninstall all installed bash-snippets
```bash
./uninstall.sh all
```

##### To go through a guided uninstall
```bash
./uninstall.sh
```

##### To uninstall all installed bash-snippets
```bash
./uninstall.sh all
```

</details>


## Donate
If this project helped you in any way and you feel like supporting me

[![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)

###### BTC: 38Q5VbH63MtouxHu8BuPNLzfY5B5RNVMDn
###### ETH: 0xf7c60C06D298FF954917eA45206426f79d40Ac9D
###### LTC: LWZ3T19YUk66dgkczN7dRhiXDMqSYrXUV4

#### Inspired by: [Ruby-Scripts](https://github.com/jakewmeyer/Ruby-Scripts)

## 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.


================================================
FILE: bak2dvd/bak2dvd
================================================
#!/usr/bin/env bash
# Author: Charles Oblender https://github.com/oblende
currentVersion="1.23.0"
configuredClient=""

tarwrite() {
	tl=$1
	pn=$2
	tops=$3
	# FreeBSD needs to use gtar
	# Make this a function for the addition of a restore option
    	# These if statements test for all possible combinations of null strings and executes the permutation
    	# of tar or gtar that excludes the null string.
		if command -v gtar &>/dev/null
		then
            if [[ -z "$tops" && -n "$dir" && -n "$excludes" ]]
            then
                gtar -cvpML "$tl" -f "$pn" "${dir[@]}" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
            elif [[ -n "$tops" && -z "$dir" && -n "$excludes" ]]
            then
                gtar -cvpML "$tl" -f "$pn" "$tops" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
	    elif [[ -n "$tops" && -n "$dir" && -z "$excludes" ]]
	    then
                gtar -cvpML "$tl" -f "$pn" "$tops" "${dir[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
	    elif [[ -n "$tops" && -z "$dir" && -n "$excludes" ]]
	    then
                gtar -cvpML "$tl" -f "$pn" "$tops" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
	    elif [[ -n "$tops" && -z "$dir" && -z "$excludes" ]]
	    then
                gtar -cvpML "$tl" -f "$pn" "$tops" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
	    elif [[ -z "$tops" && -z "$dir" && -n "$excludes" ]]
	    then
                gtar -cvpML "$tl" -f "$pn" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
	    elif [[ -z "$tops" && -z "$dir" && -z "$excludes" ]]
	    then
                gtar -cvpML "$tl" -f "$pn" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
	    else
                gtar -cvpML "$tl" -f "$pn" "$tops" "${dir[@]}" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
	    fi
    fi

	if command -v tar &>/dev/null
        then
            if [[ -z "$tops" && -n "$dir" && -n "$excludes" ]]
            then
                tar -cvpML "$tl" -f "$pn" "${dir[@]}" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
            elif [[ -n "$tops" && -z "$dir" && -n "$excludes" ]]
            then
                tar -cvpML "$tl" -f "$pn" "$tops" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
	    elif [[ -n "$tops" && -n "$dir" && -z "$excludes" ]]
	    then
                tar -cvpML "$tl" -f "$pn" "$tops" "${dir[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
	    elif [[ -n "$tops" && -z "$dir" && -n "$excludes" ]]
	    then
                tar -cvpML "$tl" -f "$pn" "$tops" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
	    elif [[ -n "$tops" && -z "$dir" && -z "$excludes" ]]
	    then
                tar -cvpML "$tl" -f "$pn" "$tops" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
	    elif [[ -z "$tops" && -z "$dir" && -n "$excludes" ]]
	    then
                tar -cvpML "$tl" -f "$pn" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
	    elif [[ -z "$tops" && -z "$dir" && -z "$excludes" ]]
	    then
                tar -cvpML "$tl" -f "$pn" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
	   else
                tar -cvpML "$tl" -f "$pn" "$tops" "${dir[@]}" "${excludes[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
        fi
    fi


}

tarread() {
	pn=$1
	tops=$2
    # These if statements test for null strings and then excutes the permutation of tar or gtar
    # that excludes the null strings.
	if command -v gtar &>/dev/null
	then
            if [[ -n "$tops" && -n "$dir" && -z "$filenames" ]]
            then
                gtar -xvpMf "$pn" "$tops" "${dir[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
            elif [[ -n "$tops" && -z "$dir" && -n "$filenames" ]]
            then
                gtar -xvpMf "$pn" "$tops" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
			elif [[ -n "$tops" && -z "$dir" && -z "$filenames" ]]
            then
                gtar -xvpMf "$pn" "$tops" <&7 &
                tarpid=$!
                countlimit=2
                return
			elif [[ -z "$tops" && -n "$dir" && -n "$filenames" ]]
            then
                gtar -xvpMf "$pn" "${dir[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
			elif [[ -z "$tops" && -n "$dir" && -z "$filenames" ]]
            then
                gtar -xvpMf "$pn" "${dir[@]}" <&7 &
                tarpid=$!
                countlimit=2
                return
			elif [[ -z "$tops" && -z "$dir" && -n "$filenames" ]]
            then
                gtar -xvpMf "$pn" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
			return
			elif [[ -z "$tops" && -z "$dir" && -z "$filenames" ]]
            then
                gtar -xvpMf "$pn" <&7 &
                tarpid=$!
                countlimit=2
                return
			else
                gtar -xvpMf "$pn" "$tops" "${dir[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=2
			return
		fi
    fi

		if command -v tar &>/dev/null
		then
		if [[ -n "$tops" && -n "$dir" && -z "$filenames" ]]
            then
                tar -xvpMf "$pn" "$tops" "${dir[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
            elif [[ -n "$tops" && -z "$dir" && -n "$filenames" ]]
            then
                tar -xvpMf "$pn" "$tops" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
			elif [[ -n "$tops" && -z "$dir" && -z "$filenames" ]]
            then
                tar -xvpMf "$pn" "$tops" <&7 &
                tarpid=$!
                countlimit=1
                return
			elif [[ -z "$tops" && -n "$dir" && -n "$filenames" ]]
            then
                tar -xvpMf "$pn" "${dir[@]}" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
			elif [[ -z "$tops" && -n "$dir" && -z "$filenames" ]]
            then
                tar -xvpMf "$pn" "${dir[@]}" <&7 &
                tarpid=$!
                countlimit=1
                return
			elif [[ -z "$tops" && -z "$dir" && -n "$filenames" ]]
            then
                tar -xvpMf "$pn" "${filenames[@]}" <&7 &
                tarpid=$!
                countlimit=1
			return
			elif [[ -z "$tops" && -z "$dir" && -z "$filenames" ]]
            then
                tar -xvpMf "$pn" <&7 &
                tarpid=$!
                countlimit=1
                return
	    else
		 tar -xvpMf "$pn" "$tops" "${dir[@]}" "{$filenames[@]}" <&7 &
             	tarpid=$!
             	countlimit=1
	    fi
    fi
}

discread() {
	dev=$1
	pn=$2
	tpid=$3
	counter=$4
	countlim=$5
	rl=$6
    # FreeBSD is a brain damaged OS written by brain damaged developers who, when given a choice, will run headlong into
    # making a task or operation as difficult as possible.
    if [[ $(uname | grep "FreeBSD" | wc -l) -gt 0 ]]
    then
        while [ "$counter" -eq "$countlim" ]
        do
            dd if="$dev" of="$pn" bs=2048
            eject "$dev"
            counter=0
            counter=$(ps -A | grep $tarpid | wc -l)
            if [[ $counter -eq $countlim ]]
            then
                echo
                read -p "Insert next disc and press Enter:" response
                echo "$response" >&7
            fi
        done
    else
        while [ "$counter" -eq "$countlim" ]
        do
            dd if="$dev" of="$pn" bs=1k count="$rl"
            eject "$dev"
            counter=0
            counter=$(ps -A | grep $tarpid | wc -l)
            if [[ $counter -eq $countlim ]]
            then
                read -p "Insert next disc and press Enter:" response
                echo "$response" >&7
            fi
        done
    fi
}

dvdburn() {
	counter=$4
	countlim=$5
	altburn=$6
	while [ "$counter" -eq "$countlim" ]
	do
		if [[ $(echo "$1" | grep "dev" | wc -l) -eq 0 ]]
		then
			echo "DVD or BluRay burning requires device from /dev."
			exitcode=1
			cleanup $exitcode
		fi
		# Growisofs is untrustworthy for DL media, and is slow for BD-RE/DVD-RAM media because of defect management.
			case "$altburn" in
				cdrskin)
                    			# cdrskin doesn't like -multi when burning BD-R media.
					# BD-RE media needs to be formatted before recording
					cdrskin dev="$1" blank=as_needed stream_recording=on driveropts=burnfree -tao -eject -data "$2"
					;;
				xorrecord)
					xorrecord dev="$1" blank=as_needed stream_recording=on driveropts=burnfree -tao -multi -eject -data "$2"
					;;
				*)
					growisofs -Z "$1"="$2"
			esac
        	counter=0
        	counter=$(ps -A | grep "$3" | wc -l)
        	if [[ $counter -eq $countlim ]]
        	then
                	read -p "Insert next disc and press Enter:" response
                	echo "$response" >&7
        	fi
	done
# dvd-r restore needs tracklen + 4. Need to check +r single and dual layer as well as bd medias. Joy.
# DVD+R needs no compensation.
}

cdburn() {
	counter=$4
	countlim=$5
	cdb=$6
	while [ "$counter" -eq "$countlim" ]
	do
		if [[ $(uname | grep "FreeBSD" | wc -l) -gt 0 ]]
		then
			if [[ $(echo "$1" | grep "dev" | wc -l) -gt 0 && $(echo "$cdb" | grep "cdrecord" | wc -l) -gt 0 ]]
			then
				echo "CD burning requires SCSI address in the form of b,t,l. Please use cdrecord -scanbus for a list of possible SCSI addresses."
				exitcode=1
				cleanup $exitcode
			fi
		elif [[ $(uname | grep "Linux" | wc -l) -gt 0 ]]
		then
			if [[ $(echo "$1" | grep "dev" | wc -l) -eq 0 ]]
			then
				# Chances are if it's Linux then wodim is being used and requires /dev/srX instead of SCSI address
				echo "CD burning in Linux with cdrecord or wodim requires device from /dev."
				exitcode=1
				cleanup $exitcode
			fi
		fi
		case "$cdb" in
			cdrecord)
				cdrecord dev="$1" driveropts=burnfree -tao -multi -eject -data "$2" #Turned burnfree on just in case. Restore needs tracklen + 8
				;;
			wodim)
				wodim dev="$1" driveropts=burnfree -tao -multi -eject -data "$2"
				;;
			cdrskin)
				cdrskin dev="$1" driveropts=burnfree -tao -multi -eject -data "$2"
				;;
			xorrecord)
				xorrecord dev="$1" driveropts=burnfree -tao -multi -eject -data "$2"
				;;
		esac

		counter=0
		counter=$(ps -A | grep "$3" | wc -l)
		if [[ $counter -eq $countlim ]]
		then
			read -p "Insert next disc and press Enter:" response
			echo "$response" >&7
		fi
	done
}

cleanup() {
	kill $tarpid &>/dev/null
	rm "$pipename"
	rm "$fifoname"

	exit "$1"
}

getCDburner() {

	if command -v cdrecord &>/dev/null
	then
		cdburner="cdrecord"
		return
	fi
	if command -v wodim &>/dev/null
	then
		cdburner="wodim"
		return
	fi
	if command -v cdrskin &>/dev/null
	then
		cdburner="cdrskin"
		return
	fi
	if command -v xorrecord &>/dev/null
	then
		cdburner="xorrecord"
		return
	fi

}
# This function finds an alternative burner to growisofs if DVD-DL, DVD-RAM, or BD-R(E) media is chosen to improve speed
# or to actually write a full dataset in the case of DVD-DL media.
getAltDVDburner() {

	if command -v cdrskin &>/dev/null
	then
		altdvdburner="cdrskin"
		return
	fi
	if command -v xorrecord &>/dev/null
	then
		altdvdburner="xorrecord"
		return
	else
        echo "To burn DVD-DL or BD media xorriso or cdrskin needs to be installed."
        echo "I can burn using growisofs, but it may not burn DVD-DL media correctly or will burn BD-RE media very slowly."
        read -p "If you wish to continue using growisofs then type YES then press [Enter], else just press [Enter] to abort: " yesno
        if [[ "$yesno" -eq "YES" ]]
        then
            if command -v growisofs &>/dev/null
            then
                altdvdburner="growisofs"
            fi
        else
            exitcode=1
            cleanup $exitcode
        fi
    fi
}
## This function determines which http get tool the system has installed and returns an error if there isnt one
getConfiguredClient()
{
  if  command -v curl &>/dev/null; then
    configuredClient="curl"
  elif command -v wget &>/dev/null; then
    configuredClient="wget"
  elif command -v http &>/dev/null; then
    configuredClient="httpie"
  elif command -v fetch &>/dev/null; then
    configuredClient="fetch"
  else
    echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2
    return 1
  fi
}

## Allows to call the users configured client without if statements everywhere
httpGet()
{
  case "$configuredClient" in
    curl)  curl -A curl -s "$@" ;;
    wget)  wget -qO- "$@" ;;
    httpie) http -b GET "$@" ;;
    fetch) fetch -q "$@" ;;
  esac
}

update()
{
  # Author: Alexander Epstein https://github.com/alexanderepstein
  # Update utility version 1.2.0
  # To test the tool enter in the defualt values that are in the examples for each variable
  repositoryName="Bash-Snippets" #Name of repostiory to be updated ex. Sandman-Lite
  githubUserName="alexanderepstein" #username that hosts the repostiory ex. alexanderepstein
  nameOfInstallFile="install.sh" # change this if the installer file has a different name be sure to include file extension if there is one
  latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option

  if [[ $currentVersion == "" || $repositoryName == "" || $githubUserName == "" || $nameOfInstallFile == "" ]]; then
    echo "Error: update utility has not been configured correctly." >&2
    exit 1
  elif [[ $latestVersion == "" ]]; then
    echo "Error: no active internet connection" >&2
    exit 1
  else
    if [[ "$latestVersion" != "$currentVersion" ]]; then
      echo "Version $latestVersion available"
      echo -n "Do you wish to update $repositoryName [Y/n]: "
      read -r answer
      if [[ "$answer" == [Yy] ]]; then
        cd ~ || { echo 'Update Failed'; exit 1; }
        if [[ -d  ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Permissions Error: try running the update as sudo"; exit 1; } ; fi
        git clone "https://github.com/$githubUserName/$repositoryName" || { echo "Couldn't download latest version"; exit 1; }
        cd $repositoryName || { echo 'Update Failed'; exit 1; }
        git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
        chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
        ./$nameOfInstallFile "update" || exit 1
        cd ..
        rm -r -f $repositoryName || { echo "Permissions Error: update succesfull but cannot delete temp files located at ~/$repositoryName delete this directory with sudo"; exit 1; }
      else
        exit 1
      fi
    else
      echo "$repositoryName is already the latest version"
    fi
  fi
}

checkInternet()
{
  httpGet github.com > /dev/null 2>&1 || { echo "Error: no active internet connection" >&2; return 1; } # query github with a get request
}

usage()
{
  cat <<EOF
Bak2dvd
Description: A script to write tar archives to optical disc.
Usage: bak2dvd [flags] -t "[arguments]"
  -u  Update Bash-Snippet Tools
  -h  Show the help
  -v  Get the tool version
  -d  Sets the optical drive to use
  -C Change to directory
  -a Include file or directory into archive
  -t  Parameters to pass to tar
  -w Write to optical media
  -X Exclude file or directory from archive
  -r  Restore from optical media

 Disc technology flags are:

  -cd       for cd-rom
  -dvd      for single layer DVD+R
  -dvd-dl   for dual layer DVD+R
  -dvd-r    for single layer DVD-R
  -dvd-ram  for those who have it
  -bd       for single layer BluRay
  -bd-dl    for dual layer BluRay

 Preset tar parameters are -cvpML and -f

Example:

To Write:
   bak2dvd -w -d /dev/optical -dvd -C $HOME -a Documents -a "Library Files"
   bak2dvd -w -d 1,0,0 -cd -C $HOME -a Documents -a "Library Files"

To Restore:
   bak2dvd -r -d /dev/optical -dvd -C $HOME
EOF
}


options=0
declare -i tracklen
declare -i comp
declare -i rw
declare -a dir
declare -a filenames
dir=""
filenames=""
cdburner=""
altdvdburner=""
device=""
taropts=""

while test $# -gt 0; do
  case "$1" in
    \?) echo "Invalid option: -$1" >&2
        exit 1
        ;;
   -h|--help)  usage
        exit 0
        ;;
    -v)  echo "Version $currentVersion"
        exit 0
        ;;
    -u|update)
	getConfiguredClient || exit 1
        checkInternet || exit 1
        update
        exit 0
        ;;
    -d)
	shift
	if test $# -gt 0; then
		device=$1
	else
		echo "No optical device specified" >&2
		exit 1
	fi
	shift
	options=1
	;;
     -dvd)
		tracklen=4580000 # DVD+R capacity - 10M
		comp=0
		shift
		options=1
		;;
    -dvd-ram)
        # DVD-RAM for those who have this under appreciated, and under utilized media format
        tracklen=4463168 # DVD-RAM capacity - 10M
        comp=2
        shift
        getAltDVDburner # Media has same defect management as BD-RE. In fact you might call it the orginal.
        options=1
        ;;
     -dvd-dl)
		tracklen=8337408 # DVD+R DL capacity - 10M
		comp=2
		shift
		getAltDVDburner
		options=1
		;;
     -dvd-r)
		tracklen=4585536 #DVD-R single layer capacity -10M
		comp=4
		shift
		options=1
		;;
     -bd)
		tracklen=24166400 # This should be 10M less than total. Had miscalculated, now correct.
		comp=0
		shift
		getAltDVDburner # While growisofs canb be trusted, it'll be slow with *any* bd-re media because of defect management.
		options=1
		;;
     -bd-dl)
		tracklen=47294464 #same as above but dual layer
		comp=6
		shift
		getAltDVDburner
		options=1
		;;
     -cd)
		tracklen=712702 #700M cd-rom capacity - 4k, 10M is not an insigficant amount at this storage capacity!
		comp=8
		shift
		getCDburner
		options=1
		;;
    -a)
        shift
        if test $# -gt 0; then
            filenames=( "${filenames[@]}" "$1" )
        else
            echo "No filename or directory specified" >&2
            exit 1
        fi
        shift
        ;;
    -C)
            shift
            if test $# -gt 0; then
            dir=( "-C" )
            dir=( "${dir[@]}" "$1" )
        else
            echo "No directory specified." >&2
            exit 1
        fi
        shift
        ;;
     -t)
		shift
		if test $# -gt 0; then
			taropts=$1
		else
			echo "No options to tar specified." >&2
			exit 1
		fi
		shift
		options=1
		;;
     -r)
		rw=2
		shift
		;;
     -w)
		rw=1
		shift
		;;
    -X)
        shift
        if test $# -gt 0; then
            excludes=( "${excludes[@]}" "--exclude=" )
            excludes=( "${excludes[@]}""$1" )
        else
            echo "No excluded file or directory specified."
            exit 1
        fi
        shift
        ;;
    :)  echo "Option -$1 requires an argument." >&2
        exit 1
        ;;
    *)
        echo "Something bad happened or malformed arguments."
        exit 1
        ;;
  esac
done

# special set of first arguments that have a specific behavior across tools
if [[ $# == "0" && $options == "0" ]]; then
  usage ## if calling the tool with no flags and args chances are you want to return usage
  exit 0
elif [[ $# == "1" ]]; then
  if [[ $1 == "update" ]]; then
    getConfiguredClient || exit 1
    checkInternet || exit 1
    update || exit 1
    exit 0
  elif [[ $1 == "help" ]]; then
    usage
    exit 0
  fi
fi

## The rest of the conditions and code would go here
## Make sure to use checkInternet at least once before any time httpGet will be called.
## Make sure to call getConfiguredClient at least once before ever calling checkInternet.
trap "cleanup 2" 2
pipename="/tmp/$RANDOM.pipe"
fifoname="/tmp/$RANDOM.fifo"
#changed from mknod to mkfifo to  make script more cross platform
mkfifo $pipename
mkfifo $fifoname
tarpid=""
# Asign the fifo to a file descriptor. No need for ugly cat hack, and it actually works!
exec 7<>$fifoname
declare -i readlen
countlimit=""
# If no -d option was set then the script will be able to get this far, but will be stopped 
# otherwise confusing errors will happen. May change to give the user a chance to specify a device or quit at this point.
if [[ -z "$device" ]]
then
    echo "No device specified."
    exitcode=1
    cleanup $exitcode
fi

if [[ $rw -eq 1 ]]
then
	tarwrite $tracklen $pipename "$taropts"
elif [[ $rw -eq 2 ]]
then
	readlen=$tracklen+$comp
	tarread $pipename "$taropts"
fi

count=$(ps -A | grep "$tarpid" | wc -l)
# Check that tar is alive and prompt for media
if [[ $count -eq $countlimit ]]
then
	read -p "Insert media and press Enter:"
	if [[ $rw -eq 1 ]]
	then
		#call appropriate burning function here. Want to add support for mini CD's and mini DVD's at some point.
		if [[ $tracklen -le 712702 ]]
		then
			cdburn "$device" $pipename "$tarpid" "$count" "$countlimit" "$cdburner"
		else
			dvdburn "$device" $pipename "$tarpid" "$count" "$countlimit" "$altdvdburner"
		fi
	elif [[ $rw -eq 2 ]]
	then
		discread "$device" $pipename "$tarpid" "$count" "$countlimit" $readlen
    else
        echo "You need to specify option -w for writing a backup or -r for restoring from backup."
        exitcode=1
        cleanup $exitcode
	fi

else
	# otherwise something has gone wrong and we need to stop
	echo
	echo "Tar has died unexpectedly." >&2
	# Call cleanup function here
	exitcode=1
	cleanup $exitcode
fi
exitcode=0
cleanup $exitcode
# This exit is a sheet anchor. It probably isn't needed, but it makes me feel better.
exit 0


================================================
FILE: bash-snippets/bash-snippets
================================================
#!/usr/bin/env bash
# Author: Navan Chauhan and Alexander Epstein
declare -a tools=(bak2dvd cheat cloudup crypt cryptocurrency currency geo lyrics meme movies newton pwned qrify short siteciphers stocks taste todo transfer weather ytview)
declare -a validTools=()
currentVersion="1.23.0"
configuredClient=""


## This function determines which http get tool the system has installed and returns an error if there isnt one
getConfiguredClient()
{
  if  command -v curl &>/dev/null; then
    configuredClient="curl"
  elif command -v wget &>/dev/null; then
    configuredClient="wget"
  elif command -v http &>/dev/null; then
    configuredClient="httpie"
  elif command -v fetch &>/dev/null; then
    configuredClient="fetch"
  else
    echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2
    return 1
  fi
}

httpGet()
{
  case "$configuredClient" in
    curl)  curl -A curl -s "$@" ;;
    wget)  wget -qO- "$@" ;;
    httpie) http -b GET "$@" ;;
    fetch) fetch -q "$@" ;;
  esac
}

grablatestversion()
{
  repositoryName="Bash-Snippets"
  githubUserName="alexanderepstein"
  latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option
}

checkInternet()
{
  httpGet github.com > /dev/null 2>&1 || { echo "Error: no active internet connection" >&2; return 1; } # query github with a get request
}

header()
{
  title="Bash Snippets"
  installver="Installed Version: $currentVersion"
  latestver="Latest Version: $latestVersion"
  printf "\t\t\t\t     %s\n" "$title"
  printf "\t\t%s\t\t%s\n" "$latestver" "$installver"
}


toolMenu()
{
  while true; do
    clear
    header
    count=1
    for command in "${validTools[@]}"; do
      if [[ $count -gt 9 ]];then c=$count
      else c="0$count"; fi
      spaces=$((40 - $(echo "$command" | wc -c)))
      echo -n -e "\t\t\t$c."
      for (( i = 0 ; i < $spaces; i++)) ;do
        printf " "
      done
      echo "$command"
      count=$(( $count + 1 ))
    done
    echo -e -n "\t\tChoose a tool or just press enter to go back: "
    read choice
    if [[ $choice == "" ]];then clear; header; break; fi
    echo -e -n "\t\tEnter any arguments you want to use with the tool: "
    read args
    clear
    if [[ $choice =~ [0-9] ]]; then ${validTools[$(($choice-1))]} "$args"
    else $choice "$args"; fi
    exit 0
  done
}

menu()
{
  while true; do
    echo -e "\t\t\t01.\t\t\t\tTools"
    echo -e "\t\t\t02.\t\t\t\tInstallation Check"
    echo -e "\t\t\t03.\t\t\t\tView man page"
    echo -e "\t\t\t04.\t\t\t\tUpdate"
    echo -e "\t\t\t05.\t\t\t\tDonate"
    echo -e "\t\t\t06.\t\t\t\tQuit"
    echo -e -n "\n\t\t\tChoose an option: "
    read choice
    if [[ $choice -gt 6 || $choice -lt 1 ]];then
      echo "Error invalid option!"
      sleep 2
      clear
      header
      continue
    fi
    clear
    header
    if   [[ $choice -eq 1 ]];then toolMenu
    elif [[ $choice -eq 2 ]];then installationcheck
    elif [[ $choice -eq 3 ]];then man bash-snippets
    elif [[ $choice -eq 4 ]];then
      ${validTools[1]} -u
      sleep 2
      clear
      header
    elif [[ $choice -eq 5 ]];then
      clear
      echo -e "\t\tThanks for thinking of donating, that's pretty cool of you"
      echo -e "\n\t\tCryptocurrency Donation Addresses"
      echo -e "\t\t\tBTC: 38Q5VbH63MtouxHu8BuPNLzfY5B5RNVMDn"
      echo -e "\t\t\tETH: 0xf7c60C06D298FF954917eA45206426f79d40Ac9D"
      echo -e "\t\t\tLTC: LWZ3T19YUk66dgkczN7dRhiXDMqSYrXUV4\n"
      echo -e "\t\tNormal Methods"
      echo -e "\t\t\tVenmo: AlexanderEpstein"
      echo -e "\t\t\tSquare Cash: AlexEpstein\n\n\n\n"
      exit 0
    elif [[ $choice -eq 6 ]]; then clear; exit 0
    fi
  done
}

installationcheck()
{
  validTools=()
  for tool in "${tools[@]}"; do
    if [ -e "/usr/local/bin/$tool" ]; then
      state="present";
      start=51;
      validTools+=($tool);
    else state="absent"; start=52; fi
      if $1; then
        echo -n -e "\t\t$tool"
        spaces=$(($start - $( echo "$tool" | wc -c)))
        for (( i = 0 ; i < $spaces; i++)) ;do
          printf " "
        done
        echo $state
      fi
  done
  if $1; then
    echo -n "Press enter to go back to the menu"
    read
    clear
    header
  fi
}

if [[ $# -eq 0 ]]; then
  clear
  checkInternet
  getConfiguredClient
  grablatestversion
  header
  installationcheck false
  echo
  menu
elif [[ $# -eq 1 ]]; then
  if [[ $1 == "-u" || $1 == "update" ]]; then
    installationcheck false
    ${validTools[1]} -u
  elif [[ $1 == "-h" || $1 == "help" ]]; then man bash-snippets
  elif [[ $1 == "-v" ]]; then echo "Version $currentVersion"
  fi

fi


================================================
FILE: bash-snippets.1
================================================
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BASH\-SNIPPETS" "1" "April 2020" "" ""
.
.SH "NAME"
\fBbash\-snippets\fR \- A collection of small bash scripts for heavy terminal users
.
.SH "Tools"
.
.SS "Cheat"
Description: Cheatsheets for quick information about multiple programming languages along with terminal commands
.
.P
Usage: cheat [flags] [command] or cheat [flags] [programming language] [subject]
.
.IP "\(bu" 4
\-s Does a search for last argument rather than looking for exact match
.
.IP "\(bu" 4
\-i Case insensitive search
.
.IP "\(bu" 4
\-b Word boundaries in search
.
.IP "\(bu" 4
\-r Recursive search
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Special Pages:
.
.IP "\(bu" 4
hello Describes building the hello world program written in the language
.
.IP "\(bu" 4
list This lists all cheatsheets related to previous arg if none it lists all cheatsheets
.
.IP "\(bu" 4
learn Shows a learn\-x\-in\-minutes language cheat sheet perfect for getting started with the language
.
.IP "\(bu" 4
1line A collection of one\-liners in this language
.
.IP "\(bu" 4
weirdness A collection of examples of weird things in this language
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
cheat rust hello
.
.IP "\(bu" 4
cheat \-r \-b \-i go
.
.IP "\(bu" 4
cheat julia Functions
.
.IP "\(bu" 4
cheat \-i go operators
.
.IP "" 0
.
.SS "Cloudup"
Description: Backs up a users github repositories to your bitbucket account\. With no flags cloudup will guide you through backing up a single repository
.
.P
Usage: cloudup [flags] or cloudup [flags] [listOfGHRepoNamesSplitBySpaces]
.
.IP "\(bu" 4
\-p Upload the repositor(y)(ies) as private to bitbucket (must have private repo ability on bitbucket)
.
.IP "\(bu" 4
\-a Backup all github repositories
.
.IP "\(bu" 4
\-s Only backup repositories that you have created (no forks) (only works in conjunction with the \-a flag)
.
.IP "\(bu" 4
\-t Backup the repository with a timestamp added to the repostiory name (will always create a new unique bitbucket repo)
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
cloudup
.
.IP "\(bu" 4
cloudup \-p \-a
.
.IP "\(bu" 4
cloudup \-p nameOfRepo1 nameOf Repo2
.
.IP "\(bu" 4
cloudup nameOfRep
.
.IP "" 0
.
.SS "Crypt"
Description: A wrapper around openssl that facilitates encrypting and decrypting files\.
.
.P
Usage: crypt [flag] [inputFile] [outputFile]
.
.IP "\(bu" 4
\-e Encrypt the inputFile and store it in the outputFil
.
.IP "\(bu" 4
\-d Decrypt the inputFile and store it in the outputFil
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
crypt \-e mySecretFile\.txt myEncryptedFile\.jpg (change filetype so default program is incorrect)
.
.IP "\(bu" 4
crypt \-d myEncryptedFile\.jpg thisIsNowDecrypted\.txt (change filetype back so now default program is correct)
.
.IP "" 0
.
.SS "CryptoCurrency"
Description: A realtime cryptocurrency converter\. With no flags it will pull down the latest stats of the top 10 cryptos
.
.P
Usage: cryptocurrency or cryptocurrency [flag] or cryptocurrency [flag] [arg]
.
.IP "\(bu" 4
\-o Utilize the old functionality of the tool
.
.IP "\(bu" 4
\-f Fiat currency for conversions
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples: cryptocurrency \-o cryptocurrency \-f eur
.
.SS "Currency"
Description: A realtime currency converter\. With no flags it will guide you through the currency exchange
.
.P
Usage: currency or currency [flag] or currency [base] [exchangeTo] [amount]
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Supported Currencies:
.
.P
| AUD | BGN | BRL | CAD | | CHF | CNY | CZK | DKK | | EUR | GBP | HKD | HRK | | HUF | IDR | ILS | INR | | JPY | KRW | MXN | MYR | | NOK | NZD | PHP | PLN | | RON | RUB | SEK | SGD | | THB | TRY | USD | ZAR |
.
.P
Examples:
.
.IP "\(bu" 4
currency EUR USD 12\.35
.
.IP "\(bu" 4
currency
.
.IP "" 0
.
.SS "Geo"
Description: Provides quick access for wan, lan, router, dns, mac, and ip geolocation data
.
.P
Usage: geo [flag]
.
.IP "\(bu" 4
\-w Returns WAN IP
.
.IP "\(bu" 4
\-l Returns LAN IP(s)
.
.IP "\(bu" 4
\-r Returns Router IP
.
.IP "\(bu" 4
\-d Returns DNS Nameserver
.
.IP "\(bu" 4
\-m Returns MAC address for interface\. Ex\. eth0
.
.IP "\(bu" 4
\-g Returns Current IP Geodata
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
geo \-g
.
.IP "\(bu" 4
geo \-wlrdgm eth0
.
.IP "" 0
.
.P
Custom Geo Output => [all] [query] [city] [region] [country] [zip] [isp]
.
.P
Example: geo \-a 8\.8\.8\.8 \-o city,zip,isp
.
.IP "\(bu" 4
\-o [options] Returns Specific Geodata
.
.IP "\(bu" 4
\-a [address] For specific ip in \-s
.
.IP "\(bu" 4
\-v Returns Version
.
.IP "\(bu" 4
\-h Returns Help Screen
.
.IP "\(bu" 4
\-u Updates Bash\-Snippets
.
.IP "" 0
.
.SS "Gist"
Description: Manage your gists with git and Github API v3
.
.P
Usage: gist [command] [args]
.
.IP "\(bu" 4
[star|all] List your gists, use \'star\' as argument for your starred gists, \'all\' or \'a\' for both your and starred gists\. Format for each line is: \fIINDEX\fR \fIURL\fR \fIFILE_NUM\fR \fICOMMENT_NUM\fR \fIDESCRIPTION\fR
.
.IP "\(bu" 4
fetch Update the local list of your gists, \'star\' as argument for your starred gists
.
.IP "\(bu" 4
\fIINDEX\fR Show the path of local gist repo and do custom actions
.
.IP "\(bu" 4
new Create a new gist with files or STDIN
.
.IP "\(bu" 4
grep Grep gists by description, filename and content with a given pattern
.
.IP "\(bu" 4
tag Modify/List tags for a gist
.
.IP "\(bu" 4
tags List all tags and pinned tags
.
.IP "\(bu" 4
pin, Pin/Unpin tags, or filter gists with pinned tags
.
.IP "\(bu" 4
lan Filter gists or list gist with coding languages
.
.IP "\(bu" 4
detail Show the detail of a gist
.
.IP "\(bu" 4
edit Edit description for a gist
.
.IP "\(bu" 4
delete Delete gists by given indices
.
.IP "\(bu" 4
push Push changes by git
.
.IP "\(bu" 4
clean Clean local repos of removed gists
.
.IP "\(bu" 4
config Do configuration
.
.IP "\(bu" 4
user Get list of gists with a given Github user
.
.IP "\(bu" 4
github Import selected gist as a new Github repo
.
.IP "\(bu" 4
help Show the helper message
.
.IP "" 0
.
.P
Example:
.
.IP "\(bu" 4
gist (Show your gists)
.
.IP "\(bu" 4
gist tag (Show your gists with tags)
.
.IP "\(bu" 4
gist fetch (update the list of gists from github\.com)
.
.IP "\(bu" 4
gist 3 (show the repo path of your 3rd gist, and do custom actions)
.
.IP "\(bu" 4
gist 3 \-\-no\-action (show the repo path of your 3rd gist, and do not perform actions)
.
.IP "\(bu" 4
gist new \-\-desc bar foo (create a new gist with files and description)
.
.IP "" 0
.
.SS "Lyrics"
Description: Fetch lyrics for a certain song\.
.
.P
Usage: lyrics [flags] or tool [\-a] [arg] [\-s] [arg]
.
.IP "\(bu" 4
\-a Artist of the song to fetch lyrics for
.
.IP "\(bu" 4
\-s Song of the artist to fetch lyrics for
.
.IP "\(bu" 4
\-f Export the lyrics to file rather than outputting to stdout
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
lyrics \-a logic \-s run it
.
.IP "\(bu" 4
lyrics \-a logic \-s run it \-f ~/runItLyrics\.txt
.
.IP "" 0
.
.SS "Meme"
Description: A lightning fast meme generator
.
.P
Usage: tool [flags] or tool [flags] [arguments]
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-f Choose the output filename
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
meme \-f dogeMeme
.
.IP "" 0
.
.SS "Movies"
Description: Provides relevant information about a certain movie\.
.
.P
Usage: movies [flag] or movies [movieToSearch]
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "\(bu" 4
\-d Show detailed information
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
movies Argo
.
.IP "\(bu" 4
movies Inception
.
.IP "" 0
.
.SS "Newton"
Description: Performs numerical calculations all the way up to symbolic math parsing\.
.
.P
Usage: newton [operation] [expression] or newton [flag]
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Valid Symbols: + add \- subtract [ left parenthesis (you must use brackets bash has a bultin for parenthesis) ] right parenthesis (you must use brackets bash has a bultin for parenthesis) * multiply / divide ^ power : between the range of left and right side (only for area under curve) ~ parameter on right side (only for area, tangent line and log)
.
.P
Examples:
.
.IP "\(bu" 4
newton simplify [[2x]+7]*[4x]
.
.IP "\(bu" 4
movies derive x+2x
.
.IP "" 0
.
.SS "Pwned"
Usage: pwned [email]
.
.P
Description: Checks where an email account has been breached
.
.IP "" 4
.
.nf

* \-u Update Bash\-Snippet Tools

* \-h Show the help

* \-v Get the tool version
.
.fi
.
.IP "" 0
.
.P
Examples:
.
.IP "" 4
.
.nf

* pwned emailtocheck@email\.com
.
.fi
.
.IP "" 0
.
.SS "Qrify"
Usage: qrify [stringtoturnintoqrcode]
.
.P
Description: Converts strings or urls into a qr code\.
.
.IP "" 4
.
.nf

* \-u Update Bash\-Snippet Tools

* \-m Enable multiline support

* \-f Save the QRCode to a file

* \-d Decode the QR code from a PNG/GIF/JP(E)G file

* \-h Show the help

* \-v Get the tool version
.
.fi
.
.IP "" 0
.
.P
Examples:
.
.IP "" 4
.
.nf

* qrify this is a test string

* qrify \-m two \en lines

* qrify \-f fileNameHere Insert what you want to encode here

* qrify github\.com # notice no http:// or https:// this will fail

* qrify \-d fileName\.png
.
.fi
.
.IP "" 0
.
.SS "Short"
Description: Unmasks shortended urls\.
.
.P
Usage: short [shortURL] or short [flag]
.
.IP "\(bu" 4
\-e Expand the following URL
.
.IP "\(bu" 4
\-s Shorten the following URL
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Example:
.
.IP "\(bu" 4
Input: short \-e tinyurl\.com/jhkj
.
.IP "\(bu" 4
Output: http://possiblemaliciouswebsiteornot\.com
.
.IP "\(bu" 4
Input: short \-s google\.com
.
.IP "\(bu" 4
Output: http://ki\.tc/23sd1d
.
.IP "" 0
.
.SS "Siteciphers"
Description: Checks the available ciphers for the SSL of an https site\.
.
.P
Usage: siteciphers [flag] or siteciphers [optionalDFlag] [website]
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "\(bu" 4
\-d Set the delay between requests sent to the site (default is 1 sec)
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
siteciphers github\.com
.
.IP "\(bu" 4
siteciphers \-d 0\.75 google\.com
.
.IP "" 0
.
.SS "Stocks"
Description: Finds the latest information on a certain stock\.
.
.P
Usage: stocks [flag] or stocks [company/ticker]
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
stocks AAPL
.
.IP "\(bu" 4
stocks Tesla
.
.IP "" 0
.
.SS "Taste"
Description: A recommendation engine that provides 3 similar items based on some input topic\. Taste also has the ability to provide information on the item of interest\. Supports: shows, books, music, artists, movies, authors, games
.
.P
Usage: taste [flag] [item]
.
.IP "\(bu" 4
\-i Get more information on similar items
.
.IP "\(bu" 4
\-s Get information on the item itself
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
taste \-i Kendrick Lamar
.
.IP "\(bu" 4
taste Catcher in the Ry
.
.IP "\(bu" 4
taste \-s Red Hot Chili Peppers
.
.IP "" 0
.
.SS "Todo"
Description: A simplistic commandline todo list\.
.
.P
Usage: todo [flags] or todo [flags] [arguments]
.
.IP "\(bu" 4
\-c Clear all the current tasks
.
.IP "\(bu" 4
\-r Remove the following task number
.
.IP "\(bu" 4
\-g Get the current tasks
.
.IP "\(bu" 4
\-a Add the following task
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
todo \-a My very first task
.
.IP "\(bu" 4
todo \-r 1
.
.IP "\(bu" 4
todo \-g
.
.IP "\(bu" 4
todo \-c
.
.IP "" 0
.
.SS "Transfer"
Description: Quickly transfer files from the command line\.
.
.P
Usage: transfer [flags] or transfer [flag] [args] or transfer [filePathToUpload]
.
.IP "\(bu" 4
\-d Download a single file
.
.IP "" 4
.
.nf

* First arg: Output file directory
* Second arg: File url id
* Third arg: File name
.
.fi
.
.IP "" 0

.
.IP "\(bu" 4
\-o Onetime file upload
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
transfer ~/fileToTransfer\.txt
.
.IP "\(bu" 4
transfer ~/firstFileToTransfer\.txt ~/secondFileToTransfer\.txt # upload multiple files at once
.
.IP "\(bu" 4
transfer \-d ~/outputDirectory fileID fileName
.
.IP "\(bu" 4
transfer \-o ~/fileToTransfer\.txt
.
.IP "" 0
.
.SS "Weather"
Description: Provides a 3 day forecast on your current location or a specified location\. With no flags Weather will default to your current location\.
.
.P
Usage: weather or weather [flag] or weather [country] or weather [city] [state]
.
.IP "\(bu" 4
weather [optionalLocation] [i][M] get weather in imperial units, optional M means windspeed in m/s
.
.IP "\(bu" 4
weather [optionalLocation] [m][M] lowercase m gets weather in metric units, optional M means windspeed in m/s
.
.IP "\(bu" 4
weather [Moon] grabs the phase of the moon
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
weather
.
.IP "\(bu" 4
weather Paris m
.
.IP "\(bu" 4
weather Tokyo
.
.IP "\(bu" 4
weather Moon
.
.IP "\(bu" 4
weather mM
.
.IP "" 0
.
.SS "Ytview"
Description: Search and play youtube videos right from the terminal\.
.
.P
Usage: ytview [flag] [string] or ytview [videoToSearch]
.
.IP "\(bu" 4
\-s Searches youtube
.
.IP "\(bu" 4
\-c Shows the latest videos of a channel
.
.IP "\(bu" 4
\-u Update Bash\-Snippet Tools
.
.IP "\(bu" 4
\-h Show the help
.
.IP "\(bu" 4
\-v Get the tool version
.
.IP "" 0
.
.P
Examples:
.
.IP "\(bu" 4
ytview \-s Family Guy Chicken Fight
.
.IP "\(bu" 4
ytview \-c Numberphile
.
.IP "" 0
.
.SH "Updating"
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
.
.IP "\(bu" 4
stocks update
.
.IP "" 0
.
.P
or
.
.IP "\(bu" 4
stocks \-u
.
.IP "" 0
.
.P
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\.
.
.SH "Uninstalling"
If you don\'t have the Bash\-Snippets folder anymore clone the repository: git clone https://github\.com/alexanderepstein/Bash\-Snippets`
.
.P
cd into the Bash\-Snippets directory: \fBcd Bash\-Snippets\fR
.
.IP "" 4
.
.nf

To go through a guided uninstall
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
\&\./uninstall\.sh
.
.IP "" 0
.
.SH "AUTHOR"
Alexander Epstein Github: https://github\.com/alexanderepstein
.
.SH "Contributors"
Jake Meyer Github: https://github\.com/jakewmeyer
.
.P
Linyos Torovoltos Github: https://gitbub\.com/linyostorovovoltos
.
.SH "License"
MIT License
.
.P
Copyright (c) 2017 Alex Epstein
.
.P
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:
.
.P
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software\.
.
.P
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\.


================================================
FILE: bash-snippets.1.html
================================================
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv='content-type' value='text/html;charset=utf8'>
  <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
  <title>bash-snippets(1) - A collection of small bash scripts for heavy terminal users</title>
  <style type='text/css' media='all'>
  /* style: man */
  body#manpage {margin:0}
  .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
  .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
  .mp h2 {margin:10px 0 0 0}
  .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
  .mp h3 {margin:0 0 0 4ex}
  .mp dt {margin:0;clear:left}
  .mp dt.flush {float:left;width:8ex}
  .mp dd {margin:0 0 0 9ex}
  .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
  .mp pre {margin-bottom:20px}
  .mp pre+h2,.mp pre+h3 {margin-top:22px}
  .mp h2+pre,.mp h3+pre {margin-top:5px}
  .mp img {display:block;margin:auto}
  .mp h1.man-title {display:none}
  .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
  .mp h2 {font-size:16px;line-height:1.25}
  .mp h1 {font-size:20px;line-height:2}
  .mp {text-align:justify;background:#fff}
  .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
  .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
  .mp u {text-decoration:underline}
  .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
  .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
  .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
  .mp b.man-ref {font-weight:normal;color:#434241}
  .mp pre {padding:0 4ex}
  .mp pre code {font-weight:normal;color:#434241}
  .mp h2+pre,h3+pre {padding-left:0}
  ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
  ol.man-decor {width:100%}
  ol.man-decor li.tl {text-align:left}
  ol.man-decor li.tc {text-align:center;letter-spacing:4px}
  ol.man-decor li.tr {text-align:right;float:right}
  </style>
</head>
<!--
  The following styles are deprecated and will be removed at some point:
  div#man, div#man ol.man, div#man ol.head, div#man ol.man.

  The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
  .man-navigation should be used instead.
-->
<body id='manpage'>
  <div class='mp' id='man'>

  <div class='man-navigation' style='display:none'>
    <a href="#NAME">NAME</a>
    <a href="#Tools">Tools</a>
    <a href="#Updating">Updating</a>
    <a href="#Uninstalling">Uninstalling</a>
    <a href="#AUTHOR">AUTHOR</a>
    <a href="#Contributors">Contributors</a>
    <a href="#License">License</a>
  </div>

  <ol class='man-decor man-head man head'>
    <li class='tl'>bash-snippets(1)</li>
    <li class='tc'></li>
    <li class='tr'>bash-snippets(1)</li>
  </ol>

  <h2 id="NAME">NAME</h2>
<p class="man-name">
  <code>bash-snippets</code> - <span class="man-whatis">A collection of small bash scripts for heavy terminal users</span>
</p>

<h2 id="Tools">Tools</h2>

<h3 id="Cheat">Cheat</h3>

<p>Description: Cheatsheets for quick information about multiple programming languages along with terminal commands</p>

<p>Usage: cheat [flags] [command] or cheat [flags] [programming language] [subject]</p>

<ul>
<li><p>-s Does a search for last argument rather than looking for exact match</p></li>
<li><p>-i Case insensitive search</p></li>
<li><p>-b Word boundaries in search</p></li>
<li><p>-r Recursive search</p></li>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Special Pages:</p>

<ul>
<li><p>hello Describes building the hello world program written in the language</p></li>
<li><p>list This lists all cheatsheets related to previous arg if none it lists all cheatsheets</p></li>
<li><p>learn Shows a learn-x-in-minutes language cheat sheet perfect for getting started with the language</p></li>
<li><p>1line A collection of one-liners in this language</p></li>
<li><p>weirdness A collection of examples of weird things in this language</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>cheat rust hello</p></li>
<li><p>cheat -r -b -i go</p></li>
<li><p>cheat julia Functions</p></li>
<li><p>cheat -i go operators</p></li>
</ul>


<h3 id="Cloudup">Cloudup</h3>

<p>Description: Backs up a users github repositories to your bitbucket account.
  With no flags cloudup will guide you through backing up a single repository</p>

<p>Usage: cloudup [flags] or cloudup [flags] [listOfGHRepoNamesSplitBySpaces]</p>

<ul>
<li><p>-p Upload the repositor(y)(ies) as private to bitbucket (must have private repo ability on bitbucket)</p></li>
<li><p>-a Backup all github repositories</p></li>
<li><p>-s Only backup repositories that you have created (no forks) (only works in conjunction with the -a flag)</p></li>
<li><p>-t Backup the repository with a timestamp added to the repostiory name (will always create a new unique bitbucket repo)</p></li>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p> cloudup</p></li>
<li><p> cloudup -p -a</p></li>
<li><p> cloudup -p nameOfRepo1 nameOf Repo2</p></li>
<li><p> cloudup nameOfRep</p></li>
</ul>


<h3 id="Crypt">Crypt</h3>

<p>Description: A wrapper around openssl that facilitates encrypting and decrypting files.</p>

<p>Usage: crypt [flag] [inputFile] [outputFile]</p>

<ul>
<li><p>-e Encrypt the inputFile and store it in the outputFil</p></li>
<li><p>-d Decrypt the inputFile and store it in the outputFil</p></li>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>crypt -e mySecretFile.txt myEncryptedFile.jpg (change filetype so default program is incorrect)</p></li>
<li><p>crypt -d myEncryptedFile.jpg thisIsNowDecrypted.txt (change filetype back so now default program is correct)</p></li>
</ul>


<h3 id="CryptoCurrency">CryptoCurrency</h3>

<p>Description: A realtime cryptocurrency converter.
With no flags it will pull down the latest stats of the top 10 cryptos</p>

<p>Usage: cryptocurrency or cryptocurrency [flag] or cryptocurrency [flag] [arg]</p>

<ul>
<li><p>-o Utilize the old functionality of the tool</p></li>
<li><p>-f Fiat currency for conversions</p></li>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Examples:
  cryptocurrency -o
  cryptocurrency -f eur</p>

<h3 id="Currency">Currency</h3>

<p>Description: A realtime currency converter.
   With no flags it will guide you through the currency exchange</p>

<p>Usage: currency or currency [flag] or currency [base] [exchangeTo] [amount]</p>

<ul>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Supported Currencies:</p>

<hr />

<p>| AUD | BGN | BRL | CAD |
| CHF | CNY | CZK | DKK |
| EUR | GBP | HKD | HRK |
| HUF | IDR | ILS | INR |
| JPY | KRW | MXN | MYR |
| NOK | NZD | PHP | PLN |
| RON | RUB | SEK | SGD |
| THB | TRY | USD | ZAR |</p>

<hr />

<p>Examples:</p>

<ul>
<li><p>currency EUR USD 12.35</p></li>
<li><p>currency</p></li>
</ul>


<h3 id="Geo">Geo</h3>

<p>Description: Provides quick access for wan, lan, router, dns, mac, and ip geolocation data</p>

<p>Usage: geo [flag]</p>

<ul>
<li><p>-w  Returns WAN IP</p></li>
<li><p>-l  Returns LAN IP(s)</p></li>
<li><p>-r  Returns Router IP</p></li>
<li><p>-d  Returns DNS Nameserver</p></li>
<li><p>-m  Returns MAC address for interface. Ex. eth0</p></li>
<li><p>-g  Returns Current IP Geodata</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>geo -g</p></li>
<li><p>geo -wlrdgm eth0</p></li>
</ul>


<p>Custom Geo Output =>
[all] [query] [city] [region] [country] [zip] [isp]</p>

<p>Example: geo -a 8.8.8.8 -o city,zip,isp</p>

<ul>
<li><p>-o  [options] Returns Specific Geodata</p></li>
<li><p>-a  [address] For specific ip in -s</p></li>
<li><p>-v  Returns Version</p></li>
<li><p>-h  Returns Help Screen</p></li>
<li><p>-u  Updates Bash-Snippets</p></li>
</ul>


<h3 id="Gist">Gist</h3>

<p>Description: Manage your gists with git and Github API v3</p>

<p>Usage: gist [command] [args]</p>

<ul>
<li><p>[star|all]  List your gists, use 'star' as argument for your starred gists,
            'all' or 'a' for both your and starred gists. Format for each line is:
            <var>INDEX</var> <var>URL</var> <var>FILE_NUM</var> <var>COMMENT_NUM</var> <var>DESCRIPTION</var></p></li>
<li><p>fetch       Update the local list of your gists, 'star' as argument for your starred gists</p></li>
<li><p><var>INDEX</var>     Show the path of local gist repo and do custom actions</p></li>
<li><p>new         Create a new gist with files or STDIN</p></li>
<li><p>grep        Grep gists by description, filename and content with a given pattern</p></li>
<li><p>tag         Modify/List tags for a gist</p></li>
<li><p>tags        List all tags and pinned tags</p></li>
<li><p>pin,        Pin/Unpin tags, or filter gists with pinned tags</p></li>
<li><p>lan         Filter gists or list gist with coding languages</p></li>
<li><p>detail      Show the detail of a gist</p></li>
<li><p>edit        Edit description for a gist</p></li>
<li><p>delete      Delete gists by given indices</p></li>
<li><p>push        Push changes by git</p></li>
<li><p>clean       Clean local repos of removed gists</p></li>
<li><p>config      Do configuration</p></li>
<li><p>user        Get list of gists with a given Github user</p></li>
<li><p>github      Import selected gist as a new Github repo</p></li>
<li><p>help        Show the helper message</p></li>
</ul>


<p>Example:</p>

<ul>
<li><p>gist                    (Show your gists)</p></li>
<li><p>gist tag                (Show your gists with tags)</p></li>
<li><p>gist fetch              (update the list of gists from github.com)</p></li>
<li><p>gist 3                  (show the repo path of your 3rd gist, and do custom actions)</p></li>
<li><p>gist 3 --no-action      (show the repo path of your 3rd gist, and do not perform actions)</p></li>
<li><p>gist new --desc bar foo (create a new gist with files and description)</p></li>
</ul>


<h3 id="Lyrics">Lyrics</h3>

<p>Description: Fetch lyrics for a certain song.</p>

<p>Usage: lyrics [flags] or tool [-a] [arg] [-s] [arg]</p>

<ul>
<li><p>-a  Artist of the song to fetch lyrics for</p></li>
<li><p>-s  Song of the artist to fetch lyrics for</p></li>
<li><p>-f  Export the lyrics to file rather than outputting to stdout</p></li>
<li><p>-u  Update Bash-Snippet Tools</p></li>
<li><p>-h  Show the help</p></li>
<li><p>-v  Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>lyrics -a logic -s run it</p></li>
<li><p>lyrics -a logic -s run it -f ~/runItLyrics.txt</p></li>
</ul>


<h3 id="Meme">Meme</h3>

<p>Description: A lightning fast meme generator</p>

<p>Usage: tool [flags] or tool [flags] [arguments]</p>

<ul>
<li><p>-u  Update Bash-Snippet Tools</p></li>
<li><p>-h  Show the help</p></li>
<li><p>-f  Choose the output filename</p></li>
<li><p>-v  Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li>meme -f dogeMeme</li>
</ul>


<h3 id="Movies">Movies</h3>

<p>Description: Provides relevant information about a certain movie.</p>

<p>Usage: movies [flag] or movies [movieToSearch]</p>

<ul>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
<li><p>-d Show detailed information</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>movies Argo</p></li>
<li><p>movies Inception</p></li>
</ul>


<h3 id="Newton">Newton</h3>

<p>Description: Performs numerical calculations all the way up to symbolic math parsing.</p>

<p>Usage: newton [operation] [expression] or newton [flag]</p>

<ul>
<li><p>-u  Update Bash-Snippet Tools</p></li>
<li><p>-h  Show the help</p></li>
<li><p>-v  Get the tool version</p></li>
</ul>


<table>
<thead>
<tr>
<th>Operations     Sample Expression      Sample Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>Simplify       [[2x<sup>2</sup>]+7]*[4x<sup>2</sup>]    8 x<sup>4</sup> + 28 x<sup>2</sup> </td>
</tr>
<tr>
<td>Factor             x<sup>2</sup> + 2x             x (x + 2)  </td>
</tr>
<tr>
<td>Derive              x<sup>2</sup>+2x               2 x + 2   </td>
</tr>
<tr>
<td>Integrate           x<sup>2</sup>+2x         1/3 x<sup>3</sup> + x<sup>2</sup> +C</td>
</tr>
<tr>
<td>Roots/Zeroes        x<sup>2</sup>+2x                2, 0     </td>
</tr>
<tr>
<td>Tangent             2~x<sup>3</sup>              12 x + -16  | (Finding tangent line when x=2 for expression x<sup>3</sup>)</td>
</tr>
<tr>
<td>Area               2:4~x<sup>3</sup>                 60      | (Finding area under curve from 2 to 4 for expression x<sup>3</sup>)</td>
</tr>
<tr>
<td>Cos                   pi                   -1      </td>
</tr>
<tr>
<td>Sin                   pi                    0      </td>
</tr>
<tr>
<td>Tan                  pi/4                   1      </td>
</tr>
<tr>
<td>ArcCos                 1                    0      </td>
</tr>
<tr>
<td>ArcSin                 0                    0      </td>
</tr>
<tr>
<td>ArcTan                pi                arcsin(pi) </td>
</tr>
<tr>
<td>Abs                   -2                    2      </td>
</tr>
<tr>
<td>Log                   2~8                   3      | (Log base 2 of eight)</td>
</tr>
</tbody>
</table>


<p>  Valid Symbols:
    + add
    - subtract
    [ left parenthesis (you must use brackets bash has a bultin for parenthesis)
    ] right parenthesis (you must use brackets bash has a bultin for parenthesis)
    * multiply
    / divide
    ^ power
    : between the range of left and right side (only for area under curve)
    ~ parameter on right side (only for area, tangent line and log)</p>

<p>Examples:</p>

<ul>
<li><p>newton simplify [[2x<sup>2</sup>]+7]*[4x<sup>2</sup>]</p></li>
<li><p>movies derive x<sup>2</sup>+2x</p></li>
</ul>


<h3 id="Pwned">Pwned</h3>

<p>Usage: pwned [email]</p>

<p>Description: Checks where an email account has been breached</p>

<pre><code>* -u Update Bash-Snippet Tools

* -h Show the help

* -v Get the tool version
</code></pre>

<p>Examples:</p>

<pre><code>* pwned emailtocheck@email.com
</code></pre>

<h3 id="Qrify">Qrify</h3>

<p>Usage: qrify [stringtoturnintoqrcode]</p>

<p>Description: Converts strings or urls into a qr code.</p>

<pre><code>* -u Update Bash-Snippet Tools

* -m Enable multiline support

* -f Save the QRCode to a file

* -d Decode the QR code from a PNG/GIF/JP(E)G file

* -h Show the help

* -v Get the tool version
</code></pre>

<p>Examples:</p>

<pre><code>* qrify this is a test string

* qrify -m two \n lines

* qrify -f fileNameHere Insert what you want to encode here

* qrify github.com # notice no http:// or https:// this will fail

* qrify -d fileName.png
</code></pre>

<h3 id="Short">Short</h3>

<p>Description: Unmasks shortended urls.</p>

<p>Usage: short [shortURL] or short [flag]</p>

<ul>
<li><p>-e Expand the following URL</p></li>
<li><p>-s Shorten the following URL</p></li>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Example:</p>

<ul>
<li><p> Input: short -e tinyurl.com/jhkj</p></li>
<li><p> Output: http://possiblemaliciouswebsiteornot.com</p></li>
<li><p> Input: short -s google.com</p></li>
<li><p> Output: http://ki.tc/23sd1d</p></li>
</ul>


<h3 id="Siteciphers">Siteciphers</h3>

<p>Description: Checks the available ciphers for the SSL of an https site.</p>

<p>Usage: siteciphers [flag] or siteciphers [optionalDFlag] [website]</p>

<ul>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
<li><p>-d Set the delay between requests sent to the site (default is 1 sec)</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>siteciphers github.com</p></li>
<li><p>siteciphers -d 0.75 google.com</p></li>
</ul>


<h3 id="Stocks">Stocks</h3>

<p>Description: Finds the latest information on a certain stock.</p>

<p>Usage: stocks [flag] or stocks [company/ticker]</p>

<ul>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>stocks AAPL</p></li>
<li><p>stocks Tesla</p></li>
</ul>


<h3 id="Taste">Taste</h3>

<p>Description: A recommendation engine that provides 3 similar items based on some input topic.
  Taste also has the ability to provide information on the item of interest.
  Supports: shows, books, music, artists, movies, authors, games</p>

<p>Usage: taste [flag] [item]</p>

<ul>
<li><p>-i Get more information on similar items</p></li>
<li><p>-s Get information on the item itself</p></li>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>taste -i Kendrick Lamar</p></li>
<li><p>taste Catcher in the Ry</p></li>
<li><p>taste -s Red Hot Chili Peppers</p></li>
</ul>


<h3 id="Todo">Todo</h3>

<p>Description: A simplistic commandline todo list.</p>

<p>Usage: todo [flags] or todo [flags] [arguments]</p>

<ul>
<li><p>-c Clear all the current tasks</p></li>
<li><p>-r Remove the following task number</p></li>
<li><p>-g Get the current tasks</p></li>
<li><p>-a Add the following task</p></li>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>todo -a My very first task</p></li>
<li><p>todo -r 1</p></li>
<li><p>todo -g</p></li>
<li><p>todo -c</p></li>
</ul>


<h3 id="Transfer">Transfer</h3>

<p>Description: Quickly transfer files from the command line.</p>

<p>Usage: transfer [flags] or transfer [flag] [args] or transfer [filePathToUpload]</p>

<ul>
<li><p>-d  Download a single file</p>

<pre><code>* First arg: Output file directory
* Second arg: File url id
* Third arg: File name
</code></pre></li>
<li><p>-o  Onetime file upload</p></li>
<li><p>-u  Update Bash-Snippet Tools</p></li>
<li><p>-h  Show the help</p></li>
<li><p>-v  Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>transfer ~/fileToTransfer.txt</p></li>
<li><p>transfer ~/firstFileToTransfer.txt ~/secondFileToTransfer.txt # upload multiple files at once</p></li>
<li><p>transfer -d ~/outputDirectory fileID fileName</p></li>
<li><p>transfer -o ~/fileToTransfer.txt</p></li>
</ul>


<h3 id="Weather">Weather</h3>

<p>Description: Provides a 3 day forecast on your current location or a specified location.
  With no flags Weather will default to your current location.</p>

<p>Usage: weather or weather [flag] or weather [country] or weather [city] [state]</p>

<ul>
<li><p>weather [optionalLocation] [i][M] get weather in imperial units, optional M means windspeed in m/s</p></li>
<li><p>weather [optionalLocation] [m][M] lowercase m gets weather in metric units, optional M means windspeed in m/s</p></li>
<li><p>weather [Moon] grabs the phase of the moon</p></li>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>weather</p></li>
<li><p>weather Paris m</p></li>
<li><p>weather Tokyo</p></li>
<li><p>weather Moon</p></li>
<li><p>weather mM</p></li>
</ul>


<h3 id="Ytview">Ytview</h3>

<p>Description: Search and play youtube videos right from the terminal.</p>

<p>Usage: ytview [flag] [string] or ytview [videoToSearch]</p>

<ul>
<li><p>-s Searches youtube</p></li>
<li><p>-c Shows the latest videos of a channel</p></li>
<li><p>-u Update Bash-Snippet Tools</p></li>
<li><p>-h Show the help</p></li>
<li><p>-v Get the tool version</p></li>
</ul>


<p>Examples:</p>

<ul>
<li><p>ytview -s Family Guy Chicken Fight</p></li>
<li><p>ytview -c Numberphile</p></li>
</ul>


<h2 id="Updating">Updating</h2>

<p>  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</p>

<ul>
<li>stocks update</li>
</ul>


<p>  or</p>

<ul>
<li>stocks -u</li>
</ul>


<p>  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.</p>

<h2 id="Uninstalling">Uninstalling</h2>

<p>  If you don't have the Bash-Snippets folder anymore clone the repository:  git clone https://github.com/alexanderepstein/Bash-Snippets`</p>

<p>  cd into the Bash-Snippets directory: <code>cd Bash-Snippets</code></p>

<pre><code>To go through a guided uninstall
</code></pre>

<ul>
<li> ./uninstall.sh</li>
</ul>


<h2 id="AUTHOR">AUTHOR</h2>

<p>Alexander Epstein
Github: https://github.com/alexanderepstein</p>

<h2 id="Contributors">Contributors</h2>

<p>Jake Meyer
Github: https://github.com/jakewmeyer</p>

<p>Linyos Torovoltos
Github: https://gitbub.com/linyostorovovoltos</p>

<h2 id="License">License</h2>

<p>MIT License</p>

<p>Copyright (c) 2017 Alex Epstein</p>

<p>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:</p>

<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>

<p>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.</p>


  <ol class='man-decor man-foot man foot'>
    <li class='tl'></li>
    <li class='tc'>April 2020</li>
    <li class='tr'>bash-snippets(1)</li>
  </ol>

  </div>
</body>
</html>


================================================
FILE: bash-snippets.1.ronn
================================================
bash-snippets(1) -- A collection of small bash scripts for heavy terminal users
====

## Tools

### Cheat
Description: Cheatsheets for quick information about multiple programming languages along with terminal commands

Usage: cheat [flags] [command] or cheat [flags] [programming language] [subject]

  * -s Does a search for last argument rather than looking for exact match

  * -i Case insensitive search

  * -b Word boundaries in search

  * -r Recursive search

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Special Pages:

  * hello Describes building the hello world program written in the language

  * list This lists all cheatsheets related to previous arg if none it lists all cheatsheets

  * learn Shows a learn-x-in-minutes language cheat sheet perfect for getting started with the language

  * 1line A collection of one-liners in this language

  * weirdness A collection of examples of weird things in this language

Examples:

  * cheat rust hello

  * cheat -r -b -i go

  * cheat julia Functions

  * cheat -i go operators

### Cloudup
Description: Backs up a users github repositories to your bitbucket account.
  With no flags cloudup will guide you through backing up a single repository

Usage: cloudup [flags] or cloudup [flags] [listOfGHRepoNamesSplitBySpaces]

  * -p Upload the repositor(y)(ies) as private to bitbucket (must have private repo ability on bitbucket)

  * -a Backup all github repositories

  * -s Only backup repositories that you have created (no forks) (only works in conjunction with the -a flag)

  * -t Backup the repository with a timestamp added to the repostiory name (will always create a new unique bitbucket repo)

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Examples:

   * cloudup

   * cloudup -p -a

   * cloudup -p nameOfRepo1 nameOf Repo2

   * cloudup nameOfRep

### Crypt
Description: A wrapper around openssl that facilitates encrypting and decrypting files.

Usage: crypt [flag] [inputFile] [outputFile]

  * -e Encrypt the inputFile and store it in the outputFil

  * -d Decrypt the inputFile and store it in the outputFil

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Examples:

  * crypt -e mySecretFile.txt myEncryptedFile.jpg (change filetype so default program is incorrect)

  * crypt -d myEncryptedFile.jpg thisIsNowDecrypted.txt (change filetype back so now default program is correct)

### CryptoCurrency
Description: A realtime cryptocurrency converter.
With no flags it will pull down the latest stats of the top 10 cryptos

Usage: cryptocurrency or cryptocurrency [flag] or cryptocurrency [flag] [arg]

  * -o Utilize the old functionality of the tool

  * -f Fiat currency for conversions

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version



Examples:
  cryptocurrency -o
  cryptocurrency -f eur

### Currency
Description: A realtime currency converter.
   With no flags it will guide you through the currency exchange

Usage: currency or currency [flag] or currency [base] [exchangeTo] [amount]

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Supported Currencies:
 _______________________
| AUD | BGN | BRL | CAD |
| CHF | CNY | CZK | DKK |
| EUR | GBP | HKD | HRK |
| HUF | IDR | ILS | INR |
| JPY | KRW | MXN | MYR |
| NOK | NZD | PHP | PLN |
| RON | RUB | SEK | SGD |
| THB | TRY | USD | ZAR |
 _______________________

Examples:

  * currency EUR USD 12.35

  * currency

### Geo
Description: Provides quick access for wan, lan, router, dns, mac, and ip geolocation data

Usage: geo [flag]

  * -w  Returns WAN IP

  * -l  Returns LAN IP(s)

  * -r  Returns Router IP

  * -d  Returns DNS Nameserver

  * -m  Returns MAC address for interface. Ex. eth0

  * -g  Returns Current IP Geodata

Examples:

  * geo -g

  * geo -wlrdgm eth0

Custom Geo Output =>
[all] [query] [city] [region] [country] [zip] [isp]

Example: geo -a 8.8.8.8 -o city,zip,isp

  * -o  [options] Returns Specific Geodata

  * -a  [address] For specific ip in -s

  * -v  Returns Version

  * -h  Returns Help Screen

  * -u  Updates Bash-Snippets

### Gist
Description: Manage your gists with git and Github API v3

Usage: gist [command] [args]

  * [star|all]  List your gists, use 'star' as argument for your starred gists,
                'all' or 'a' for both your and starred gists. Format for each line is:
                <INDEX> <URL> <FILE_NUM> <COMMENT_NUM> <DESCRIPTION>

  * fetch       Update the local list of your gists, 'star' as argument for your starred gists
   
  * <INDEX>     Show the path of local gist repo and do custom actions

  * new         Create a new gist with files or STDIN

  * grep        Grep gists by description, filename and content with a given pattern

  * tag         Modify/List tags for a gist

  * tags        List all tags and pinned tags

  * pin,        Pin/Unpin tags, or filter gists with pinned tags

  * lan         Filter gists or list gist with coding languages

  * detail      Show the detail of a gist

  * edit        Edit description for a gist

  * delete      Delete gists by given indices

  * push        Push changes by git

  * clean       Clean local repos of removed gists

  * config      Do configuration

  * user        Get list of gists with a given Github user

  * github      Import selected gist as a new Github repo

  * help        Show the helper message

Example:

  * gist                    (Show your gists)

  * gist tag                (Show your gists with tags)

  * gist fetch              (update the list of gists from github.com)

  * gist 3                  (show the repo path of your 3rd gist, and do custom actions)

  * gist 3 --no-action      (show the repo path of your 3rd gist, and do not perform actions)

  * gist new --desc bar foo (create a new gist with files and description)

### Lyrics
Description: Fetch lyrics for a certain song.

Usage: lyrics [flags] or tool [-a] [arg] [-s] [arg]

  * -a  Artist of the song to fetch lyrics for

  * -s  Song of the artist to fetch lyrics for

  * -f  Export the lyrics to file rather than outputting to stdout

  * -u  Update Bash-Snippet Tools

  * -h  Show the help

  * -v  Get the tool version

Examples:

  * lyrics -a logic -s run it

  * lyrics -a logic -s run it -f ~/runItLyrics.txt

### Meme
Description: A lightning fast meme generator

Usage: tool [flags] or tool [flags] [arguments]

  * -u  Update Bash-Snippet Tools

  * -h  Show the help

  * -f  Choose the output filename

  * -v  Get the tool version

Examples:

  * meme -f dogeMeme

### Movies
Description: Provides relevant information about a certain movie.

Usage: movies [flag] or movies [movieToSearch]

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

  * -d Show detailed information

Examples:

  * movies Argo

  * movies Inception

### Newton
Description: Performs numerical calculations all the way up to symbolic math parsing.

Usage: newton [operation] [expression] or newton [flag]

  * -u  Update Bash-Snippet Tools

  * -h  Show the help

  * -v  Get the tool version


|Operations     Sample Expression      Sample Result|
|---------------------------------------------------|
|Simplify       [[2x^2]+7]*[4x^2]    8 x^4 + 28 x^2 |
|Factor             x^2 + 2x             x (x + 2)  |
|Derive              x^2+2x               2 x + 2   |
|Integrate           x^2+2x         1/3 x^3 + x^2 +C|
|Roots/Zeroes        x^2+2x                2, 0     |
|Tangent             2~x^3              12 x + -16  | (Finding tangent line when x=2 for expression x^3)
|Area               2:4~x^3                 60      | (Finding area under curve from 2 to 4 for expression x^3)
|Cos                   pi                   -1      |
|Sin                   pi                    0      |
|Tan                  pi/4                   1      |
|ArcCos                 1                    0      |
|ArcSin                 0                    0      |
|ArcTan                pi                arcsin(pi) |
|Abs                   -2                    2      |
|Log                   2~8                   3      | (Log base 2 of eight)


  Valid Symbols:
    + add
    - subtract
    [ left parenthesis (you must use brackets bash has a bultin for parenthesis)
    ] right parenthesis (you must use brackets bash has a bultin for parenthesis)
    * multiply
    / divide
    ^ power
    : between the range of left and right side (only for area under curve)
    ~ parameter on right side (only for area, tangent line and log)

Examples:

* newton simplify [[2x^2]+7]*[4x^2]

* movies derive x^2+2x

### Pwned
Usage: pwned [email]

Description: Checks where an email account has been breached

    * -u Update Bash-Snippet Tools

    * -h Show the help

    * -v Get the tool version

Examples:

    * pwned emailtocheck@email.com

### Qrify
Usage: qrify [stringtoturnintoqrcode]

Description: Converts strings or urls into a qr code.

    * -u Update Bash-Snippet Tools

    * -m Enable multiline support

    * -f Save the QRCode to a file

    * -d Decode the QR code from a PNG/GIF/JP(E)G file

    * -h Show the help

    * -v Get the tool version

Examples:

    * qrify this is a test string

    * qrify -m two \n lines

    * qrify -f fileNameHere Insert what you want to encode here

    * qrify github.com # notice no http:// or https:// this will fail

    * qrify -d fileName.png

### Short
Description: Unmasks shortended urls.

Usage: short [shortURL] or short [flag]

  * -e Expand the following URL

  * -s Shorten the following URL

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Example:

   * Input: short -e tinyurl.com/jhkj

   * Output: http://possiblemaliciouswebsiteornot.com

   * Input: short -s google.com

   * Output: http://ki.tc/23sd1d

### Siteciphers
Description: Checks the available ciphers for the SSL of an https site.

Usage: siteciphers [flag] or siteciphers [optionalDFlag] [website]

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

  * -d Set the delay between requests sent to the site (default is 1 sec)

Examples:

  * siteciphers github.com

  * siteciphers -d 0.75 google.com

### Stocks
Description: Finds the latest information on a certain stock.

Usage: stocks [flag] or stocks [company/ticker]

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Examples:

  * stocks AAPL

  * stocks Tesla

### Taste
Description: A recommendation engine that provides 3 similar items based on some input topic.
  Taste also has the ability to provide information on the item of interest.
  Supports: shows, books, music, artists, movies, authors, games

Usage: taste [flag] [item]

  * -i Get more information on similar items

  * -s Get information on the item itself

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Examples:

  * taste -i Kendrick Lamar

  * taste Catcher in the Ry

  * taste -s Red Hot Chili Peppers

### Todo
Description: A simplistic commandline todo list.

Usage: todo [flags] or todo [flags] [arguments]

  * -c Clear all the current tasks

  * -r Remove the following task number

  * -g Get the current tasks

  * -a Add the following task

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Examples:

  * todo -a My very first task

  * todo -r 1

  * todo -g

  * todo -c

### Transfer
Description: Quickly transfer files from the command line.

Usage: transfer [flags] or transfer [flag] [args] or transfer [filePathToUpload]

  * -d  Download a single file
        * First arg: Output file directory
        * Second arg: File url id
        * Third arg: File name

  * -o  Onetime file upload

  * -u  Update Bash-Snippet Tools

  * -h  Show the help

  * -v  Get the tool version

Examples:

  * transfer ~/fileToTransfer.txt

  * transfer ~/firstFileToTransfer.txt ~/secondFileToTransfer.txt # upload multiple files at once

  * transfer -d ~/outputDirectory fileID fileName

  * transfer -o ~/fileToTransfer.txt

### Weather
Description: Provides a 3 day forecast on your current location or a specified location.
  With no flags Weather will default to your current location.

Usage: weather or weather [flag] or weather [country] or weather [city] [state]

  * weather [optionalLocation] [i][M] get weather in imperial units, optional M means windspeed in m/s

  * weather [optionalLocation] [m][M] lowercase m gets weather in metric units, optional M means windspeed in m/s

  * weather [Moon] grabs the phase of the moon

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Examples:

  * weather

  * weather Paris m

  * weather Tokyo

  * weather Moon

  * weather mM

### Ytview
Description: Search and play youtube videos right from the terminal.

Usage: ytview [flag] [string] or ytview [videoToSearch]

  * -s Searches youtube

  * -c Shows the latest videos of a channel

  * -u Update Bash-Snippet Tools

  * -h Show the help

  * -v Get the tool version

Examples:

  * ytview -s Family Guy Chicken Fight

  * ytview -c Numberphile


## Updating

  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

  * stocks update

  or

  * 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.

## Uninstalling

  If you don't have the Bash-Snippets folder anymore clone the repository:  git clone https://github.com/alexanderepstein/Bash-Snippets`

  cd into the Bash-Snippets directory: `cd Bash-Snippets`

    To go through a guided uninstall

  *  ./uninstall.sh


## AUTHOR

Alexander Epstein
Github: https://github.com/alexanderepstein

## Contributors

Jake Meyer
Github: https://github.com/jakewmeyer

Linyos Torovoltos
Github: https://gitbub.com/linyostorovovoltos

## 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.


================================================
FILE: changelog.md
================================================
<div align="center">

# Bash-Snippets Changelog

## Version 1.23.0

## Changes
* Added python3 support
* Added new feature from rates.sx for cryptocurrency
* Added new component bak2dvd
* Fixed stocks script and pointing it to new api
* Fixing Wlan IP on Mac for geo
* Adding environment variable YTVIEWPLAYER for choice of default player for ytview
</div>

<div align="center">

## Version 1.22.1

</div>

## Changes
* Fix bugs in currency tool because of api changes
* Fix bugs in cloudup tool because of api changes
* Fixing movies tool
* Fix bugs in meme tool
* Fix default answer on install

<div align="center">

## Version 1.22.0

</div>

## Changes
* Adding bash-snippets gui component
* Fixing bug in url shortener
* Fixing old functionality cryptocurrency



<div align="center">

## Version 1.21.0

</div>

## Changes
* Fixing the exchange name for the stocks tool
* Adding the memes component
* Fixing locale error
* Added pwned component
* Adding one time file transfer to transfer component
* Changing how cryptocurrency tool works now using rate.sx



<div align="center">

## Version 1.20.0

</div>

## Changes
* Brought back lyrics tool
* Added shorten url functionality to short
* Fixed the stocks api
* Save QRCodes to an image file
* Fixed bug in qrify for single-word strings
* Adding mdfind functionality to ytview


<div align="center">

## Version 1.19.2

</div>

## Changes
* ytview for macOS can now use mpv
* lyrics tool was removed, api is not available anymore



<div align="center">

## Version 1.19.1

</div>

## Changes
* Fixed bug in todo for task lists over 8 tasks
* Fixing the endpoint in the short tool

<div align="center">

## Version 1.19.0

</div>

### Changes
* Adding BCH to cryptocurrencies tool
* Adding lyrics component

<div align="center">

## Version 1.18.1

</div>

### Changes
* Changed how transfer uploads files
* Upload multiple files with transfer
* Get tasks after removal of tasks in todo
* Bulk removal of tasks in todo
* Removing bad echo from cloudup

<div align="center">

## Version 1.18.0

</div>

### Changes
* Added transfer component
* Fixing fetch call across all tools
* Changing progress echos for update
* Run checkInternet only when needed (speeds up processes that don't need it)
* Hiding the api help page in weather

<div align="center">

## Version 1.17.3

</div>

### Changes
* checkInternet now checks github.com over google.com
* tools that don't need bc don't use it
* tools that need bc can approximate without it
* Fixing trailing quotation mark for newton on osx
* Adding all option to uninstall


<div align="center">

## Version 1.17.2

</div>

### Changes
* Fixing where manpage is installed for linuxbrew
* Updating weather usage and manpage

<div align="center">

## Version 1.17.1

</div>

### Bugfixes
* Fixing grabbing the prefix in homebrew install

<div align="center">

## Version 1.17.0

</div>

### Changes
* Adding ability to use m/s for windspeed in weather
* Supporting httpie for all tools that work with it
* Install for homebrew can now handle multiple tools on one line

<div align="center">

## Version 1.16.2

</div>

### Changes
* Adding back all argument to homebrew install

<div align="center">

## Version 1.16.1

</div>

### Changes
* Changed install script for homebrew
* Added the -r option to newton

<div align="center">

## Version 1.16.0

</div>

### Changes
* Added cryptocurrency component
* Added newton component
* Changed WAN Call in geo

<div align="center">

## Version 1.15.2

</div>

### Bugfixes
* Installer path was preventing install

<div align="center">

## Version 1.15.1

</div>


### Changes
* Added --prefix option to installer for homebrew correctly

<div align="center">

## Version 1.15.0

</div>

### Changes
* Added -d option to movies
* Updating extra tools if installed in main update pipeline

<div align="center">

## Version 1.14.3

</div>

### Changes
* Adding new progress echos to cloudup

### Bugfixes
* Fixed bug in all tools using python for OSX where it would result caught in a segfault

<div align="center">

## Version 1.14.2

</div>

### Bugfixes
* Fixing bug where cloudup was incorrectly deleting the remote bitbucket repository.

<div align="center">

## Version 1.14.1

</div>

### Bugfixes
* Fixing issue in cloudup remote url was not set correctly if the ```-t``` option was not used
* Fixing issue in cloudup where tags were causing conflicts, solved by deleting bitbucket repo first

<div align="center">

## Version 1.14.0

</div>

### Changes
* Shebang changed to ```/usr/bin/env bash``` for more portability
* Todo has more error checking for bad input
* Added the ```-s``` option to cloudup which will prevent the backup of forked repositories
* Added the ```-t``` option to cloudup to give the user the ability to create a unique repo or just update the old one

<div align="center">

## Version 1.13.2

</div>


### Changes
* Updated installer not allow updates if bash-snippets was installed through package manager

<div align="center">

## Version 1.13.1

</div>

### Changes
* Preventing bad input in ```todo -r```
* Stocks was using unnecessary characters in the URL
* Cloudup's private option now works
* Cloudup's all option now looks to backup the first 10,000 repositories versus 100

<div align="center">

## Version 1.13.0

</div>

### Changes
* Added todo component

### Bugfixes
* Forcing ytview to search in english

<div align="center">

## Version 1.12.0

</div>

### Changes
* Added siteciphers component

### Bugfixes
* Crypt was still using only curl to get tags for update

<div align="center">

## Version 1.11.1

</div>

### Changes
* Now supporting the use of proxies
* Typo fixes
* Adding IMDB rating to movies tool

### Bugfixes
* Suppressing ```source ~/.bash_profile``` error


<div align="center">

## Version 1.11.1

</div>

### Bugfixes
* Fixed issue in ytview where it was playing wrong video
* Fixed wget check in qrify

<div align="center">

## Version 1.11.0

</div>

### Changes
* Adding manpage, view it with ```man bash-snippets```

<div align="center">

## Version 1.10.1

</div>


### Changes
* Cloudup's -a option is now functional

### Bugfixes
* Cloudup only needs one temporary copy of the repository
* Qrify had an issue where it couldn't handle more than one space
* Cloudup now retains git history when it backs up to bitbucket
* Fetch removed from qrify since it will not work


<div align="center">

## Version 1.10.0

</div>

### Changes
* Added qrify component

### Bugfixes
* Bug in taste where the -i option was not working
* Bug in all scripts that used python on OSX
* Bug in taste script on OSX

<div align="center">

## Version 1.9.0

</div>

### Changes
* Added cloudup component

### Bugfixes
* Fixing bug in ytview when search results are sparse


<div align="center">

## Version 1.8.0

</div>

### Changes
* Added ytview component

### Bugfixes
* Using ```$@``` instead of ```$1 $2 $3...``` in all applicable scripts
* Make call to python 2 explicit in all applicable scripts
* Hiding the cheatsheet api help page from the user


<div align="center">

## Version 1.7.0

</div>

### Changes
* Added cheat component

<div align="center">

## Version 1.6.0

</div>

### Changes
* Added geo component

<div align="center">

## Version 1.5.0

</div>

### Changes
* Added short component
### Bugfixes
* Sending errors in taste tool to /den/null
* Taste tool only has one unique youtube link not three

<div align="center">

## Version 1.4.0

</div>

# Changes
* Added taste component

<div align="center">

## Version 1.3.1

</div>

### Bugfixes
* Fixing bug in currency where invalid exchangeTo wasn't handled correctly


<div align="center">

## Version 1.3.0

</div>

### Changes
* Now supporting wget, fetch and curl
* Cleaning an echo on error for updating

<div align="center">

## Version 1.2.1

</div>

### Changes
* Check if curl is installed before using it
* No sudo on error in update, just let user know they need to run the command as sudo
* Changelog added
### Bugfixes
* Setting user agent for curl to prevent issues from changes in  ~/.curlrc

<div align="center">

## Version 1.2.0

</div>

### Changes
* Added help to each tool call with ```-h```
* Can now call weather with metric or imperial units
* Can now get the moon phase from weather
* Adding locale to weather so it will return in native language

<div align="center">

## Version 1.1.1

</div>

### Changes
* Now you can pass arguments to the weather tool to get weather of a location other then your own
* Now you can pass arguments to the currency tool to bypass the guided input
* The output for the currency tool is cleaner
### Bugfixes
* Fixed bug in currency where exchange rate was not parsed correctly
* Fixed bug in stocks where you could get lost in the tool by providing no input


<div align="center">

## Version 1.1.0

</div>

### Changes
* Facilitate updating by calling any of the tools with the -u option or update as the argument ex ```weather -u``` or ```weather update```

<div align="center">

## Version 1.0.0


</div>

### Initial Release
* Weather component added
* Stocks component added
* Movies component added
* Currency component added
* Crypt component added


================================================
FILE: cheat/cheat
================================================
#!/usr/bin/env bash
# Author: Alexander Epstein https://github.com/alexanderepstein

currentVersion="1.23.0"
configuredClient=""
## rest of these variables are search flags
search="0"
insensitive=""
recursive=""
boundry=""

## This function determines which http get tool the system has installed and returns an error if there isnt one
getConfiguredClient()
{
  if  command -v curl &>/dev/null; then
    configuredClient="curl"
  elif command -v wget &>/dev/null; then
    configuredClient="wget"
  elif command -v http &>/dev/null; then
    configuredClient="httpie"
  elif command -v fetch &>/dev/null; then
    configuredClient="fetch"
  else
    echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2
    return 1
  fi
}

## Allows to call the users configured client without if statements everywhere
httpGet()
{
  case "$configuredClient" in
    curl)  curl -A curl -s "$@" ;;
    wget)  wget -qO- "$@" ;;
    httpie) http -b GET "$@" ;;
    fetch) fetch -q "$@" ;;
  esac
}


checkInternet()
{
  httpGet github.com > /dev/null 2>&1 || { echo "Error: no active internet connection" >&2; return 1; } # query github with a get request
}

update()
{
  # Author: Alexander Epstein https://github.com/alexanderepstein
  # Update utility version 2.2.0
  # To test the tool enter in the defualt values that are in the examples for each variable
  repositoryName="Bash-Snippets" #Name of repostiory to be updated ex. Sandman-Lite
  githubUserName="alexanderepstein" #username that hosts the repostiory ex. alexanderepstein
  nameOfInstallFile="install.sh" # change this if the installer file has a different name be sure to include file extension if there is one
  latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option

  if [[ $currentVersion == "" || $repositoryName == "" || $githubUserName == "" || $nameOfInstallFile == "" ]]; then
    echo "Error: update utility has not been configured correctly." >&2
    exit 1
  elif [[ $latestVersion == "" ]]; then
    echo "Error: no active internet connection" >&2
    exit 1
  else
    if [[ "$latestVersion" != "$currentVersion" ]]; then
      echo "Version $latestVersion available"
      echo -n "Do you wish to update $repositoryName [Y/n]: "
      read -r answer
      if [[ "$answer" == [Yy] ]]; then
        cd ~ || { echo 'Update Failed'; exit 1; }
        if [[ -d  ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Permissions Error: try running the update as sudo"; exit 1; } ; fi
        echo -n "Downloading latest version of: $repositoryName."
        git clone -q "https://github.com/$githubUserName/$repositoryName" && touch .BSnippetsHiddenFile || { echo "Failure!"; exit 1; } &
        while [ ! -f .BSnippetsHiddenFile ]; do { echo -n "."; sleep 2; };done
        rm -f .BSnippetsHiddenFile
        echo "Success!"
        cd $repositoryName || { echo 'Update Failed'; exit 1; }
        git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
        chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
        ./$nameOfInstallFile "update" || exit 1
        cd ..
        rm -r -f $repositoryName || { echo "Permissions Error: update succesfull but cannot delete temp files located at ~/$repositoryName delete this directory with sudo"; exit 1; }
      else
        exit 1
      fi
    else
      echo "$repositoryName is already the latest version"
    fi
  fi
}

usage()
{
cat <<EOF
Cheat
Description: Cheatsheets for quick information about multiple programming languages along with terminal commands
Usage: cheat [flags] [command] or cheat [flags] [programming language] [subject]
  -s  Does a search for last argument rather than looking for exact match
  -i  Case insensitive search
  -b  Word boundaries in search
  -r  Recursive search
  -u  Update Bash-Snippet Tools
  -h  Show the help
  -v  Get the tool version
Special Pages:
  hello      Describes building the hello world program written in the language
  list       This lists all cheatsheets related to previous arg if none it lists all cheatsheets
  learn      Shows a learn-x-in-minutes language cheat sheet perfect for getting started with the language
  1line      A collection of one-liners in this language
  weirdness  A collection of examples of weird things in this language
Examples:
  cheat rust hello
  cheat -r -b -i go
  cheat julia Functions
  cheat -i go operators
EOF
}

getCheatSheet()
{
  if [[ $# == 1 ]]; then
    if [[ $search == "1" ]]; then
      link=cheat.sh/~$1
    else
      link=cheat.sh/$1
    fi
  else
    link=cheat.sh/$1
  fi

  if [[ $# == 2 ]]; then
    if [[ $search == "1" ]]; then
      link+=/~$2 ## add this to end of link where ~ indicates search
    else
      link+=/$2 ## add this to end of link
    fi
  fi

  if [[ $insensitive != "" || $recursive != "" || $boundry != "" ]]; then link+=/$boundry$insensitive$recursive; fi ## add this to the end of the link as flags

  httpGet $link
}


### This function just wraps some of the special pages provided by cheat.sh
checkSpecialPage()
{
  temp=$1
  if [[ $1 == "list" ]]; then
    temp=":list"
  elif [[ $1 == "learn" ]]; then
    temp=":list"
  elif [[ $1 == "styles" ]]; then
    temp=":styles"
  fi
  if [[ $2 == "1" ]]; then
    arg1=$temp
  else
    arg2=$temp
  fi
}

getConfiguredClient || exit 1


while getopts "ribuvhis" opt; do
  case "$opt" in
    \?) echo "Invalid option: -$OPTARG" >&2
        exit 1
        ;;
    h)  usage
        exit 0
        ;;
    v)  echo "Version $currentVersion"
        exit 0
        ;;
    u)
        checkInternet || exit 1
        update
        exit 0
        ;;
    i)  insensitive="i"
        search="1"
        ;;
    b)  boundry="b"
        search="1"
        ;;
    r)  recursive="r"
        search="1"
        ;;
    s)  search="1"
        ;;
    :)  echo "Option -$OPTARG requires an argument." >&2
        exit 1
        ;;
  esac
done

### This functions sets arg 1 and arg 2 to be unqique items after the options
for arg; do
  if [[ $arg != "-r" && $arg != "-s" && $arg != "-b" && $arg != "-i" ]]; then
    if [ -z ${arg1+x} ]; then
      arg1=$arg
    fi
    if [ ! -z ${arg1+x} ]; then
      arg2=$arg
    fi
  fi
done

## check for special pages before moving on
checkSpecialPage "$arg1" 1
checkSpecialPage "$arg2" 2

if [[ $# == 0 ]]; then
  usage
  exit 0
elif [[ $1 == "update" ]]; then
  checkInternet || exit 1
  update
  exit 0
elif [[ $1 == "help" || $1 == ":help" ]]; then ## shows the help and prevents the user from seeing cheat.sh/:help
  usage
  exit 0
else
  checkInternet || exit 1
  if [[ $arg1 != $arg2 ]]; then ## if they equal each other that means there was no arg 2 supplied
    getCheatSheet "$arg1" "$arg2"
    exit 0
  else
    getCheatSheet "$arg1"
    exit 0
  fi
  exit 0
fi


================================================
FILE: cloudup/cloudup
================================================
#!/usr/bin/env bash
# Author: Alexander Epstein https://github.com/alexanderepstein

currentVersion="1.23.0"
configuredClient=""
private="0" ## state of private flag
all="0" ## state of all flag
if [ -d ~/temp ]; then rm -rf ~/temp; fi ## if the temp folder exists we want to delete it just in case it was left over from a fatal error
source="0"
tStamp="0"


## This function determines which http get tool the system has installed and returns an error if there isnt one
getConfiguredClient()
{
  if  command -v curl &>/dev/null; then
    configuredClient="curl"
  elif command -v wget &>/dev/null; then
    configuredClient="wget"
  elif command -v fetch &>/dev/null; then
    configuredClient="fetch"
  else
    echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2
    return 1
  fi
}

## Allows to call the users configured client without if statements everywhere
httpGet()
{
  case "$configuredClient" in
    curl)  curl -A curl -s "$@" ;;
    wget)  wget -qO- "$@" ;;
    fetch) fetch -q "$@" ;;
  esac
}

checkInternet()
{
  httpGet github.com > /dev/null 2>&1 || { echo "Error: no active internet connection" >&2; return 1; } # query github with a get request
}

update()
{
  # Author: Alexander Epstein https://github.com/alexanderepstein
  # Update utility version 2.2.0
  # To test the tool enter in the defualt values that are in the examples for each variable
  repositoryName="Bash-Snippets" #Name of repostiory to be updated ex. Sandman-Lite
  githubUserName="alexanderepstein" #username that hosts the repostiory ex. alexanderepstein
  nameOfInstallFile="install.sh" # change this if the installer file has a different name be sure to include file extension if there is one
  latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option

  if [[ $currentVersion == "" || $repositoryName == "" || $githubUserName == "" || $nameOfInstallFile == "" ]]; then
    echo "Error: update utility has not been configured correctly." >&2
    exit 1
  elif [[ $latestVersion == "" ]]; then
    echo "Error: no active internet connection" >&2
    exit 1
  else
    if [[ "$latestVersion" != "$currentVersion" ]]; then
      echo "Version $latestVersion available"
      echo -n "Do you wish to update $repositoryName [Y/n]: "
      read -r answer
      if [[ "$answer" == [Yy] ]]; then
        cd ~ || { echo 'Update Failed'; exit 1; }
        if [[ -d  ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Permissions Error: try running the update as sudo"; exit 1; } ; fi
        echo -n "Downloading latest version of: $repositoryName."
        git clone -q "https://github.com/$githubUserName/$repositoryName" && touch .BSnippetsHiddenFile || { echo "Failure!"; exit 1; } &
        while [ ! -f .BSnippetsHiddenFile ]; do { echo -n "."; sleep 2; };done
        rm -f .BSnippetsHiddenFile
        echo "Success!"
        cd $repositoryName || { echo 'Update Failed'; exit 1; }
        git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
        chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
        ./$nameOfInstallFile "update" || exit 1
        cd ..
        rm -r -f $repositoryName || { echo "Permissions Error: update succesfull but cannot delete temp files located at ~/$repositoryName delete this directory with sudo"; exit 1; }
      else
        exit 1
      fi
    else
      echo "$repositoryName is already the latest version"
    fi
  fi
}

## This grabs the users bitbucket info could be improved by making sure username exists
getBitbucketInfo()
{
  echo -n 'Enter your Bitbucket username: '
  read bbUsername
  if [[ $bbUsername == "1" ]]; then
    echo  "Using github username as bitbucket username"
    bbUsername=$ghUsername
  fi
  echo -n 'Enter your Bitbucket password: '
  read -s password  # -s flag hides password text;
  echo
  echo
}

backupRepo()
{
  cd ~/temp/github/"$repoName" || { echo "Fatal error"; return 1; }
  repoSlug=$(echo "$repoName" | tr '[:upper:]' '[:lower:]')
  if [[ $tStamp == "0" ]]; then { echo -n "Attempting to delete existing bitbucket repostiory..."; httpGet -X DELETE "https://$bbUsername:$password@api.bitbucket.org/1.0/repositories/$bbUsername/$repoSlug" > /dev/null || echo -n -e "Failure!\n"; echo -n -e "Success!\n"; }; fi ## if no timestamp then repo will not be unique we must look to delete old repo
  if [[ $private == "1" ]]; then
    echo -n "Creating private repository for $repoName..."
  else
    echo -n "Creating public repository for $repoName..."
  fi
  if [[ $tStamp == "1" ]]; then ## create the repository with a timestamp appended to repo name
    timestamp=$(date | tr " " _ | tr : _  ) ## we do this because it takes care of changes bitbucket would have made
    if [[ $private == "1" ]]; then # if so we will use --data is_private=true when creating repository
      httpGet --user "$bbUsername":"$password" https://api.bitbucket.org/1.0/repositories/ --data name="$repoName""$timestamp" --data is_private=true > /dev/null || { echo -n -e "Failure!\n"; echo "Error: creating the bitbucket repo failed, most likely due to an incorrect username or password."; return 1; }
    else
      httpGet --user "$bbUsername":"$password" https://api.bitbucket.org/1.0/repositories/ --data name="$repoName""$timestamp" > /dev/null || { echo -n -e "Failure!\n"; echo "Error: creating the bitbucket repo failed, most likely due to an incorrect username or password."; return 1; }
    fi
    echo -n -e "Success!\n"
    echo -n "Setting new remote url..."
    git remote set-url origin "https://$bbUsername:$password@bitbucket.org/$bbUsername/$repoName$timestamp.git" > /dev/null || { echo -n -e "Failure!\n"; return 1;} ## switch the remote over to bitbucket rather than github
  else # we are creating a reoo without a timestamp appended name
    if [[ $private == "1" ]]; then # if so we will use --data is_private=true when creating repository
      httpGet --user "$bbUsername":"$password" https://api.bitbucket.org/1.0/repositories/ --data name="$repoName" --data is_private=true > /dev/null || { echo -n -e "Failure!\n"; echo "Error: creating the bitbucket repo failed, most likely due to an incorrect username or password."; return 1; }
    else
      httpGet --user "$bbUsername":"$password" https://api.bitbucket.org/1.0/repositories/ --data name="$repoName" > /dev/null || { echo -n -e "Failure!\n"; echo "Error: creating the bitbucket repo failed, most likely due to an incorrect username or password."; return 1; }
    fi
    echo -n -e "Success!\n"
    echo -n "Setting new remote url..."
    git remote set-url origin "https://$bbUsername:$password@bitbucket.org/$bbUsername/$repoName.git" > /dev/null || { echo -n -e "Failure!\n"; return 1;} ## switch the remote over to bitbucket rather than github
    echo -n -e "Success!\n"
  fi
  echo -n "Uploading $repoName to bitbucket.."

  git push -q  origin --all > /dev/null && touch ~/temp/github/.BSnippetsHiddenFile || { echo -n -e "Failure!\n"; touch -f ~/temp/github/.BSnippetsBrokenFile; return 1; } & ## pushes al files to github and most of the repo history
  while [[ ! -f ~/temp/github/.BSnippetsHiddenFile ]] ;do if [ -f ~/temp/github/.BSnippetsBrokenFile ];then return 1;fi && echo -n "." && sleep 2; done
  rm -f ~/temp/github/.BSnippetsHiddenFile
  echo -e -n "Success!\n"
  echo -n "Uploading the tags for $repoName.."
  git push -q origin --tags > /dev/null && touch ~/temp/github/.BSnippetsHiddenFile || { echo -n -e "Failure!\n"; touch -f ~/temp/github/.BSnippetsBrokenFile; return 1; } & ## have to push tags here since --tags and --all are mutually exclusive
  while [[ ! -f ~/temp/github/.BSnippetsHiddenFile ]] ;do if [ -f ~/temp/github/.BSnippetsBrokenFile ];then return 1;fi && echo -n "." && sleep 2; done
  rm -f ~/temp/github/.BSnippetsHiddenFile
  echo -e -n "Success!\n"
  rm -rf ~/temp #if we have succesfully backedup the repo we dion't need this anymore and if we do we will recreate it
  echo "Successfully backed up $repoName"
}

## When cloudup is called with no flags
getGitHubRepoInfo()
{
  echo -n 'Enter the name of the repostiory to backup: '
  read repoName
}

## This grabs github user info could be improved upon by checking if user exists
getGitHubUserInfo()
{
  echo -n 'Enter your Github username: '
  read ghUsername
}

## function that handles cloning a repository it uses $ghUsername and $repoName
cloneGitHubRepo()
{
  echo -n "Cloning $repoName.."
  validRepo="false"
  for repo in "${repoNames[@]}"; do
    if [[ $repo == "$repoName" ]];then validRepo="true" && break; fi
  done
  if ! $validRepo;then { echo -n -e "Failure!\n"; echo "Github repostiory is not valid (either incorrect username or repository)"; return 1;}; fi
  mkdir ~/temp
  cd || { echo "Fatal error"; return 1; }
  mkdir ~/temp/github || { echo "Fatal error"; return 1; }
  cd ~/temp/github || { echo "Fatal error"; return 1; }
  git clone -q  https://github.com/"$ghUsername"/"$repoName" && touch ~/temp/github/.BSnippetsHiddenFile || { touch ~/temp/github/.BSnippetsBrokenFile; echo -e -n "Failure!\n"; return 1;} &
  while [[ ! -f ~/temp/github/.BSnippetsHiddenFile ]] ;do if [ -f ~/temp/github/.BSnippetsBrokenFile ];then return 1;fi && echo -n "." && sleep 2; done
  rm -f ~/temp/github/.BSnippetsHiddenFile
  echo -n -e "Success!\n"
}

## Grabs the last 100 updated repos and greps to grab the repository names and puts them in an array called repoNames
getGithubRepoNames()
{
  for pageNumber in {1..100}; do ## iterate through 100 possible pages
    response=$(httpGet "https://api.github.com/users/$ghUsername/repos?sort=updated&per_page=100&page=$pageNumber") ## grab the original response
    if [[ $pageNumber == "1" && ( $(echo "$response" | grep -Eo "Not Found") == "Not Found"  || $response == "[' ']") ]];then  { echo -e -n "Failure!"; echo "Github username is invalid"; return 1;};fi
    repoResponse=$(echo "$response" | grep -Eo '"full_name": "[ a-Z .  \/ \\ 0-9 -- _ ]*' | sed  s/'"full_name": "'/""/g | sed s:"$ghUsername"/:: ) ## extract the repo names from the response
    forkResponse=($(echo "$response" | grep -Eo '"fork": [a-Z]*' | cut -d " " -f 2 | sed  s/"'"//g  )) ## extract the fork status of each repo
    count=0  ## used to iterate through the fork statuses
    if [[ $repoResponse == "" ]]; then break; fi ## will only break if the page is empty
    for repo in $repoResponse; do ## go through each repo
      if [[ $source == "1" ]]; then ## if the user set the source flag
        if [[ ${forkResponse[$count]} == "false" ]]; then repoNames+=("$repo"); fi ## if they are the owner of the repository add it to the list of repoNames
        count=$(( $count + 1 )) ## increment the counter
      else ## the user didnt set the source flag
        repoNames+=("$repo") ## add all repos in repoResponse to repoNames
      fi
    done
  done
}

usage()
{
  cat <<EOF
Cloudup
Description: Backs up a users github repositories to your bitbucket account.
  With no flags cloudup will guide you through backing up a single repository
Usage: cloudup [flags] or cloudup [flags] [listOfGHRepoNamesSplitBySpaces]
  -p  Upload the repositor(y)(ies) as private to bitbucket (must have private
      repo ability on bitbucket)
  -a  Backup all github repositories
  -s  Only backup repositories that you have created (no forks) (only works in
      conjunction with the -a flag)
  -t  Backup the repository with a timestamp added to the repostiory name (will
      always create a new unique bitbucket repo)
  -u  Update Bash-Snippet Tools
  -h  Show the help
  -v  Get the tool version
Examples:
  cloudup
  cloudup -p -a
  cloudup -a -s
  cloudup -t
  cloudup -a -s -t -p
  cloudup -p nameOfRepo1 nameOfRepo2
  cloudup nameOfRepo
  cloudup -a
EOF
}

getConfiguredClient || exit 1


while getopts "tspauvh" opt; do
  case "$opt" in
    \?) echo "Invalid option: -$OPTARG" >&2
        exit 1
        ;;
    s)  source="1"  ;;
    p)  private="1" ;;
    t)  tStamp="1"  ;;
    h)  usage
        exit 0
        ;;
    a)  all="1" ;;
    v)  echo "Version $currentVersion"
        exit 0
        ;;
    u)  checkInternet || exit 1
        update
        exit 0
        ;;
    :)  echo "Option -$OPTARG requires an argument." >&2
        exit 1
        ;;
  esac
done

if [[ $source == "1" && $all == "0" ]]; then { echo "Error: the -s flag only works in conjunction with the -a flag."; exit 1; }; fi ## check if the source flag was used correctly (no need to have source flag when specifying the repositories)
if [[ $configuredClient != "curl" ]]; then { echo "Error: to use cloudup without the -t option curl must be installed"; exit 1; }; fi ## we have to have the ability to delete an unique repo which is possible with curl -X DELETE
if [[ $# == "1" ]]; then # check for keywords
  if [[ $1 == "update" ]]; then
    checkInternet || exit 1
    update
    exit 0
  elif [[ $1 == "help" ]]; then
    usage
    exit 0
  fi
fi

checkInternet || exit 1
if [[ $all == "0" ]]; then
  if [[ ($private == "0" && $tStamp == "0" && $1 != "")]]; then ## checking for an arguments after possible flags if so then run through the arguments (repositories) and back them up
    getGitHubUserInfo || exit 1
    getGithubRepoNames || exit 1
    getBitbucketInfo || exit 1
    for i in "$@"; do ## if private is not on as a flag start rpping through them
      repoName=$i
      echo "Starting to backup $repoName"
      cloneGitHubRepo || exit 1
      backupRepo || { echo "Error: couldnt backup $repoName to bitbucket"; exit 1; }
      echo
    done
    exit 0
  elif [[ ( $private == "0" && $tStamp == "0" &&  $1 == "" ) || ( $private == "1" && $tStamp == "0" && $2 == "" ) || ( $private == "0" && $tStamp == "1" && $2 == "" ) || ( $private == "1" && $tStamp == "1" && $3 == "" )  ]]; then ## check for empty arguments after all possible flags, this will intiate a guided backup
    getGitHubUserInfo || exit 1
    getGithubRepoNames || exit 1
    getGitHubRepoInfo || exit 1
    getBitbucketInfo || exit 1
    echo
    cloneGitHubRepo || exit 1
    backupRepo || { echo "Error: couldnt backup $repoName to bitbucket"; exit 1; }
    exit 0
  else ## flags are set but arguments are also provided
    firstArg=$(( $private + $tStamp + 1 ))
    getGitHubUserInfo || exit 1
    getGithubRepoNames || exit 1
    getBitbucketInfo || exit 1
    for i in "${@:$firstArg}"; do
      repoName=$i
      echo "Starting to backup $repoName"
      cloneGitHubRepo || exit 1
      backupRepo || { echo "Error: couldnt backup $repoName to bitbucket"; exit 1; }
      echo
    done
    exit 0
  fi
else
  getGitHubUserInfo || exit 1
  getGithubRepoNames || exit 1
  getBitbucketInfo || exit 1
  echo
  for repo in "${repoNames[@]}"; do
    repoName=$repo
    echo "Starting to backup $repoName"
    cloneGitHubRepo || exit 1
    backupRepo  || { echo "Error: couldnt backup $repoName to bitbucket"; exit 1; }
    echo
  done
  echo "Successfully backed up all repositories"
  exit 0
fi


================================================
FILE: crypt/crypt
================================================
#!/usr/bin/env bash
# Author: Alexander Epstein https://github.com/alexanderepstein

currentVersion="1.23.0"
state=""
configuredClient=""

checkOpenSSL()
{
  if  ! command -v openssl &>/dev/null; then
    echo "Error: to use this tool openssl must be installed" >&2
    return 1
  else
    return 0
  fi
}

checkInternet()
{
  httpGet github.com > /dev/null 2>&1 || { echo "Error: no active internet connection" >&2; return 1; } # query github with a get request
}

## This function determines which http get tool the system has installed and returns an error if there isnt one
getConfiguredClient()
{
  if  command -v curl &>/dev/null; then
    configuredClient="curl"
  elif command -v wget &>/dev/null; then
    configuredClient="wget"
  elif command -v http &>/dev/null; then
    configuredClient="httpie"
  elif command -v fetch &>/dev/null; then
    configuredClient="fetch"
  else
    echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2
    return 1
  fi
}

## Allows to call the users configured client without if statements everywhere
httpGet()
{
  case "$configuredClient" in
    curl)  curl -A curl -s "$@" ;;
    wget)  wget -qO- "$@" ;;
    httpie) http -b GET "$@" ;;
    fetch) fetch -q "$@" ;;
  esac
}

## uses openssl aes 256 cbc encryption to encrypt file salting it with password designated by user
encrypt()
{
  echo "Encrypting $1..."
  openssl enc -aes-256-cbc -salt -a -in "$1" -out "$2" || { echo "File not found"; return 1; }
  echo "Successfully encrypted"
}

## uses openssl aes 256 cbc decryption to decrypt file
decrypt()
{
  echo "Decrypting $1..."
  openssl enc -aes-256-cbc -d -a -in "$1" -out "$2" || { echo "File not found"; return 1; }
  echo "Successfully decrypted"
}

update()
{
  # Author: Alexander Epstein https://github.com/alexanderepstein
  # Update utility version 2.2.0
  # To test the tool enter in the defualt values that are in the examples for each variable
  repositoryName="Bash-Snippets" #Name of repostiory to be updated ex. Sandman-Lite
  githubUserName="alexanderepstein" #username that hosts the repostiory ex. alexanderepstein
  nameOfInstallFile="install.sh" # change this if the installer file has a different name be sure to include file extension if there is one
  latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option

  if [[ $currentVersion == "" || $repositoryName == "" || $githubUserName == "" || $nameOfInstallFile == "" ]]; then
    echo "Error: update utility has not been configured correctly." >&2
    exit 1
  elif [[ $latestVersion == "" ]]; then
    echo "Error: no active internet connection" >&2
    exit 1
  else
    if [[ "$latestVersion" != "$currentVersion" ]]; then
      echo "Version $latestVersion available"
      echo -n "Do you wish to update $repositoryName [Y/n]: "
      read -r answer
      if [[ "$answer" == [Yy] ]]; then
        cd ~ || { echo 'Update Failed'; exit 1; }
        if [[ -d  ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Permissions Error: try running the update as sudo"; exit 1; } ; fi
        echo -n "Downloading latest version of: $repositoryName."
        git clone -q "https://github.com/$githubUserName/$repositoryName" && touch .BSnippetsHiddenFile || { echo "Failure!"; exit 1; } &
        while [ ! -f .BSnippetsHiddenFile ]; do { echo -n "."; sleep 2; };done
        rm -f .BSnippetsHiddenFile
        echo "Success!"
        cd $repositoryName || { echo 'Update Failed'; exit 1; }
        git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
        chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
        ./$nameOfInstallFile "update" || exit 1
        cd ..
        rm -r -f $repositoryName || { echo "Permissions Error: update succesfull but cannot delete temp files located at ~/$repositoryName delete this directory with sudo"; exit 1; }
      else
        exit 1
      fi
    else
      echo "$repositoryName is already the latest version"
    fi
  fi
}


usage()
{
  cat <<EOF
Crypt
Description: A wrapper around openssl that facilitates encrypting and decrypting files.
Usage: crypt [flag] [inputFile] [outputFile]
  -e  Encrypt the inputFile and store it in the outputFile
  -d  Decrypt the inputFile and store it in the outputFile
  -u  Update Bash-Snippet Tools
  -h  Show the help
  -v  Get the tool version
Examples:
  crypt -e mySecretFile.txt myEncryptedFile.jpg (change filetype so default program is incorrect)
  crypt -d myEncryptedFile.jpg thisIsNowDecrypted.txt (change filetype back so now default program is correct)
EOF
}

checkOpenSSL || exit 1

while getopts "huve:d:" opt; do ## alows for using options in bash
  case $opt in
    e)  ## when trying to encrypt run this
        if [[ $state != "decrypt" ]]; then
          state="encrypt"
        else
          echo "Error: the -d and -e options are mutally exclusive" >&2
          exit 1
        fi
        if [[ $# -ne 3 ]]; then
          echo "Option -e needs and only accepts two arguments [file to encrypt] [output file]" >&2
          exit 1
        fi
        ;;
    \?) echo "Invalid option: -$OPTARG" >&2
        exit 1
        ;;
    d)  ## when trying to decrypt run this
        if [[ $state != "encrypt" ]]; then
          state="decrypt"
        else
          echo "Error: the -e and -d options are mutally exclusive" >&2
          exit 1
        fi
        if [[ $# -ne 3 ]]; then
          echo "Option -d needs and only accepts two arguments [file to decrypt] [output file]" >&2
          exit 1
        fi
        ;;
    u)  getConfiguredClient || exit 1
        checkInternet || exit 1
        update
        exit 0
        ;;
    h)  usage
        exit 0
        ;;
    v)  echo "Version $currentVersion"
        exit 0
        ;;
    :)  ## will run when no arguments are provided to to e or d options
        echo "Option -$OPTARG requires an argument." >&2
        exit 1
        ;;
  esac
done

if [[ $# == 0 ]]; then
  usage
  exit 0
elif [[ $1 == "update" ]]; then
  getConfiguredClient || exit 1
  checkInternet || exit 1
  update || exit 1
  exit 0
elif [[ $1 == "help" ]]; then
  usage
  exit 0
elif [[ $state == "encrypt" ]]; then
  encrypt "$2" "$3" || exit 1
  exit 0
elif [[ $state == "decrypt" ]]; then
  decrypt "$2" "$3" || exit 1
  exit 0
fi


================================================
FILE: cryptocurrency/cryptocurrency
================================================
#!/usr/bin/env bash
# Original Author: Jonas-Taha El Sesiy https://github.com/elsesiy
# Modifications: Alexander Epstein

unset base
unset exchangeTo
old="false"
currentVersion="1.23.0"
unset configuredClient

## This function determines which http get tool the system has installed and returns an error if there isnt one
getConfiguredClient()
{
  if  command -v curl &>/dev/null; then
    configuredClient="curl"
  elif command -v wget &>/dev/null; then
    configuredClient="wget"
  elif command -v http &>/dev/null; then
    configuredClient="httpie"
  elif command -v fetch &>/dev/null; then
    configuredClient="fetch"
  else
    echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2
    return 1
  fi
}

## Allows to call the users configured client without if statements everywhere
httpGet()
{
  case "$configuredClient" in
    curl)  curl -A curl -s "$@" ;;
    wget)  wget -qO- "$@" ;;
    httpie) http -b GET "$@" ;;
    fetch) fetch -q "$@" ;;
  esac
}

## Top 10 cryptocurrencies as base
checkValidCurrency()
{
  if [[ $1 != "BTC" && $1 != "ETH" \
      && $1 != "XRP" && $1 != "LTC" && $1 != "XEM" \
      && $1 != "ETC" && $1 != "DASH" && $1 != "MIOTA" \
      && $1 != "XMR" && $1 != "STRAT" && $1 != "BCH" ]]; then
    echo "1"
  else
    echo "0"
  fi
}

checkTargetCurrency()
{
  if [[ $1 != "AUD" && $1 != "BRL" \
      && $1 != "CAD" && $1 != "CHF" && $1 != "CNY" \
      && $1 != "EUR" && $1 != "GBP" && $1 != "HKD" \
      && $1 != "IDR" && $1 != "INR" && $1 != "JPY" && $1 != "KRW" \
      && $1 != "MXN" && $1 != "RUB" && $1 != "USD" ]]; then
    echo "1"
  else
    echo "0"
  fi
}

## Grabs the base currency from the user and validates it with all the possible currency
## types available on the API and guides user through input (doesnt take in arguments)
getBase()
{
  echo -n "What is the base currency: "
  read -r base
  base=$(echo "$base" | tr /a-z/ /A-Z/)
  if [[ $(checkValidCurrency "$base") == "1"  ]]; then
    unset base
    echo "Invalid base currency"
    getBase
  fi
}

## Checks base currency from the user and validates it with all the possible currency
## types available on the API (requires argument)
checkBase()
{
  base=$1
  base=$(echo "$base" | tr /a-z/ /A-Z/)
  if [[ $(checkValidCurrency "$base") == "1" ]]; then
    unset base
    echo "Invalid base currency"
    exit 1
  fi
}

# Matches the symbol to the appropriate ids regarding the API calling.
transformBase()
{
  case "$base" in
    "ETH") reqId="ethereum" ;;
    "BTC") reqId="bitcoin" ;;
    "XRP") reqId="ripple" ;;
    "LTC") reqId="litecoin" ;;
    "XEM") reqId="nem" ;;
    "ETC") reqId="ethereum-classic" ;;
    "DASH") reqId="dash" ;;
    "MIOTA") reqId="iota" ;;
    "XMR") reqId="monero" ;;
    "STRAT") reqId="stratis" ;;
    "BCH") reqId="bitcoin-cash" ;;
  esac
}

## Grabs the exchange to currency from the user and validates it with all the possible currency
## types available on the API and guides user through input (doesnt take in arguments)
getExchangeTo()
{
  echo -n "What currency to exchange to: "
  read -r exchangeTo
  exchangeTo=$(echo "$exchangeTo" | tr /a-z/ /A-Z/)
  if [[ $(checkTargetCurrency "$exchangeTo") == "1" ]]; then
    echo "Invalid exchange currency"
    unset exchangeTo
    getExchangeTo
  fi
}

## Grabs the exchange to currency from the user and validates it with all the possible currency
## types available on the API (requires arguments)
checkExchangeTo()
{
  exchangeTo=$1
  exchangeTo=$(echo "$exchangeTo" | tr /a-z/ /A-Z/)
  if [[ $(checkTargetCurrency "$exchangeTo") == "1" ]]; then
    echo "Invalid exchange currency"
    unset exchangeTo
    exit 1
  fi
}

## Get the amount that will be exchanged and validate that the user has entered a number (decimals are allowed)
## doesnt take in argument, it guides user through input
getAmount()
{
  echo -n "What is the amount being exchanged: "
  read -r amount
  if [[ ! "$amount" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
    echo "The amount has to be a number"
    unset amount
    getAmount
  fi
}

## Get the amount that will be exchanged
## validate that the user has entered a number (decimals are allowed and requires argument)
checkAmount()
{
  amount=$1
  if [[ ! "$amount" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
    echo "The amount has to be a number"
    unset amount
    exit 1
  fi
}

checkInternet()
{
  httpGet github.com > /dev/null 2>&1 || { echo "Error: no active internet connection" >&2; return 1; } # query github with a get request
}

## Grabs the exchange rate and does the math for converting the currency
convertCurrency()
{
  exchangeTo=$(echo "$exchangeTo" | tr '[:upper:]' '[:lower:]')
  exchangeRate=$(httpGet "https://api.coinmarketcap.com/v1/ticker/$reqId/?convert=$exchangeTo" | grep -Eo "\"price_$exchangeTo\": \"[0-9 .]*" | sed s/"\"price_$exchangeTo\": \""//g) > /dev/null
  if ! command -v bc &>/dev/null; then
    oldRate=$exchangeRate
    exchangeRate=$(echo "$exchangeRate" | grep -Eo "^[0-9]*" )
    amount=$(echo "$amount" | grep -Eo "^[0-9]*" )
    exchangeAmount=$(( $exchangeRate * $amount ))
    exchangeRate=$oldRate
  else
    exchangeAmount=$( echo "$exchangeRate * $amount" | bc )
  fi
  exchangeTo=$(echo "$exchangeTo" | tr '[:lower:]' '[:upper:]')

  cat <<EOF
=========================
| $base to $exchangeTo
| Rate: $exchangeRate
| $base: $amount
| $exchangeTo: $exchangeAmount
=========================
EOF
}

update()
{
  # Author: Alexander Epstein https://github.com/alexanderepstein
  # Update utility version 2.2.0
  # To test the tool enter in the defualt values that are in the examples for each variable
  repositoryName="Bash-Snippets" #Name of repostiory to be updated ex. Sandman-Lite
  githubUserName="alexanderepstein" #username that hosts the repostiory ex. alexanderepstein
  nameOfInstallFile="install.sh" # change this if the installer file has a different name be sure to include file extension if there is one
  latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option

  if [[ $currentVersion == "" || $repositoryName == "" || $githubUserName == "" || $nameOfInstallFile == "" ]]; then
    echo "Error: update utility has not been configured correctly." >&2
    exit 1
  elif [[ $latestVersion == "" ]]; then
    echo "Error: no active internet connection" >&2
    exit 1
  else
    if [[ "$latestVersion" != "$currentVersion" ]]; then
      echo "Version $latestVersion available"
      echo -n "Do you wish to update $repositoryName [Y/n]: "
      read -r answer
      if [[ "$answer" == [Yy] ]]; then
        cd ~ || { echo 'Update Failed'; exit 1; }
        if [[ -d  ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Permissions Error: try running the update as sudo"; exit 1; } ; fi
        echo -n "Downloading latest version of: $repositoryName."
        git clone -q "https://github.com/$githubUserName/$repositoryName" && touch .BSnippetsHiddenFile || { echo "Failure!"; exit 1; } &
        while [ ! -f .BSnippetsHiddenFile ]; do { echo -n "."; sleep 2; };done
        rm -f .BSnippetsHiddenFile
        echo "Success!"
        cd $repositoryName || { echo 'Update Failed'; exit 1; }
        git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
        chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
        ./$nameOfInstallFile "update" || exit 1
        cd ..
        rm -r -f $repositoryName || { echo "Permissions Error: update succesfull but cannot delete temp files located at ~/$repositoryName delete this directory with sudo"; exit 1; }
      else
        exit 1
      fi
    else
      echo "$repositoryName is already the latest version"
    fi
  fi
}

usage()
{
  cat <<EOF
CryptoCurrency

Description: A realtime cryptocurrency converter.
With no flags it will pull down the latest stats of the top 10 cryptos

Usage: cryptocurrency or cryptocurrency [flag] or cryptocurrency [flag] [arg]
   -o Utilize the old functionality of the tool
   -f Fiat currency for conversions
   -u Update Bash-Snippet Tools
   -h Show the help
   -v Get the tool version
EOF
}




while getopts "c:of:uvh" opt; do
  case "$opt" in
    \?) echo "Invalid option: -$OPTARG" >&2
        exit 1
        ;;
    c)
        currency=$OPTARG
        ;;
    h)  usage
        exit 0
        ;;
    f)
        fiat=$OPTARG
        ;;
    o)
        old="true"
        ;;
    v)  echo "Version $currentVersion"
        exit 0
        ;;
    u)  checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here
        update
        exit 0
        ;;
    :)  echo "Option -$OPTARG requires an argument." >&2
        exit 1
        ;;
  esac
done

if $old;then
getConfiguredClient || exit 1
getBase # get base currency
getExchangeTo # get exchange to currency
getAmount # get the amount to be converted
transformBase
convertCurrency # grab the exhange rate and perform the conversion
exit 0
fi



if [[ $1 == "update" ]]; then
  getConfiguredClient || exit 1
  checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here
  update
  exit 0
elif [[ $1 == "help" ]]; then
  usage
  exit 0
fi

getConfiguredClient || exit 1
checkInternet || exit 1
link="rate.sx"
if [[ $fiat =~ [a-zA-Z] ]]; then
  link="$fiat.$link"
fi

if [[ $currency =~ [a-zA-Z] ]]; then
  link="$link/$currency"
fi

httpGet "$link"


================================================
FILE: currency/currency
================================================
#!/usr/bin/env bash
# Author: Alexander Epstein https://github.com/alexanderepstein
# Expanded: Rohit Goswami https://github.com/HaoZeke

unset base
unset exchangeTo
currentVersion="1.23.0"
unset configuredClient
currencyCodes=(AUD BAM BGN BMD BND BRL CAD CHF CNY CZK DJF DKK
  EUR GBP HKD HRK HUF IDR ISK ILS INR
  JPY KRW MXN MYR NOK NZD PAB PHP PLN
  RON RUB SEK SGD THB TRY USD ZAR)

  ## This function determines which http get tool the system has installed and returns an error if there isnt one
  getConfiguredClient()
  {
    if command -v curl &>/dev/null; then
      configuredClient="curl"
    elif command -v wget &>/dev/null; then
      configuredClient="wget"
    elif command -v http &>/dev/null; then
      configuredClient="httpie"
    elif command -v fetch &>/dev/null; then
      configuredClient="fetch"
    else
      echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2
      return 1
    fi
  }

  peggedTo()
  {
    case "$@" in
      BAM)  echo "EUR:1.95583" ;;
      BMD)  echo "USD:1.0" ;;
      BND)  echo "SGD:1.0" ;;
      DJF)  echo "USD:177.721" ;;
      PAB)  echo "USD:1.0" ;;
      *)    echo "1" ;;
    esac
  }

  ## Allows to call the users configured client without if statements everywhere
  httpGet()
  {
    case "$configuredClient" in
      curl)  curl -A curl -s "$@" ;;
      wget)  wget -qO- "$@" ;;
      httpie) http -b GET "$@" ;;
      fetch) fetch -q "$@" ;;
    esac
  }

checkValidCurrency()
{
  if [[ "${currencyCodes[*]}" == *"$(echo "${@}" | tr -d '[:space:]')"* ]]; then
    echo "0"
  else
    echo "1"
  fi
}

## Grabs the base currency from the user and validates it with all the possible currency
## types available on the API and guides user through input (doesnt take in arguments)
getBase()
{
  echo -n "What is the base currency: "
  read -r base
  base=$(echo "$base" | tr /a-z/ /A-Z/)
  if [[ $(checkValidCurrency "$base") == "1" ]]; then
    unset base
    echo "Invalid base currency"
    getBase
  fi
}

## Checks base currency from the user and validates it with all the possible currency
## types available on the API (requires argument)
checkBase()
{
  base=$1
  base=$(echo "$base" | tr /a-z/ /A-Z/)
  if [[ $(checkValidCurrency "$base") == "1" ]]; then
    unset base
    echo "Invalid base currency"
    exit 1
  fi
}

## Grabs the exchange to currency from the user and validates it with all the possible currency
## types available on the API and guides user through input (doesnt take in arguments)
getExchangeTo()
{
  echo -n "What currency to exchange to: "
  read -r exchangeTo
  exchangeTo=$(echo "$exchangeTo" | tr /a-z/ /A-Z/)
  if [[ $(checkValidCurrency "$exchangeTo") == "1" ]]; then
    echo "Invalid exchange currency"
    unset exchangeTo
    getExchangeTo
  fi
}

## Grabs the exchange to currency from the user and validates it with all the possible currency
## types available on the API (requires arguments)
checkExchangeTo()
{
  exchangeTo=$1
  exchangeTo=$(echo "$exchangeTo" | tr /a-z/ /A-Z/)
  if [[ $(checkValidCurrency "$exchangeTo") == "1" ]]; then
    echo "Invalid exchange currency"
    unset exchangeTo
    exit 1
  fi
}

## Get the amount that will be exchanged and validate that the user has entered a number (decimals are allowed)
## doesnt take in argument, it guides user through input
getAmount()
{
  echo -n "What is the amount being exchanged: "
  read -r amount
  if [[ ! "$amount" =~ ^[0-9]+(\.[0-9]+)?$ ]]
  then
    echo "The amount has to be a number"
    unset amount
    getAmount
  fi
}

## Get the amount that will be exchanged
## validate that the user has entered a number (decimals are allowed and requires argument)
checkAmount()
{
  amount=$1
  if [[ ! "$amount" =~ ^[0-9]+(\.[0-9]+)?$ ]]
  then
    echo "The amount has to be a number"
    unset amount
    exit 1
  fi
}

checkInternet()
{
  httpGet github.com > /dev/null 2>&1 || { echo "Error: no active internet connection" >&2; return 1; } # query github with a get request
}

## Grabs the exchange rate and does the math for converting the currency
convertCurrency()
{
  trueBase=$base
  trueTarget=$exchangeTo
  peggedBase=$( peggedTo "$base" )
  peggedTarget=$( peggedTo "$exchangeTo" )
  coef1="1"
  coef2="1"
  if [[ "$peggedBase" =~ ^[A-Z]+:[0-9.]+$ ]]; then
    trueBase=$(echo "$peggedBase" | grep -Eo "^[A-Z]*")
    coef1=$(echo "$peggedBase" | grep -Eo "[0-9.]*$")
  fi
  if [[ "$peggedTarget" =~ ^[A-Z]+:[0-9.]+$ ]]; then
    trueTarget=$(echo "$peggedTarget" | grep -Eo "^[A-Z]*")
    coef2=$(echo "$peggedTarget" | grep -Eo "[0-9.]*$")
  fi
  if [[ "$trueBase" == "$exchangeTo" || "$base" == "$trueTarget" ]]; then
    exchangeRate="1"
  else
    exchangeRate=$(httpGet "https://api.exchangerate-api.com/v4/latest/$trueBase" | grep -Eo "$trueTarget\":[0-9.]*" | grep -Eo "[0-9.]*") > /dev/null
  fi
  if ! command -v bc &>/dev/null; then
    exchangeRate=$(echo "$exchangeRate" | grep -Eo "^[0-9]*" )
    amount=$(echo "$amount" | grep -Eo "^[0-9]*" )
    coef1=$(echo "$coef1" | grep -Eo "^[0-9]*" )
    exchangeRate=$(( exchangeRate / coef1 ))
    exchangeRate=$(( exchangeRate * coef2 ))
    exchangeAmount=$(( exchangeRate * amount ))
  else
    exchangeRate=$( echo "scale=8; $exchangeRate / $coef1" | bc )
    exchangeRate=$( echo "$exchangeRate * $coef2" | bc )
    exchangeAmount=$( echo "$exchangeRate * $amount" | bc )
  fi

  cat <<EOF
=========================
| $base to $exchangeTo
| Rate: $exchangeRate
| $base: $amount
| $exchangeTo: $exchangeAmount
=========================
EOF
}

update()
{
  # Author: Alexander Epstein https://github.com/alexanderepstein
  # Update utility version 2.2.0
  # To test the tool enter in the defualt values that are in the examples for each variable
  repositoryName="Bash-Snippets" #Name of repostiory to be updated ex. Sandman-Lite
  githubUserName="alexanderepstein" #username that hosts the repostiory ex. alexanderepstein
  nameOfInstallFile="install.sh" # change this if the installer file has a different name be sure to include file extension if there is one
  latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option

  if [[ $currentVersion == "" || $repositoryName == "" || $githubUserName == "" || $nameOfInstallFile == "" ]]; then
    echo "Error: update utility has not been configured correctly." >&2
    exit 1
  elif [[ $latestVersion == "" ]]; then
    echo "Error: no active internet connection" >&2
    exit 1
  else
    if [[ "$latestVersion" != "$currentVersion" ]]; then
      echo "Version $latestVersion available"
      echo -n "Do you wish to update $repositoryName [Y/n]: "
      read -r answer
      if [[ "$answer" == [Yy] ]]; then
        cd ~ || { echo 'Update Failed'; exit 1; }
        if [[ -d  ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Permissions Error: try running the update as sudo"; exit 1; } ; fi
        echo -n "Downloading latest version of: $repositoryName."
        git clone -q "https://github.com/$githubUserName/$repositoryName" && touch .BSnippetsHiddenFile || { echo "Failure!"; exit 1; } &
        while [ ! -f .BSnippetsHiddenFile ]; do { echo -n "."; sleep 2; };done
        rm -f .BSnippetsHiddenFile
        echo "Success!"
        cd $repositoryName || { echo 'Update Failed'; exit 1; }
        git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
        chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
        ./$nameOfInstallFile "update" || exit 1
        cd ..
        rm -r -f $repositoryName || { echo "Permissions Error: update succesfull but cannot delete temp files located at ~/$repositoryName delete this directory with sudo"; exit 1; }
      else
        exit 1
      fi
    else
      echo "$repositoryName is already the latest version"
    fi
  fi
}


usage()
{
  cat <<EOF
Currency
Description: A realtime currency converter.
   With no flags it will guide you through the currency exchange
Usage: currency or currency [flag] or currency [base] [exchangeTo] [amount]
  -u  Update Bash-Snippet Tools
  -h  Show the help
  -v  Get the tool version
Supported Currencies:
 ______________________________
| AUD | BGN | BRL | CAD | ZAR |
| CHF | CNY | CZK | DKK |     |
| EUR | GBP | HKD | HRK |     |
| HUF | ISK | IDR | ILS |     |
| INR | JPY | KRW | MXN |     |
| MYR | NOK | NZD | PHP |     |
| PLN | RON | RUB | SEK |     |
| SGD | THB | TRY | USD |     |
 ______________________________
Examples:
  currency EUR USD 12.35
  currency
EOF
}

getConfiguredClient || exit 1


while getopts "uvh" opt; do
  case "$opt" in
    \?) echo "Invalid option: -$OPTARG" >&2
        exit 1
        ;;
    h)  usage
        exit 0
        ;;
    v)  echo "Version $currentVersion"
        exit 0
        ;;
    u)  checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here
        update
        exit 0
        ;;
    :)  echo "Option -$OPTARG requires an argument." >&2
        exit 1
        ;;
  esac
done

if [[ $# == 0 ]]; then
  checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here
  getBase # get base currency
  getExchangeTo # get exchange to currency
  getAmount # get the amount to be converted
  convertCurrency # grab the exhange rate and perform the conversion
  exit 0
elif [[ $# == "1" ]]; then
  if [[ $1 == "update" ]]; then
    update
  elif [[ $1 == "help" ]]; then
    usage
  else
    echo "Not a valid argument"
    usage
    exit 1
  fi
elif [[ $# == "2" ]]; then
  echo "Not a valid argument"
  usage
  exit 1
elif [[ $# == "3" ]]; then
  checkInternet || exit 1 # check if we have a valid internet connection if this isnt true the rest of the script will not work so stop here
  checkBase "$1"
  checkExchangeTo "$2"
  checkAmount "$3"
  convertCurrency
  exit 0
else
  echo "Error: too many arguments."
fi


================================================
FILE: extras/Linux/maps/maps
================================================
#!/usr/bin/env bash
# Author: Alexander Epstein https://github.com/alexanderepstein

currentVersion="1.23.0"
configuredClient=""
directionsFlag="0"
directionsMapFlag="0"
staticMapFlag="0"
source ~/.bash_profile 2> /dev/null ## allows grabbing enviornment variable
MAPQUEST_API_KEY=$MAPQUEST_API_KEY
if [ -d ~/temp ]; then rm -rf ~/temp; fi

## This function determines which http get tool the system has installed and returns an error if there isnt one
getConfiguredClient()
{
  if  command -v curl &>/dev/null; then
    configuredClient="curl"
  elif command -v wget &>/dev/null; then
    configuredClient="wget"
  elif command -v http &>/dev/null; then
    configuredClient="httpie"
  elif command -v fetch &>/dev/null; then
    configuredClient="fetch"
  else
    echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2
    return 1
  fi
}

## Allows to call the users configured client without if statements everywhere
httpGet()
{
  case "$configuredClient" in
    curl)  curl -A curl -s "$@" ;;
    wget)  wget -qO- "$@" ;;
    httpie) http -b GET "$@" ;;
    fetch) fetch -q "$@" ;;
  esac
}

checkInternet()
{
  httpGet github.com > /dev/null 2>&1 || { echo "Error: no active internet connection" >&2; return 1; } # query github with a get request
}

update()
{
  # Author: Alexander Epstein https://github.com/alexanderepstein
  # Update utility version 2.2.0
  # To test the tool enter in the defualt values that are in the examples for each variable
  repositoryName="Bash-Snippets" #Name of repostiory to be updated ex. Sandman-Lite
  githubUserName="alexanderepstein" #username that hosts the repostiory ex. alexanderepstein
  nameOfInstallFile="install.sh" # change this if the installer file has a different name be sure to include file extension if there is one
  latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option

  if [[ $currentVersion == "" || $repositoryName == "" || $githubUserName == "" || $nameOfInstallFile == "" ]]; then
    echo "Error: update utility has not been configured correctly." >&2
    exit 1
  elif [[ $latestVersion == "" ]]; then
    echo "Error: no active internet connection" >&2
    exit 1
  else
    if [[ "$latestVersion" != "$currentVersion" ]]; then
      echo "Version $latestVersion available"
      echo -n "Do you wish to update $repositoryName [Y/n]: "
      read -r answer
      if [[ "$answer" == [Yy] ]]; then
        cd ~ || { echo 'Update Failed'; exit 1; }
        if [[ -d  ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Permissions Error: try running the update as sudo"; exit 1; } ; fi
        echo -n "Downloading latest version of: $repositoryName."
        git clone -q "https://github.com/$githubUserName/$repositoryName" && touch .BSnippetsHiddenFile || { echo "Failure!"; exit 1; } &
        while [ ! -f .BSnippetsHiddenFile ]; do { echo -n "."; sleep 2; };done
        rm -f .BSnippetsHiddenFile
        echo "Success!"
        cd $repositoryName || { echo 'Update Failed'; exit 1; }
        git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
        chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
        ./$nameOfInstallFile "update" || exit 1
        cd ..
        rm -r -f $repositoryName || { echo "Permissions Error: update succesfull but cannot delete temp files located at ~/$repositoryName delete this directory with sudo"; exit 1; }
      else
        exit 1
      fi
    else
      echo "$repositoryName is already the latest version"
    fi
  fi
}


getDirections()
{
  response=$(httpGet "https://www.mapquestapi.com/directions/v2/route?key=$MAPQUEST_API_KEY&from=$1&to=$2&outFormat=json&ambiguities=ignore&routeType=fastest&doReverseGeocode=false&enhancedNarrative=false&avoidTimedConditions=false")
  firstDirection=$(echo "$response" | grep -Eo "origNarrative\":\"[a-z A-Z -./0-9]*" | grep -Eo "[^origNarrative\":][a-z A-Z -./0-9]*")
  tempDirections=($(echo "$response" | grep -Eo "\"narrative\":\"[a-z A-Z -./0-9]*"))
  distances=($(echo "$response" | grep -Eo "distance\":[0-9]*[.][0-9]*" | grep -Eo "[^distance\":][0-9]*[.][0-9]*"))
  totalDist=${distances[0]}
  count="0"
  count="-1"
  temp=${tempDirections[0]}
  for direct in "${tempDirections[@]}"; do
    if [[ $(echo "$direct" | grep -Eo "narrative") == "narrative" ]]; then
      count=$(echo $count + 1 | bc)
      directions[$count]=$temp
      temp=$(echo "$direct" | grep -Eo "[^\"narrative:\"][a-z A-Z 0-9./]*" | sed s/'","iconUrl"'//g)
    else
      temp="$temp $direct"
    fi
  done
  #for distance in $tempDistances
  directions[0]=$firstDirection
}

getDirectionsMap()
{
  echo "Generating route map from $unformattedFromLocation to $unformattedToLocation"
  mkdir ~/temp || return 1
  httpGet "https://www.mapquestapi.com/staticmap/v5/map?start=$1&end=$2&size=600,400@2x&key=$MAPQUEST_API_KEY" >> ~/temp/routeImage.png || return 1
  if [[ $(uname -s) == "Linux" ]]; then
    display ~/temp/routeImage.png > /dev/null || return 1
  elif [[ $(uname -s) == "Darwin" ]]; then
    open ~/temp/routeImage.png > /dev/null
  fi
  rm -rf ~/temp > /dev/null
}

printDirections()
{
  echo
  echo "From $unformattedFromLocation to $unformattedToLocation ($totalDist mi)"
  echo "==================================================="
  count=0
  for direct in "${directions[@]}"; do
    if [ $count -ne 0 ]; then echo -n "$(echo $count | bc)). "; fi
    if [[ $direct != "" ]]; then # sometimes original Narrative is blank
      direct="$direct (${distances[$(echo $count + 1 | bc)]} mi)"
      if [ $count -ne 0 ]; then echo "$direct"; fi
      count=$(echo $count + 1 | bc)
    fi
  done
  echo "Welcome to $unformattedToLocation"
  echo "==================================================="
  echo
}

getLocations()
{
  echo -n "Enter your starting location: "
  read fromLocation
  echo -n "Enter your destination: "
  read toLocation
  unformattedFromLocation=$fromLocation
  unformattedToLocation=$toLocation
  fromLocation=$(echo "$fromLocation" | sed s/','/"+"/g | sed  s/' '/"+"/g )
  toLocation=$(echo "$toLocation" | sed s/','/"+"/g | sed  s/' '/"+"/g )
}

checkImagemagick()
{
  if [[ $(uname -s) == "Linux" ]]; then
    if ! command -v display &>/dev/null; then
      echo "Error: you need to install imagemagick to use map features." &>2
      return 1
    else
      return 0
    fi
  else
    return 0
  fi
}

getMapLocation()
{
  echo -n "Enter the city or address you want to generate a map for: "
  read mapLocation
  echo "Generating static map for $mapLocation"
  mapLocation=$(echo "$mapLocation" | sed  s/','/"+"/g | sed  s/' '/"+"/g )
}

getStaticMap()
{
  mkdir ~/temp || return 1
  httpGet "https://www.mapquestapi.com/staticmap/v5/map?key=$MAPQUEST_API_KEY&center=$1&zoom=15&type=hyb&size=600,400@2x" >> ~/temp/mapImage.png || return 1
  if [[ $(uname -s) == "Linux" ]]; then
    display ~/temp/mapImage.png > /dev/null || return 1
  elif [[ $(uname -s) == "Darwin" ]]; then
    open ~/temp/mapImage.png > /dev/null || return 1
  fi
  rm -rf ~/temp > /dev/null || return 1
}

usage()
{
  cat <<EOF
Maps
Description: Get directions between locations, generate static maps of locations, and generate route maps for directions.
Usage: maps [flags]
    -u  Update Bash-Snippet Tools
    -d  Get directions from a location to a destination
    -r  Generate route map (must be used with the -d flag)
    -m  Generate static map
          * By itself will ask for a location to generate a map
          * In conjunction with the -d flag will generate maps for the start location and the destination
    -h  Show the help
    -v  Get the tool version
Examples:
    maps -d
    maps -d -r -m
    maps -m
    maps -d -m
EOF
}

getConfiguredClient || exit 1

## getDirections Denver Boulder || exit 1
## printDirections Denver Boulder || exit 1
## getDirectionsMap Denver Boulder || exit 1
## getStaticMap Paramus || exit 1

while getopts "drmuvh" opt; do
  case "$opt" in
    \?) echo "Invalid option: -$OPTARG" >&2
        exit 1
        ;;
    h)  usage
        exit 0
        ;;
    d)  directionsFlag="1" ;;
    m)  staticMapFlag="1" ;;
    r)  directionsMapFlag="1" ;;
    v)  echo "Version $currentVersion"
        exit 0
        ;;
    u)  checkInternet || exit 1
        update
        exit 0
        ;;
    :)  echo "Option -$OPTARG requires an argument." >&2
        exit 1
        ;;
  esac
done

if [[ $directionsMapFlag == "1" && $directionsFlag == "0" ]]; then { echo "Error the -r flag only works in conjunction with the -d flag."; exit 1; }; fi

if [[ $# == 0 ]]; then
  usage
  exit 0
elif [[ $# == "1" ]]; then
  if [[ $1 == "update" ]]; then
    checkInternet || exit 1
    update
    exit 0
  elif [[ $1 == "help" ]]; then
    usage
    exit 0
  fi
fi
checkInternet || exit 1
if [[ $directionsFlag == "0" && $staticMapFlag == "1" ]]; then
  checkImagemagick || exit 1
  getMapLocation || exit 1
  getStaticMap "$mapLocation" || exit 1
elif [[ $directionsFlag == "1" ]]; then
  getLocations || exit 1
  getDirections "$fromLocation" "$toLocation" || exit 1
  printDirections "$fromLocation" "$toLocation" || exit 1
  checkImagemagick || exit 1
  if [[ $directionsMapFlag == "1" ]]; then getDirectionsMap "$fromLocation" "$toLocation" || exit 1; fi
  if [[ $staticMapFlag = "1" ]]; then
    echo "Generating static map for $unformattedFromLocation" && getStaticMap "$fromLocation" || exit 1
    echo "Generating static map for $unformattedToLocation" && getStaticMap "$toLocation"  || exit 1
  fi
fi


================================================
FILE: extras/README.md
================================================
<div align="center">

# Bash-Snippets Extras

</div>

## Why are these here?

If there is a tool in this folder that means it is not part of the main installer pipeline

It was removed or never made it to the pipeline only for two possible reasons:
* It is platform dependent meaning it doesn't work the same on all \*nix machines
* It had many dependencies that aren't native to all forms of \*nix

## Can I install these & is it safe
Yes you can install these, only tools that are considered to be fully functional will make it here. Just make sure you only install extras for the correct platform and if they require dependencies make sure to install them (although the tool itself should remind you of this)

## Install
To install the tool just ```cd``` into the folder of the tool and run ```cp toolNameGoesHere /usr/local/bin || echo "Run the install as sudo" ```

## Uninstall
To uninstall the tool just run ```rm -f /usr/local/bin/toolNameGoesHere || echo "Run the uninstall as sudo" ```. Notice that the recursive flag is not set so even if you accidentally go to remove ```/usr/local/bin``` the flags will not let you delete the directory.

## Platform Specific Tools

### Linux

#### Maps
* Provides driving directions from a certain location to another
* Generates a route map of the trip and displays it
* Generates maps of the from and to locations and displays them
* The map functions require imagemagick to be installed

### OSX
None for now

## Dependent tools
None for now

## 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.


================================================
FILE: geo/geo
================================================
#!/usr/bin/env bash

# Bash utility for getting specific network info
# Author: Jake Meyer
# Github: https://github.com/jakewmeyer

currentVersion="1.23.0"
configuredClient=""

## This function determines which http get tool the system has installed and returns an error if there isnt one
getConfiguredClient()
{
  if  command -v curl &>/dev/null; then
    configuredClient="curl"
  elif command -v wget &>/dev/null; then
    configuredClient="wget"
  elif command -v http &>/dev/null; then
    configuredClient="httpie"
  elif command -v fetch &>/dev/null; then
    configuredClient="fetch"
  else
    echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2
    return 1
  fi
}

## Allows to call the users configured client without if statements everywhere
httpGet()
{
  case "$configuredClient" in
    curl)  curl -A curl -s "$@" ;;
    wget)  wget -qO- "$@" ;;
    httpie) http -b GET "$@" ;;
    fetch) fetch -q "$@" ;;
  esac
}

# Parse arguments passed + help formatting
usage() {
  cat <<EOF
Geo
Description: Provides quick access for wan, lan, router, dns, mac, and ip geolocation data
Usage: geo [flag]
  -w  Returns WAN IP
  -l  Returns LAN IP(s)
  -r  Returns Router IP
  -d  Returns DNS Nameserver
  -m  Returns MAC address for interface. Ex. eth0
  -g  Returns Current IP Geodata
Examples:
  geo -g
  geo -wlrdgm eth0
Custom Geo Output => [all] [query] [city] [region] [country] [zip] [isp]
Example: geo -a 8.8.8.8 -o city,zip,isp
  -o [options]  Returns Specific Geodata
  -a [address]  For specific IP in -s
  -v            Returns Version
  -h            Returns Help Screen
  -u            Updates Bash-Snippets
EOF
    exit
}

# Displays version number
version() {
  echo "Version $currentVersion"
}

# Fetches WAN IP address
wan_search() {
  httpGet https://api.ipify.org
}

# Fetches current LAN IP address
lan_search() {
  if [ "$(uname)" = "Darwin" ]; then
    ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
  elif [ "$(uname -s)" = "Linux" ]; then
    ip addr show | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
  else
    echo "OS not supported"
    exit 1
  fi
}

# Fetches Router ip address
router_search() {
  if [ "$(uname)" = "Darwin" ]; then
    netstat -rn | grep default | head -1 | awk '{print$2}'
  elif [ "$(uname -s)" = "Linux" ]; then
    ip route | grep ^default'\s'via | head -1 | awk '{print$3}'
  else
    echo "OS not supported"
    exit 1
  fi
}

# Fetches DNS nameserver
dns_search() {
  if [ "$(uname)" = "Darwin" ]; then
    grep -i nameserver /etc/resolv.conf |head -n1|cut -d ' ' -f2
  elif [ "$(uname -s)" = "Linux" ]; then
    cat /etc/resolv.conf | grep -i ^nameserver | cut -d ' ' -f2
  else
    echo "OS not supported"
    exit 1
  fi
}

# Fetches MAC address of
mac_search() {
  if [ "$(uname)" = "Darwin" ]; then
    ifconfig "$MAC" | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'
  elif [ "$(uname -s)" = "Linux" ]; then
    ip addr show "$MAC" | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | grep -v ff:
  else
    echo "OS not supported"
    exit 1
  fi
}

# Fetches current geodata based on ip
geodata_search() {
  httpGet "http://ip-api.com/line/?fields=query,city,region,country,zip,isp"
}

# Fetches specific geodata based on args
specific_geo() {
  if [ "$OPTIONS" = "all" ]; then
    httpGet "http://ip-api.com/line/${ADDRESS}?fields=query,city,region,country,zip,isp"
  else
    httpGet "http://ip-api.com/line/${ADDRESS}?fields=${OPTIONS}"
  fi
}

update()
{
  # Author: Alexander Epstein https://github.com/alexanderepstein
  # Update utility version 2.2.0
  # To test the tool enter in the defualt values that are in the examples for each variable
  repositoryName="Bash-Snippets" #Name of repostiory to be updated ex. Sandman-Lite
  githubUserName="alexanderepstein" #username that hosts the repostiory ex. alexanderepstein
  nameOfInstallFile="install.sh" # change this if the installer file has a different name be sure to include file extension if there is one
  latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option

  if [[ $currentVersion == "" || $repositoryName == "" || $githubUserName == "" || $nameOfInstallFile == "" ]]; then
    echo "Error: update utility has not been configured correctly." >&2
    exit 1
  elif [[ $latestVersion == "" ]]; then
    echo "Error: no active internet connection" >&2
    exit 1
  else
    if [[ "$latestVersion" != "$currentVersion" ]]; then
      echo "Version $latestVersion available"
      echo -n "Do you wish to update $repositoryName [Y/n]: "
      read -r answer
      if [[ "$answer" == [Yy] ]]; then
        cd ~ || { echo 'Update Failed'; exit 1; }
        if [[ -d  ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Permissions Error: try running the update as sudo"; exit 1; } ; fi
        echo -n "Downloading latest version of: $repositoryName."
        git clone -q "https://github.com/$githubUserName/$repositoryName" && touch .BSnippetsHiddenFile || { echo "Failure!"; exit 1; } &
        while [ ! -f .BSnippetsHiddenFile ]; do { echo -n "."; sleep 2; };done
        rm -f .BSnippetsHiddenFile
        echo "Success!"
        cd $repositoryName || { echo 'Update Failed'; exit 1; }
        git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
        chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
        ./$nameOfInstallFile "update" || exit 1
        cd ..
        rm -r -f $repositoryName || { echo "Permissions Error: update succesfull but cannot delete temp files located at ~/$repositoryName delete this directory with sudo"; exit 1; }
      else
        exit 1
      fi
    else
      echo "$repositoryName is already the latest version"
    fi
  fi
}

checkInternet() {
  httpGet github.com > /dev/null 2>&1 || { echo "Error: no active internet connection" >&2; return 1; } # query github with a get request
}

# Option parsing "controller"
optspec="uwlrdm:go:a:vh*:"
while getopts "$optspec" optchar; do
  case "${optchar}" in
    w) getConfiguredClient && checkInternet && wan_search || exit 1 ;;
    l) lan_search ;;
    r) router_search ;;
    d) dns_search ;;
    m) MAC=$OPTARG mac_search ;;
    g) getConfiguredClient && checkInternet && geodata_search || exit 1 ;;
    a) ADDRESS=$OPTARG ;;
    o) getConfiguredClient && checkInternet && OPTIONS=$OPTARG specific_geo || exit 1 ;;
    v) version ;;
    h) usage ;;
    u) getConfiguredClient && checkInternet && update || exit 1 ;;
    *) usage ;;
  esac
done

# Makes geo command default to help screen for usability
if [ $# -eq 0 ]; then
  usage
  exit 0
elif [[ $1 == "update" ]]; then
  getConfiguredClient && checkInternet && update || exit 1
elif [[ $1 == "help" ]]; then
  usage
  exit 0
fi


================================================
FILE: gist/README.md
================================================
# gist - Manage your gist like a pro

All your notes, scripts, config files and snippets deserve version control and tagging!  
`gist` is a simple bash script for gist management, lite and dependency-free!  
Use it to boost your coding workflow.

- [Getting Started](#Getting-Started)
- [Basic Commands](#Basic-Commands)
    - [Update and clone gists from Github](#Update-and-clone-gists-from-Github)
    - [List your gists](#List-your-gists)
    - [Create a new gist](#Create-a-new-gist)
    - [Modify a gist](#Modify-a-gist)
    - [Clean unnecessary local repos](#Clean-unnecessary-local-repos)
- [Configuration](#Configuration)
- [Filter gists](#Filter-gists)
    - [Filter by tags](#Filter-by-tags)
    - [Filter by file languages](#Filter-by-file-languages)
    - [Filter by pattern](#Filter-by-pattern)
- [Tips](#Tips)
    - [Filter gists with pipe](#Filter-gists-with-pipe)
    - [Git Workflow](#Git-Workflow)
    - [Useful action for gist repo](#Useful-action-for-gist-repo)
    - [Suppress action](#Suppress-action)
    - [Suppress hint](#Suppress-hint)

## Getting Started
```bash
# Install script
curl -fsSL https://raw.githubusercontent.com/typebrook/gist/master/install.sh | bash
# Fetch your gists and clone them into ~/gist as git repos
gist fetch
# List your gists
gist
# Create a new gist
gist new
# Create private gist with files 'foo' and 'bar'
gist new -p foo bar
# Check information of your third gist
gist detail 3
# Get the path and cd to cloned repo with subshell
gist 3
# List your gists with tags instead of URL
gist tag
# Add tags to your third gist
gist tag 3
# Update the description of your third gist
gist edit 3
# Push changes in your third gist to the remote repo
gist push 3
# Delete gists with indices 3, 4 and 5
gist delete 3 4 5
# Or use Brace Expansion
gist delete {3..5}
# Export your third gist as a new Github repo with web page
gist github 3
# For more detail, read the helper message
gist help
```

## Basic Commands
### Update and clone gists from Github
Run `gist fetch` to fetch your all gists with Github API and keep short information for each gist in a index file inside a given folder. (default to `~/gist/index`)
- Automatically Clone/Pull each gist with git into a given folder. (default to `~/gist/`)
- Run `gist fetch star` to fetch you starred gist
- If token is not being set, then you cannot fetch your private gist

### List your gists
Run `gist` to read index file (default to `~/gist/index`) and list your gists with the following format:
```
<index> <gist-URL> <files-number> <comments-number> <description>
```

like the following:

![](https://i.imgur.com/ZCLGZLW.png)

- Use `gist star` to show your starred gists
- Use `gist all` to show your and starred gists
- Index with prefix `s` is a starred gist, index with prefix `p` is a private gist
- There are colorful hints for each gist in the following cases:
    - **working** 
      Some changes are made locally but not yet do `git commit`, or you are not in `master` branch
    - **ahead**
      Your local **HEAD** is yet to be applied to upstream
    - **outdated**
      Your local **HEAD** is differs from the last fetched gists, do `gist fetch` to refresh index file and pull if needed
    
### Create a new gist
Run `gist new` to create a new gist
- You can create a new gist with 3 different ways:
    1. type the content by hand, run `gist new`
    2. use existing files, run `gist new <file1> <file2>...`
    3. from STDIN, like `<command> | gist new`
- You can specify filename with `--file`, and description with `--desc`, like `gist new --file new --desc 'a new gist'`
- If you don't specify filename or description, a prompt will shows up!

### Modify a gist
Run `gist <INDEX>` to enter sub-shell with working directory of the given gist index (by default action). You can do some trick with custom action.(See [action](#action) and [Tips](#Tips))

Since now a gist is a local cloned repo, it is your business to do git commit and git push. Use `gist push <INDEX>` is not recommended.

### Clean unnecessary local repos
Say you delete gists with command `gist delete <index-of-gist>...`, the local git repositories are still at `~/gist/`. Run `gist clean` to move them into `/tmp`
    
## Configuration
`gist` stores your configuraion inside `~/.config/gist.conf`, with `<key>=<value>` format for each line. And just do `source ~/.config/gist.conf` at runtime. 

`~/.config/gist.conf` is created automatically when you run `gist` at the first time, it only allows current user to read and write (permission 600).

Valid keys are [`user`](#user), [`token`](#token), [`folder`](#folder), [`auto_sync`](#auto_sync), [`action`](#action), [`EDITOR`](#EDITOR), [`protocol`](#protocol) and [`show_untagged`](#show_untagged). Use the following commands to set value:
``` bash
# Set key with a given value
gist config <key> <value>

# Remove current value from a key
gist config <key>

# Or just modify ~/.config/gist.conf directly
gist config
```
Each key is for the following use cases:

### user
Your Github username

If you use command which needs username and `user` is not being set, a prompt will shows up and requires your username and API [`token`](#token). 

Use `gist config user <your-github-username>` to set the value if needed.

### token
Your Github API token for the given username. It's scope should be with `gist`.

If you use command which needs it and it is not being set, A prompt will shows up and requires it. You can choose going to web page to create a new token, or just input an existing one directly.

Use `gist config toekn <your-github-api-token>` to set the value if needed.

### folder 
**[Optional]** The folder you stores index file and git repos for each your gists and starred gists. Default to `~/gist/` if not being set.

Use `gist config folder <prefered-directory>` to set the value if needed.

### auto_sync
**[Optional]** Automatically clone/update your gists and starred gists as git repos when doing `gist fetch`. Default to be `true`.

Use `gist config auto_sync false` to disable this feature.

### action
**[Optional]** A custom action is performed when you do `gist <INDEX>` (like `gist 3` for your third gist). If is being set, `gist` will `cd` to the cloned repo, and just simply use `eval` to perform action.

For example, you can use the following command to
**print the filename and its content of all files inside the given gist**
```bash
gist config action 'tail -n +1 *'
```

If action is not being set, then a default action will be performed:
```bash
# Enter sub-shell with current shell or bash
${SHELL:-bash}
```

Also, if you run `gist <INDEX>` with `--no-action`(or `-n`), then action would be ignored.

### EDITOR
**[Optional]** Editor to open `~/.config/gist.conf`. Default to be `vi` . 

For example, use `gist config EDITOR code` to use VSCode instead.

### protocol
**[Optional]** Protocol to clone git repo. Default to be `HTTPS`

Valid values are:
- https
- ssh

For example, use `gist config protocol ssh` to use SSH protocol instead.

### show_untagged
**[Optional]** Whether to show untagged gists when using [`gist tag`](#List-gists-with-tags). Default to be `true`

Use `gist config show_untagged false` to disable this feature.

## Filter gists
### Filter by tags
`gist` treats **trailing hashtags** inside gist description as tags. For example, if a description is:
```
[Title] this is description #tag1 #tag2
```
When [`gist`](#List-your-gists) is performed, it only display description with part: `[Title] this is description`, and treat the trailing hashtags as tags of a gist.

#### Tag a gist
You can use the following command to add/remove tags:
```bash
# tag your third gist
gist tag 3
```
After it is finished, `gist` just calls Github API to apply new description onto the given gist.

#### List gists with tags
Use sub-command `tag` to list gists with tags instead of URLs.
```bash
# show tags for your gists
gist tag
```
![](https://i.imgur.com/6IqxQjA.png)

#### Filter gists with tags
If arguments after `gist tag` are not indices of gist, then they will be treated as tag values. The output will be a list of gists with those tags
```bash
# Filter gists with tag1 and tag2
gist tag tag1 tag2
```
![](https://i.imgur.com/rchqMN1.png)

You can also use regex pattern as tag value:
```bash
# only show tagged gists
gist tag .+
```

#### Show existing tags
Use sub-command `tags` to show existing tags and pinned tags. They are sorted alphabetically.
```bash
gist tags
```
![](https://i.imgur.com/PuwmaK4.png)

#### Pin/Unpin tags
Say you are working with gists with some meaningful tags. You can use sub-command `pin` to pin them, and filter your gists with pinned tags
```bash
# Pin tag1 and tag2, If a tag is pinned, then unpin it
gist pin tag1 tag2
# Disply gists with pinned tags
gist pin
```
![](https://i.imgur.com/LuEjNry.png)

### Filter by pattern
You can search gists with pattern in description, filename or file contents with sub-command `grep`
```bash
# search by a simple string
gist grep string
# search by a pattern(heading string in a line)
gist grep '^string'
```

### Filter by file languages
#### List gists with languages
You can use sub-command `lan` to List gists with file languages instead of URLs.
```bash
# show languages for your gists
gist lan
```
![](https://i.imgur.com/QAS7ZRE.png)

#### Filter gists with languages
```bash
# Filter gists with files in Shell and Yaml format
gist lan LANGUAGE1 LANGUAGE2...
```
![](https://i.imgur.com/tKI5KND.png)

### Index Range
You can specify the range of indices, works both on your owned gists and starred gists.
```bash
# only show gists with index 5 to 10
gist 5-10
# show gists from index 5
gist 5-
# show starred gists only to index s10
gist -s10
# only show gists with index 1 to 20
seq 20 | gist
```

## Tips

### Filter gists with pipe
If `STDIN` is from a pipe, then `gist` will only process gists with **indices in the first column**. So, you can concatenate the output of each sub-command.
```bash
# only show gists with index 1 to 20
seq 20 | gist
# List starred gist with Yaml file
gist star | gist lan Yaml
# Only List gists with tag1, pattern1 in description/filenames/contents and contains shell script
gist tag tag1 | gist grep pattern1 | gist lan SHELL
```

### Git Workflow
Each gist is a git repository.  
Although there are some limits on `git push`, like sub-directory is prohibited. But guess what?
1. Push another branch to `github.com` is allowed.
2. Push tags is also allowed. And like repos in  `github.com`,  you can get source file by tag with URL:
   ```
   https://codeload.github.com/gist/<gist_id>/tar.gz/<tag_name>
   ```
 
### Useful action for gist repo
I strongly recommend using [`tig`](https://github.com/jonas/tig) as your custom [action](#action). It is the most powerful git CLI tool as far as I know, and also easy to get in most of the Linux distros or Homebrew for mac. Give it a try!

If [`tig`](https://github.com/jonas/tig) is installed, run the following command to configure it as custom action:

```bash
gist config action 'tig -all'
```
`tig` interface for history diagram:
![](https://i.imgur.com/ju37MgW.png)


### Suppress action
If [`action`](#action) is not being set, you will enter sub-shell by default. If you want suppress it and do not want to type `--no-action` every time, just use command `ture` to do nothing.
```
gist config action 'true'
```
 
### Suppress hint
There are several environment variables or arguments can suppress hint or user confirm, like:
```bash
# List gists without hint
hint=false gist

# Just print the repo path with a given index
gist 3 --no-action
# Or shorter argument
gist 3 -n

# Delete your third gist without confirmation
gist delete 3 --force
```


================================================
FILE: gist/gist
================================================
#!/usr/bin/env bash
#
# Author: Hsieh Chin Fan (typebrook) <typebrook@gmail.com>
# License: MIT
# https://gist.github.com/typebrook/b0d2e7e67aa50298fdf8111ae7466b56
#
# --
# gist
# Description: Manage your gists with git and Github API v3
# Usage: gist [command] [<args>]
#
#   [star|s|all|a]                List your gists, use 'star' or 's' for your starred gists,
#                                 'all' or 'a' for both your and starred gists. Format for each line is:
#                                 <INDEX> <URL> <FILE_NUM> <COMMENT_NUM> <DESCRIPTION>
#   fetch,  f [star|s]            Update the local list of your gists, 'star' for your starred gists
#   <INDEX> [-n|--no-action]         Show the path of local gist repo and do custom actions(enter sub-shell by default)
#   new,    n [-d |--desc <description>] [-p] <FILE>...      create a new gist with files
#   new,    n [-d |--desc <description>] [-p] [-f|--file <FILE_NAME>] create a new gist from STDIN
#   grep,   g <PATTERN>           Grep gists 
Download .txt
gitextract_7784tk_y/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── stale.yml
│   └── workflows/
│       └── shellcheck.yml
├── .gitignore
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── bak2dvd/
│   └── bak2dvd
├── bash-snippets/
│   └── bash-snippets
├── bash-snippets.1
├── bash-snippets.1.html
├── bash-snippets.1.ronn
├── changelog.md
├── cheat/
│   └── cheat
├── cloudup/
│   └── cloudup
├── crypt/
│   └── crypt
├── cryptocurrency/
│   └── cryptocurrency
├── currency/
│   └── currency
├── extras/
│   ├── Linux/
│   │   └── maps/
│   │       └── maps
│   └── README.md
├── geo/
│   └── geo
├── gist/
│   ├── README.md
│   └── gist
├── install.sh
├── lyrics/
│   └── lyrics
├── meme/
│   └── meme
├── movies/
│   ├── movies
│   └── tmdb
├── newton/
│   └── newton
├── pwned/
│   └── pwned
├── qrify/
│   └── qrify
├── short/
│   └── short
├── siteciphers/
│   └── siteciphers
├── skeleton
├── skeleton.bats
├── stocks/
│   └── stocks
├── taste/
│   └── taste
├── tests/
│   ├── bak2dvd.bats
│   ├── cheat.bats
│   ├── cloudup.bats
│   ├── crypt.bats
│   ├── cryptocurrency.bats
│   ├── currency.bats
│   ├── geo.bats
│   ├── gist.bats
│   ├── meme.bats
│   ├── movies.bats
│   ├── newton.bats
│   ├── qrify.bats
│   ├── short.bats
│   ├── siteciphers.bats
│   ├── stocks.bats
│   ├── taste.bats
│   ├── todo.bats
│   ├── transfer.bats
│   ├── weather.bats
│   └── ytview.bats
├── todo/
│   └── todo
├── transfer/
│   └── transfer
├── uninstall.sh
├── weather/
│   └── weather
└── ytview/
    └── ytview
Condensed preview — 66 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (412K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 74,
    "preview": "# These are supported funding model platforms\n\ngithub: [alexanderepstein]\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 282,
    "preview": "**Issue Label:**\n* [ ] Bug\n* [ ] New feature\n* [ ] Enhancement\n* [ ] New component\n\n**Description:**\n\n\n\n### If its a bug"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 487,
    "preview": "**Pull Request Label:**\n* [ ] Bug\n* [ ] New feature\n* [ ] Enhancement\n* [ ] New component\n* [ ] Typo\n\n**Pull Request Che"
  },
  {
    "path": ".github/stale.yml",
    "chars": 762,
    "preview": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 175\n# Number of days of inactivity before a"
  },
  {
    "path": ".github/workflows/shellcheck.yml",
    "chars": 198,
    "preview": "on: push\njobs:\n  shellcheck:\n    name: Shellcheck\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v"
  },
  {
    "path": ".gitignore",
    "chars": 45,
    "preview": "# IDE\n.idea\n\n# Meta files\n.DS_Store\nThumbs.db"
  },
  {
    "path": ".travis.yml",
    "chars": 625,
    "preview": "language: bash\n\nmatrix:\n  include:\n    - os: linux\n      dist: trusty\n      sudo: required\n    - os: osx\n  allow_failure"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 3213,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 2242,
    "preview": "# Contributing\n\n### First off, thank you for considering contributing to Bash-Snippets.\n\n#### Where do I go from here?\n\n"
  },
  {
    "path": "LICENSE",
    "chars": 1069,
    "preview": "MIT License\n\nCopyright (c) 2017 Alex Epstein\n\nPermission is hereby granted, free of charge, to any person obtaining a co"
  },
  {
    "path": "README.md",
    "chars": 16433,
    "preview": "<div align=\"center\">\n\n# Bash-Snippets\n\n<img src=\"https://cloud.githubusercontent.com/assets/2059754/24601246/753a7f36-18"
  },
  {
    "path": "bak2dvd/bak2dvd",
    "chars": 22389,
    "preview": "#!/usr/bin/env bash\n# Author: Charles Oblender https://github.com/oblende\ncurrentVersion=\"1.23.0\"\nconfiguredClient=\"\"\n\nt"
  },
  {
    "path": "bash-snippets/bash-snippets",
    "chars": 4716,
    "preview": "#!/usr/bin/env bash\n# Author: Navan Chauhan and Alexander Epstein\ndeclare -a tools=(bak2dvd cheat cloudup crypt cryptocu"
  },
  {
    "path": "bash-snippets.1",
    "chars": 16792,
    "preview": ".\\\" generated with Ronn/v0.7.3\n.\\\" http://github.com/rtomayko/ronn/tree/0.7.3\n.\n.TH \"BASH\\-SNIPPETS\" \"1\" \"April 2020\" \"\""
  },
  {
    "path": "bash-snippets.1.html",
    "chars": 22360,
    "preview": "<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv='content-type' value='text/html;charset=utf8'>\n  <meta name='generator'"
  },
  {
    "path": "bash-snippets.1.ronn",
    "chars": 15179,
    "preview": "bash-snippets(1) -- A collection of small bash scripts for heavy terminal users\n====\n\n## Tools\n\n### Cheat\nDescription: C"
  },
  {
    "path": "changelog.md",
    "chars": 9193,
    "preview": "<div align=\"center\">\n\n# Bash-Snippets Changelog\n\n## Version 1.23.0\n\n## Changes\n* Added python3 support\n* Added new featu"
  },
  {
    "path": "cheat/cheat",
    "chars": 7016,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n\ncurrentVersion=\"1.23.0\"\nconfiguredC"
  },
  {
    "path": "cloudup/cloudup",
    "chars": 15157,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n\ncurrentVersion=\"1.23.0\"\nconfiguredC"
  },
  {
    "path": "crypt/crypt",
    "chars": 6523,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n\ncurrentVersion=\"1.23.0\"\nstate=\"\"\nco"
  },
  {
    "path": "cryptocurrency/cryptocurrency",
    "chars": 9650,
    "preview": "#!/usr/bin/env bash\n# Original Author: Jonas-Taha El Sesiy https://github.com/elsesiy\n# Modifications: Alexander Epstein"
  },
  {
    "path": "currency/currency",
    "chars": 10149,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n# Expanded: Rohit Goswami https://gi"
  },
  {
    "path": "extras/Linux/maps/maps",
    "chars": 9723,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n\ncurrentVersion=\"1.23.0\"\nconfiguredC"
  },
  {
    "path": "extras/README.md",
    "chars": 2573,
    "preview": "<div align=\"center\">\n\n# Bash-Snippets Extras\n\n</div>\n\n## Why are these here?\n\nIf there is a tool in this folder that mea"
  },
  {
    "path": "geo/geo",
    "chars": 7068,
    "preview": "#!/usr/bin/env bash\n\n# Bash utility for getting specific network info\n# Author: Jake Meyer\n# Github: https://github.com/"
  },
  {
    "path": "gist/README.md",
    "chars": 11726,
    "preview": "# gist - Manage your gist like a pro\n\nAll your notes, scripts, config files and snippets deserve version control and tag"
  },
  {
    "path": "gist/gist",
    "chars": 31092,
    "preview": "#!/usr/bin/env bash\n#\n# Author: Hsieh Chin Fan (typebrook) <typebrook@gmail.com>\n# License: MIT\n# https://gist.github.co"
  },
  {
    "path": "install.sh",
    "chars": 3756,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\ncurrentVersion=\"1.23.0\"\ndeclare -a t"
  },
  {
    "path": "lyrics/lyrics",
    "chars": 8250,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\ncurrentVersion=\"1.23.0\"\nconfiguredCl"
  },
  {
    "path": "meme/meme",
    "chars": 5426,
    "preview": "#!/usr/bin/env bash\n# Author: Navan Chauhan https://github.com/navanchauhan\ncurrentVersion=\"1.23.0\"\nconfiguredClient=\"\"\n"
  },
  {
    "path": "movies/movies",
    "chars": 9565,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n\ncurrentVersion=\"1.23.0\"\nconfiguredC"
  },
  {
    "path": "movies/tmdb",
    "chars": 6840,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n# Author: Navan Chauhan https://gith"
  },
  {
    "path": "newton/newton",
    "chars": 8941,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n\ncurrentVersion=\"1.23.0\"\nconfiguredC"
  },
  {
    "path": "pwned/pwned",
    "chars": 6331,
    "preview": "#!/usr/bin/env bash\n# Author: Navan Chauhan https://github.com/navanchauhan\n\ncurrentVersion=\"1.23.0\"\nconfiguredClient=\"\""
  },
  {
    "path": "qrify/qrify",
    "chars": 8412,
    "preview": "#!/usr/bin/env bash\n# Author: Linyos Torovoltos github.com/linyostorovovoltos\n\ncurrentVersion=\"1.23.0\"\nmultiline=\"0\" # f"
  },
  {
    "path": "short/short",
    "chars": 6397,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n\ncurrentVersion=\"1.23.0\"\nconfiguredC"
  },
  {
    "path": "siteciphers/siteciphers",
    "chars": 5882,
    "preview": "#!/usr/bin/env bash\nDELAY=1\nconfiguredClient=\"\"\ncurrentVersion=\"1.23.0\"\n\ncheckOpenSSL()\n{\n  if  ! command -v openssl &>/"
  },
  {
    "path": "skeleton",
    "chars": 5929,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\ncurrentVersion=\"1.23.0\"\nconfiguredCl"
  },
  {
    "path": "skeleton.bats",
    "chars": 1961,
    "preview": "#!/usr/bin/env bats\n\nexport TOOL_NAME='skeleton'\n\nsetup() {\n  # $REPO_DIR/tests/skeleton.bats\n  REPO_DIR=\"$( cd \"$( dirn"
  },
  {
    "path": "stocks/stocks",
    "chars": 8320,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n# Author: Navan Chauhan https://gith"
  },
  {
    "path": "taste/taste",
    "chars": 11189,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n\ncurrentVersion=\"1.23.0\"\nconfiguredC"
  },
  {
    "path": "tests/bak2dvd.bats",
    "chars": 1651,
    "preview": "#!/usr/bin/env bats\n#\nexport TOOL_NAME='bak2dvd'\n\nsetup() {\n  # $REPO_DIR/tests/bak2dvd.bats\n  REPO_DIR=\"$( cd \"$( dirna"
  },
  {
    "path": "tests/cheat.bats",
    "chars": 1971,
    "preview": "#!/usr/bin/env bats\n\nexport TOOL_NAME='cheat'\n\nsetup() {\n  # $REPO_DIR/tests/tool.bats\n  REPO_DIR=\"$( cd \"$( dirname \"${"
  },
  {
    "path": "tests/cloudup.bats",
    "chars": 563,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing cloudup tool\" {\n   echo cloudup\n}\n\n@test \"Check for latest version of bash-snippets "
  },
  {
    "path": "tests/crypt.bats",
    "chars": 666,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing crypt tool\" {\n   echo crypt\n}\n\n@test \"Check for latest version of bash-snippets on u"
  },
  {
    "path": "tests/cryptocurrency.bats",
    "chars": 612,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing cryptocurrency tool\" {\n   echo cryptocurrency\n}\n\n@test \"Check for latest version of "
  },
  {
    "path": "tests/currency.bats",
    "chars": 809,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing currency tool\" {\n   echo currency\n}\n\n@test \"Check for latest version of bash-snippet"
  },
  {
    "path": "tests/geo.bats",
    "chars": 535,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing geo tool\" {\n   echo geo\n}\n\n@test \"Check for latest version of bash-snippets on updat"
  },
  {
    "path": "tests/gist.bats",
    "chars": 3131,
    "preview": "#!/usr/bin/env bats\n\nexport TOOL_NAME='gist'\nexport GIST_USER='phamhsieh'\nexport GIST_API_TOKEN='dd43dc9949a5b4a1d6c7''b"
  },
  {
    "path": "tests/meme.bats",
    "chars": 544,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing meme tool\" {\n   echo meme\n}\n\n@test \"Check for latest version of bash-snippets on upd"
  },
  {
    "path": "tests/movies.bats",
    "chars": 923,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing movies tool\" {\n   echo movies\n}\n\n@test \"Check for latest version of bash-snippets on"
  },
  {
    "path": "tests/newton.bats",
    "chars": 1229,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing newton tool\" {\n   echo newton\n}\n\n@test \"Check for latest version of bash-snippets on"
  },
  {
    "path": "tests/qrify.bats",
    "chars": 1066,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing qrify tool\" {\n   echo qrify\n}\n\n@test \"Check for latest version of bash-snippets on u"
  },
  {
    "path": "tests/short.bats",
    "chars": 2146,
    "preview": "#!/usr/bin/env bats\n\nexport TOOL_NAME='short'\n\nsetup() {\n  # $REPO_DIR/tests/short.bats\n  REPO_DIR=\"$( cd \"$( dirname \"$"
  },
  {
    "path": "tests/siteciphers.bats",
    "chars": 918,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing siteciphers tool\" {\n   echo siteciphers\n}\n\n@test \"Check for latest version of bash-s"
  },
  {
    "path": "tests/stocks.bats",
    "chars": 1037,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing stocks tool\" {\n   echo stocks\n}\n\n@test \"Check for latest version of bash-snippets on"
  },
  {
    "path": "tests/taste.bats",
    "chars": 2310,
    "preview": "#!/usr/bin/env bats\n\nexport TOOL_NAME='taste'\nexport TASTE_API_KEY=\"290044-Taste-QIQUQKOZ\"\n\nsetup() {\n  # $REPO_DIR/test"
  },
  {
    "path": "tests/todo.bats",
    "chars": 1259,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing todo tool\" {\n   echo todo\n}\n\n@test \"Check for latest version of bash-snippets on upd"
  },
  {
    "path": "tests/transfer.bats",
    "chars": 2105,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing transfer tool\" {\n   echo transfer\n}\n\n@test \"Check for latest version of bash-snippet"
  },
  {
    "path": "tests/weather.bats",
    "chars": 1748,
    "preview": "#!/usr/bin/env bats\n\nexport TOOL_NAME='weather'\n\nsetup() {\n  # $REPO_DIR/tests/weather.bats\n  REPO_DIR=\"$( cd \"$( dirnam"
  },
  {
    "path": "tests/ytview.bats",
    "chars": 592,
    "preview": "#!/usr/bin/env bats\n\n@test \"Testing ytview tool\" {\n   echo ytview\n}\n\n@test \"Check for latest version of bash-snippets on"
  },
  {
    "path": "todo/todo",
    "chars": 8178,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\nflag=\"\"\ncurrentVersion=\"1.23.0\"\nconf"
  },
  {
    "path": "transfer/transfer",
    "chars": 9313,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\nconfiguredDownloadClient=\"\"\nconfigur"
  },
  {
    "path": "uninstall.sh",
    "chars": 1598,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\ndeclare -a tools=(bak2dvd bash-snipp"
  },
  {
    "path": "weather/weather",
    "chars": 7074,
    "preview": "#!/usr/bin/env bash\n# Author: Alexander Epstein https://github.com/alexanderepstein\n\ncurrentVersion=\"1.23.0\" #This versi"
  },
  {
    "path": "ytview/ytview",
    "chars": 10003,
    "preview": "#!/usr/bin/env bash\n# Author: Linyos Torovoltos https://github.com/linyostorovovoltos\n# Modifications: Alexander Epstein"
  }
]

About this extraction

This page contains the full source code of the alexanderepstein/Bash-Snippets GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 66 files (376.9 KB), approximately 114.0k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!