8.5 KiB
Bash-Snippets
![](https://cloud.githubusercontent.com/assets/2059754/24601246/753a7f36-1858-11e7-9d6b-7a0e64fb27f7.png)
A collection of small bash scripts for heavy terminal users with no dependencies
All of these scripts have been heavily tested on OSX 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.
Weather
Provides a 3 day forecast
With no arguments it will grab the weather for your location as determined by your ip
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/weather/weather.png?raw=true)
With arguments you can pass in a city or country and get the weather in that area
Also can show the current moon phase
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/weather/moon.png?raw=true)
Youtube-Viewer
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.
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/ytview/ytview.png?raw=true)
Stocks
Provides information about a certain stock symbol
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/stocks/stocks.png?raw=true)
Geo
Provides date for wan, lan, router, dns, mac, and ip geolocation
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/geo/geo.png?raw=true)
Written by: Jake Meyer
Currency
Converts currency based on realtime exchange rates
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/currency/currency.png?raw=true)
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
Encryption & Decryption
A wrapper for openssl that allows for quickly encrypting and decrypting files
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
- Data is encrypted 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!
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/crypt/crypt.png?raw=true)
Movies
Quick search that grabs relevant information about a movie
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/movies/movies.png?raw=true)
Cheat
The fastest way to find {command options|code pieces} you need
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/cheat/cheat.png?raw=true)
Taste
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
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/taste/taste.png?raw=true)
Needs an API Key
- To get an API key visit https://tastedive.com/account/api_access
- After getting the API key run the following command: export TASTE_API_KEY="yourAPIKeyGoesHere"
- If issues occur first try setting the API key without quotations marks
Short
Gets the link that is being masked by a url shortner
![](https://github.com/alexanderepstein/Bash-Snippets/blob/master/short/short.png?raw=true)
API's Used
- To get location based on ip address: ipinfo.io
- To get and print weather based on a location: wttr.in
- To grab the stock information in JSON format: alphavantage.co
- To grab the latest exchange rate between currencies: fixer.io
- To grab information on movies: omdbapi.com
- To grab recommendations based on an item: tastedive.com
- To determine masked link behind url shortner: x.datasig.io
- To grab cheatsheets for commands and languages: cheat.sh
Inspired by: Ruby-Scripts
Installing
-
First clone the repository:
git clone https://github.com/alexanderepstein/Bash-Snippets
-
Then cd into the cloned directory:
cd Bash-Snippets
-
Git checkout to the latest stable release
git checkout v1.8.0
-
Run the guided install script with
./install.sh
this will let you choose which scripts to install
- Install all the scripts
./install.sh all
- Install an individual script
./install.sh stocks
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 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.
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 uninstall all scripts
./uninstall.sh
To uninstall individual scripts
Ex. Weather
cd weather
./uninstall.sh
Donate
If this project helped you in any way and you feel like buying a broke college kid a cup of coffee
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.