Skip to content

Commit

Permalink
v0.1.59
Browse files Browse the repository at this point in the history
  • Loading branch information
Release Bot committed Mar 17, 2018
1 parent db94a5a commit c09a8b5
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 6 deletions.
1 change: 1 addition & 0 deletions bash/.aliases
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ alias xcode='open -a xcode'
# ---------------------------------------------------------------------------
# 3. Quicker navigation
# ---------------------------------------------------------------------------
alias ~="cd ~"
alias ...='cd ../../' # Go back 2 directory levels
alias ..='cd ../' # Go back 1 directory level
alias .3='cd ../../../' # Go back 3 directory levels
Expand Down
83 changes: 78 additions & 5 deletions bash/.bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ test -f "$HOME/.bashrc" && source "$HOME/.bashrc"
# 2. Change prompt
# ---------------------------------------------------------------------------

# Root prompt (RED)
SUDO_PS1="$(tput setaf 1)[\\d \\t] @ $(tput setaf 7)\\h(💀 \\u): $"
# Root prompt (😈)
SUDO_PS1="\[root@$(hostname -f) 😈: $ "
export SUDO_PS1

# Normal prompt (WHITE)
PS1="$(tput setaf 7)[\\d \\t] @ \\h(👽 \\u): $"
# Normal prompt (👽)
PS1="$(hostname -f) 👽: $ "
export PS1


Expand Down Expand Up @@ -199,7 +199,7 @@ function rm() {
done
}

# cd: function to Enable 'cd' into directory aliases
# cd: Function to Enable 'cd' into directory aliases
function cd() {
if [ ${#1} == 0 ]; then
builtin cd
Expand All @@ -213,6 +213,56 @@ function cd() {
fi
}

# tree: Function to generates a tree view from the current directory
function tree(){
pwd
ls -R | grep ":$" | \
sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
}

# sshKeyGen: Function to generates SSH key
function sshKeyGen() {

echo "What's the name of the Key (no spaced please) ? ";
read -r name;

echo "What's the email associated with it? ";
read -r email;

$(ssh-keygen -t rsa -f ~/.ssh/id_rsa_$name -C "$email");

ssh-add ~/.ssh/id_rsa_$name;

pbcopy < ~/.ssh/id_rsa_$name.pub;

echo "SSH Key copied in your clipboard";

}

# filestolower: Function to rename all the files which contain uppercase letters to lowercase in the current folder
function filestolower(){
read -r -p "This will rename all the files and directories to lowercase in the current folder, continue? [y/n]: " letsdothis
if [ "$letsdothis" = "y" ] || [ "$letsdothis" = "Y" ]; then
for x in `ls`
do
skip=false
if [ -d $x ]; then
read -p "'$x' is a folder, rename it? [y/n]: " renamedir
if [ "$renamedir" = "n" ] || [ "$renameDir" = "N" ]; then
skip=true
fi
fi
if [ "$skip" == "false" ]; then
lc=`echo $x | tr '[A-Z]' '[a-z]'`
if [ $lc != $x ]; then
echo "renaming $x -> $lc"
mv $x $lc
fi
fi
done
fi
}

# mkcd: Function to combine mkdir and cd
mkcd() {
mkdir "$1"
Expand Down Expand Up @@ -268,6 +318,29 @@ extract() {
fi
}

# Generates a random password
function randompwd() {
if [ -z $1 ]; then
MAXSIZE=10
else
MAXSIZE=$1
fi
array1=(
q w e r t y u i o p a s d f g h j k l z x c v b n m Q W E R T Y U I O P A S D
F G H J K L Z X C V B N M 1 2 3 4 5 6 7 8 9 0
\! \@ \$ \% \^ \& \* \! \@ \$ \% \^ \& \* \@ \$ \% \^ \& \*
)
MODNUM=${#array1[*]}
pwd_len=0
while [ $pwd_len -lt $MAXSIZE ]
do
index=$(($RANDOM%$MODNUM))
echo -n "${array1[$index]}"
((pwd_len++))
done
echo
}

# mcd: Function to makes new Dir and jumps inside
mcd() { mkdir -p "$1" && cd "$1" || exit; }

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reedia-dotfiles",
"version": "0.1.57",
"version": "0.1.59",
"description": "Dotfiles - A set of Mac OS X configuration files",
"keywords": [
"dotfiles",
Expand Down

0 comments on commit c09a8b5

Please sign in to comment.