################################################################### # This file is for shell functions common between shells: zsh, bash ################################################################### function local_pi() { LOCAL_PI_IP=$(en4ip) ssh -b $LOCAL_PI_IP pi@169.254.100.100 } function pubkey() { if [ -f ~/.ssh/id_rsa.pub ]; then if which pbcopy &> /dev/null; then cat ~/.ssh/id_rsa.pub | pbcopy echo "Copied public key using pbcopy" else echo "pbcopy not available - printing public key" echo cat ~/.ssh/id_rsa.pub fi fi } function pwgen() { if [ -f ~/.dotfile_util/pwgen.py ]; then if which python &> /dev/null; then ~/.dotfile_util/pwgen.py 4 else echo "Need python for pwgen" fi else echo "Could not find ~/.dotfile_util/pwgen.py" fi } #################### Project Initialization Tools ################### function download_bootstrap() { mkdir -p static mkdir -p static/css mkdir -p static/js cd static/css wget "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" cd ../ cd js wget "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" cd ../.. } function init_flask() { mkdir -p templates touch templates/index.html curl "https://raw.githubusercontent.com/lewagon/bootstrap-boilerplate/gh-pages/index.html" > templates/index.html FLASK_TEMPLATE="from flask import Flask, render_template, request app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') if __name__ == '__main__': app.debug = True app.run() " echo "$FLASK_TEMPLATE" > app.py } function weather() { LOCATION=milwaukee curl wttr.in/$LOCATION }