add pwgen utility
Move common zsh/bash things into a separate file Add pwgen utility to generate xkcd-style passphrases
This commit is contained in:
+3
-43
@@ -33,49 +33,9 @@ shopt -s cmdhist
|
||||
export HISTCONTROL=ignoredups
|
||||
export HISTIGNORE="&:ls:[bf]g:exit"
|
||||
|
||||
function local_pi() {
|
||||
LOCAL_PI_IP=$(en4ip)
|
||||
ssh -b $LOCAL_PI_IP pi@169.254.100.100
|
||||
}
|
||||
|
||||
#################### 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
|
||||
}
|
||||
if [ -f ~/.common_shell_functions ]; then
|
||||
. ~/.common_shell_functions
|
||||
fi
|
||||
|
||||
#Enable ~/.ssh/config host tab completion
|
||||
_complete_ssh_hosts ()
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
###################################################################
|
||||
# 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
|
||||
}
|
||||
Binary file not shown.
@@ -7,6 +7,7 @@
|
||||
- link:
|
||||
~/.dotfiles: ''
|
||||
~/.vim: vim
|
||||
~/.dotfile_util: util
|
||||
~/.vimrc: vimrc
|
||||
~/.vimrc_vundle: vimrc_vundle
|
||||
~/.zpreztorc: zpreztorc
|
||||
@@ -16,6 +17,8 @@
|
||||
~/.bash_prompt: bash_prompt
|
||||
~/.git_prompt.sh: git_prompt.sh
|
||||
~/.git-completion.bash: git-completion.bash
|
||||
~/.dictionary.txt.gz: dictionary.txt.gz
|
||||
~/.common_shell_functions: common_shell_functions
|
||||
|
||||
- shell:
|
||||
- [git submodule update --init --recursive, Installing submodules]
|
||||
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import gzip
|
||||
import random
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
word_length = int(sys.argv[1])
|
||||
else:
|
||||
word_length = 3
|
||||
|
||||
dictfile = os.path.expanduser('~/.dictionary.txt.gz')
|
||||
with gzip.open(dictfile) as f:
|
||||
lines = f.readlines()
|
||||
rand_engine = random.SystemRandom()
|
||||
result = ''
|
||||
words = []
|
||||
for _ in range(0, word_length):
|
||||
word = rand_engine.choice(lines).strip().decode()
|
||||
while len(word) > 10:
|
||||
word = rand_engine.choice(lines).strip().decode()
|
||||
result += word
|
||||
words.append(word)
|
||||
print(result)
|
||||
print("From words: {}".format(', '.join(words)))
|
||||
@@ -49,46 +49,6 @@ alias vi='vim'
|
||||
#alias en4ip="ifconfig | grep -A1 en4 | tail -n1 | awk 'BEGIN { FS=\" \" }; {print \$2}'"
|
||||
alias en4ip="ifconfig | grep -Eo '169.254.\d{1,3}.\d{1,3}' | head -n1"
|
||||
|
||||
function local_pi() {
|
||||
LOCAL_PI_IP=$(en4ip)
|
||||
ssh -b $LOCAL_PI_IP pi@169.254.100.100
|
||||
}
|
||||
|
||||
#################### 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
|
||||
}
|
||||
if [ -f ~/.common_shell_functions ]; then
|
||||
. ~/.common_shell_functions
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user