From 89619a07eb4dde27ba4f135d78fefa707ca17c90 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Mon, 23 Oct 2017 09:35:07 -0400 Subject: [PATCH 1/5] Add git mask utility --- git/.gitconfig | 5 ++++ system/.lyrical-git_mask | 49 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 system/.lyrical-git_mask diff --git a/git/.gitconfig b/git/.gitconfig index 996fbfb..d8c4819 100755 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -7,3 +7,8 @@ autostash = true [core] editor = vim +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true diff --git a/system/.lyrical-git_mask b/system/.lyrical-git_mask new file mode 100644 index 0000000..277a6e1 --- /dev/null +++ b/system/.lyrical-git_mask @@ -0,0 +1,49 @@ +#!/bin/bash + +declare -A user1=([name]='Alexander Hosking' [email]='alexander@ahosking.com') +declare -A user2=([name]='Kim Martin' [email]='kim@lyricalsecurity.com') +declare -A user3=([name]='Dillon Zhang' [email]='Dillon@lyricalsecurity.com') +declare -A user4=([name]='Pam Moire' [email]='pam@lyricalsecurity.com') +declare -A user5=([name]='Mitch Warren' [email]='mitch@lyricalsecurity.com') +declare -A user6=([name]='James Webster' [email]='james@lyricalsecurity.com') +declare -A user7=([name]='Caroline Marcoux' [email]='caroline@lyricalsecurity.com') +declare -A user8=([name]='Renato Streefkerk' [email]='renato@lyricalsecurity.com') + +users=(user1 user2 user3 user4 user5 user6 user7 user8) + +#echo $RANDO ## DEBUG +##Print the bits from the array index of random number + +function git_mask() { + if [ -z "$1" ] + then + RANDO=$(( ( RANDOM % ${#users[@]} ) )) ## Generate a random index from the users array + for arr_name in "${users[$RANDO]}"; do + declare -n arr_ref="$arr_name" + + printf "git config user.name \"%s\"\n" "${arr_ref[name]}" + printf "git config user.email \"%s\"\n" "${arr_ref[email]}" + set_username="git config user.name \"${arr_ref[name]}\" --replace-all" + eval $set_username + set_email="git config user.email \"${arr_ref[email]}\" --replace-all" + eval $set_email + + done + else + if [[ ! $1 =~ [0-9] ]] || ([[ $1 -gt ${#users[@]} ]] || [[ $1 -le 0 ]]); then + printf "Please enter a valid number from 1 to %s\n" "${#users[@]}" + else + user_id="$(($1 - 1))" + for arr_name in "${users[$user_id]}"; do + declare -n arr_ref="$arr_name" + + printf "Your git profile is now: \"%s\"\n" "${arr_ref[name]}" + set_username="git config user.name \"${arr_ref[name]}\" --replace-all" + eval $set_username + set_email="git config user.email \"${arr_ref[email]}\" --replace-all" + eval $set_email + + done + fi + fi +} From 918d2de89056a010cf69c2701f1835befd52dd4d Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Mon, 23 Oct 2017 09:39:31 -0400 Subject: [PATCH 2/5] Update bashrc to source new scripts --- run/.bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run/.bashrc b/run/.bashrc index b94bb8b..78e1506 100755 --- a/run/.bashrc +++ b/run/.bashrc @@ -21,7 +21,7 @@ fi # Finally we can source the dotfiles (order matters) -for DOTFILE in "$DOTFILES_DIR"/system/.{function,env,alias,prompt}; do +for DOTFILE in "$DOTFILES_DIR"/system/.{function,env,alias,prompt,bruise,lyrical-git_mask}; do [ -f "$DOTFILE" ] && . "$DOTFILE" done From 955e37ae345c08207b48da056dff438e8ed2836b Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Mon, 23 Oct 2017 09:40:27 -0400 Subject: [PATCH 3/5] Make the thing executable --- system/.lyrical-git_mask | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 system/.lyrical-git_mask diff --git a/system/.lyrical-git_mask b/system/.lyrical-git_mask old mode 100644 new mode 100755 From c53ca9e7858026bb6f1000c2174ec1fa58e10db4 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Tue, 31 Oct 2017 15:37:26 -0400 Subject: [PATCH 4/5] Add vagrant halt alias --- .i3/config | 5 +++-- system/.alias | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.i3/config b/.i3/config index f14ed3e..e510f2a 100755 --- a/.i3/config +++ b/.i3/config @@ -67,11 +67,12 @@ bindsym $mod+XF86AudioMute exec --no-startup-id pactl set-sink-mute 1 toggle # m ## requires xbacklight -#bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness -#bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness +## Keyboard Backlighting +#/sys/devices/platform/asus-nb-wmi/leds/asus\:\:kbd_backlight/brightness + # change focus bindsym $mod+h focus left bindsym $mod+t focus down diff --git a/system/.alias b/system/.alias index 4618d33..658ec12 100755 --- a/system/.alias +++ b/system/.alias @@ -15,6 +15,7 @@ alias vp='vagrant provision' alias vssh='vagrant ssh' alias vd='vagrant destroy' alias vc='vagrant destroy && vagrant up --provision' +alias vh="for i in `vagrant global-status | awk '/running/ {print $5}'`; do cd $i && vagrant halt; done" ### Git alias git_clean='git fetch --all && git reset --hard origin/master' @@ -23,4 +24,4 @@ alias git_clean='git fetch --all && git reset --hard origin/master' alias vpn_lyrical='cd /home/ahosking/lyrical/vpn &&sudo openvpn --config gw-udp-1194-ahosking-vpn.ovpn' alias roles_fetch='r10k puppetfile install --puppetfile Puppetfile --moduledir ../../roles/' -alias roles_pull='for role in `ls ../../roles`; do echo "########" $role; echo `git -C ../../roles/$role pull`; done' +alias roles_pull='for role in `ls ../../roles`; do echo "########" $role; echo `git -C ../../roles/$role pull origin master`; done' From e27a0bb3c66ba36190f239e47cdb7e39d4b97250 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Tue, 7 Nov 2017 10:25:56 -0500 Subject: [PATCH 5/5] Symlink fix for bruise --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index c8cccae..02ab38e 100755 --- a/install.sh +++ b/install.sh @@ -29,7 +29,7 @@ ln -sfv ~/dotfiles ~/.dotfiles ln -sfv "$DOTFILES_DIR/run/.profile" ~ ln -sfv "$DOTFILES_DIR/run/.xprofile" ~ ln -sfv "$DOTFILES_DIR/run/.bashrc" ~ -ln -sfv "$DOTFILES_DIR/run/bruise" ~/apps/bruise +ln -sfv "$DOTFILES_DIR/system/.bruise" ~/apps/bruise ln -sfv "$DOTFILES_DIR/git/.gitconfig" ~ ln -sfv "$DOTFILES_DIR/system/.vimrc" ~ ln -sfv "$DOTFILES_DIR/system/.dir_colors" ~