moved most scripts out to seperate repos, updated install to checkout most recent copy
This commit is contained in:
		
							parent
							
								
									2243fb2f5b
								
							
						
					
					
						commit
						a228717eec
					
				
							
								
								
									
										9
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -2,13 +2,6 @@ tmux/resurrect
 | 
				
			|||||||
tmux/plugins
 | 
					tmux/plugins
 | 
				
			||||||
!tmux/plugins/tpm
 | 
					!tmux/plugins/tpm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bin/water/archive
 | 
					 | 
				
			||||||
bin/water/*.csv
 | 
					 | 
				
			||||||
bin/water/.reminder
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bin/weather/.env*
 | 
					 | 
				
			||||||
*.swp
 | 
					*.swp
 | 
				
			||||||
bin/startup/*.json
 | 
					
 | 
				
			||||||
bin/bluebikes/data
 | 
					 | 
				
			||||||
bin/timetracker/timesheets
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										21
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@ -26,9 +26,6 @@
 | 
				
			|||||||
[submodule "tpm"]
 | 
					[submodule "tpm"]
 | 
				
			||||||
	path = tpm
 | 
						path = tpm
 | 
				
			||||||
	url = https://github.com/tmux-plugins/tpm
 | 
						url = https://github.com/tmux-plugins/tpm
 | 
				
			||||||
[submodule ".priv"]
 | 
					 | 
				
			||||||
	path = .priv
 | 
					 | 
				
			||||||
	url = git@github.com:KeeganForelight/private_info.git
 | 
					 | 
				
			||||||
[submodule "vim/pack/man/start/vim-commentary"]
 | 
					[submodule "vim/pack/man/start/vim-commentary"]
 | 
				
			||||||
	path = vim/pack/man/start/vim-commentary
 | 
						path = vim/pack/man/start/vim-commentary
 | 
				
			||||||
	url = https://github.com/tpope/vim-commentary.git
 | 
						url = https://github.com/tpope/vim-commentary.git
 | 
				
			||||||
@ -50,6 +47,20 @@
 | 
				
			|||||||
[submodule "vim/pack/man/start/vimtex"]
 | 
					[submodule "vim/pack/man/start/vimtex"]
 | 
				
			||||||
	path = vim/pack/man/start/vimtex
 | 
						path = vim/pack/man/start/vimtex
 | 
				
			||||||
	url = https://github.com/lervag/vimtex.git
 | 
						url = https://github.com/lervag/vimtex.git
 | 
				
			||||||
[submodule "bin/tmux-mem-cpu-load"]
 | 
					[submodule "src/watertracker"]
 | 
				
			||||||
	path = bin/tmux-mem-cpu-load
 | 
						path = src/watertracker
 | 
				
			||||||
 | 
						url = https://git.keegandeppe.com/kdeppe/watertracker.git
 | 
				
			||||||
 | 
						branch = main
 | 
				
			||||||
 | 
						update = merge
 | 
				
			||||||
 | 
					[submodule "src/bluebikes"]
 | 
				
			||||||
 | 
						path = src/bluebikes
 | 
				
			||||||
 | 
						url = https://git.keegandeppe.com/kdeppe/bluebikes.git
 | 
				
			||||||
 | 
					[submodule "src/timetracker"]
 | 
				
			||||||
 | 
						path = src/timetracker
 | 
				
			||||||
 | 
						url = https://git.keegandeppe.com/kdeppe/timetracker.git
 | 
				
			||||||
 | 
					[submodule "src/weather"]
 | 
				
			||||||
 | 
						path = src/weather
 | 
				
			||||||
 | 
						url = https://git.keegandeppe.com/kdeppe/weather.git
 | 
				
			||||||
 | 
					[submodule "src/tmux-mem-cpu-load"]
 | 
				
			||||||
 | 
						path = src/tmux-mem-cpu-load
 | 
				
			||||||
	url = https://github.com/thewtex/tmux-mem-cpu-load
 | 
						url = https://github.com/thewtex/tmux-mem-cpu-load
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								.priv
									
									
									
									
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										1
									
								
								.priv
									
									
									
									
									
								
							@ -1 +0,0 @@
 | 
				
			|||||||
Subproject commit 66fe519826ba9b6870422179c368ea5d3a97e890
 | 
					 | 
				
			||||||
							
								
								
									
										238
									
								
								bin/bluebikes/bb
									
									
									
									
									
								
							
							
						
						
									
										238
									
								
								bin/bluebikes/bb
									
									
									
									
									
								
							@ -1,238 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#set -e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
usage() {
 | 
					 | 
				
			||||||
    cat <<EOF
 | 
					 | 
				
			||||||
usage: $0 [-c][-f][-s][-h][-r [option]]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Queries Bluebikes API to get recent bike status
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Options:
 | 
					 | 
				
			||||||
  -c, --colorize        enables tmux color options
 | 
					 | 
				
			||||||
  -f, --force           force refreshes bb data
 | 
					 | 
				
			||||||
  -s, --search          pulls up a searchable fzf menu to update
 | 
					 | 
				
			||||||
                          displayed station
 | 
					 | 
				
			||||||
  -r, --rename [NAME]   rename the current station
 | 
					 | 
				
			||||||
                          stored in data/alias.json
 | 
					 | 
				
			||||||
                          if called without an arguement resets to default
 | 
					 | 
				
			||||||
  -h, --help            display this message
 | 
					 | 
				
			||||||
EOF
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# setting up vars
 | 
					 | 
				
			||||||
TIMEOUT=60 # interval we request bike information at (s)
 | 
					 | 
				
			||||||
WORKINGDIR="$HOME/.dotfiles/bin/bluebikes"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# api
 | 
					 | 
				
			||||||
BB_API="https://gbfs.bluebikes.com/gbfs/en/station_status.json"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# allows customizing search window or dropping in dmenu
 | 
					 | 
				
			||||||
SEARCH="fzf-tmux --layout=reverse -p 50%,50% --border"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# create directory on fresh installs
 | 
					 | 
				
			||||||
if [[ ! -d "$WORKINGDIR/data/status" ]] ; then
 | 
					 | 
				
			||||||
    mkdir -p "$WORKINGDIR/data/status"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# creating station alias list on fresh installs
 | 
					 | 
				
			||||||
if [[ ! -e "$WORKINGDIR/data/alias.json" ]] ; then
 | 
					 | 
				
			||||||
    starter_json=$(printf '{ "stations": [] }' | gojq '.')
 | 
					 | 
				
			||||||
    echo "$starter_json" > "$WORKINGDIR/data/alias.json"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# getting station
 | 
					 | 
				
			||||||
if [[ -e "$WORKINGDIR/data/.station" ]] ; then
 | 
					 | 
				
			||||||
    # if file exists
 | 
					 | 
				
			||||||
    source "$WORKINGDIR/data/.station"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
get_station_info() {
 | 
					 | 
				
			||||||
    # sets $BIKES and $DOCKS based on $STATIONID
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # checks that $STATIONID is set
 | 
					 | 
				
			||||||
    if [[ -z "$STATIONID" ]] ; then
 | 
					 | 
				
			||||||
        printf 'Please set a station with bb -s' >&2
 | 
					 | 
				
			||||||
        exit 1
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # uses $UPDATE set based on update check 
 | 
					 | 
				
			||||||
    if [ "$UPDATE" = true ] ; then
 | 
					 | 
				
			||||||
        # getting new station info
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        STATION_INFO=$(curl --silent -fL $BB_API | gojq --arg id $STATIONID '.data.stations[] | select( .station_id == $id)' 2>/dev/null)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if [[ -z "$STATION_INFO" ]] ; then
 | 
					 | 
				
			||||||
            printf 'Error retrieving station info! Check your connection' >&2
 | 
					 | 
				
			||||||
            exit 1
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # set vars
 | 
					 | 
				
			||||||
        BIKES=$(echo "$STATION_INFO" | gojq '.num_bikes_available')
 | 
					 | 
				
			||||||
        DOCKS=$(echo "$STATION_INFO" | gojq '.num_docks_available')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        EXPIRATION=$(($(date +%s) + $TIMEOUT))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # creating info file
 | 
					 | 
				
			||||||
        printf 'BIKES=%d\nDOCKS=%d\n' $BIKES $DOCKS > "$WORKINGDIR/data/status/$EXPIRATION"
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        # grab existing data
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        source $WORKINGDIR/data/status/*
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
check_update() {
 | 
					 | 
				
			||||||
    # sets $UPDATE if needed
 | 
					 | 
				
			||||||
    file_expr=$(ls "$WORKINGDIR/data/status" | grep .json | awk -F . '{print $1}')    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ $(date +%s) -gt $file_expr ]] ; then
 | 
					 | 
				
			||||||
        # out of date
 | 
					 | 
				
			||||||
        UPDATE=true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # cleaning old info
 | 
					 | 
				
			||||||
        rm ${WORKINGDIR}/data/status/*.json 2> /dev/null
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set_station_alias() {
 | 
					 | 
				
			||||||
    # sets $ALIAS for $STATION_ID
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ -z "$STATIONID" ]] ; then
 | 
					 | 
				
			||||||
        # no station id
 | 
					 | 
				
			||||||
        printf 'No Station set to change name for!\nPlease run bb -s to set a station' >&2
 | 
					 | 
				
			||||||
        exit 1
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #aliases=$(cat "$WORKINGDIR/data/alias.json") # alias json
 | 
					 | 
				
			||||||
    ALIAS_FILE="$WORKINGDIR/data/alias.json"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # fmtting
 | 
					 | 
				
			||||||
    FMT_ALIAS=$(printf '"%s"' $(echo $ALIAS | tr -d '"'))
 | 
					 | 
				
			||||||
    FMT_STATIONID=$(printf '"%d"' $STATIONID)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    OUT=$(cat "$ALIAS_FILE" | gojq ".$FMT_STATIONID |= $FMT_ALIAS")
 | 
					 | 
				
			||||||
    echo "$OUT" > "$ALIAS_FILE"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # printing change
 | 
					 | 
				
			||||||
    if [[ -z "$ALIAS" ]] ; then
 | 
					 | 
				
			||||||
        printf 'Removing alias\n'
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        printf 'Updated alias to %s\n' "$ALIAS"
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
update_station() {
 | 
					 | 
				
			||||||
    # provides a gui to update the station to watch
 | 
					 | 
				
			||||||
    STATIONS=$(curl --silent -fL https://gbfs.bluebikes.com/gbfs/en/station_information.json | gojq '.data.stations[]')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ -z "$STATIONS" ]] ; then
 | 
					 | 
				
			||||||
        printf 'Error retrieving station info! Check your connection' >&2
 | 
					 | 
				
			||||||
        exit 1
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # prompt user to search
 | 
					 | 
				
			||||||
    NEW_STATION=$(echo "$STATIONS" | gojq '.name' | tr -d '"' | eval "$SEARCH")
 | 
					 | 
				
			||||||
    if [[ -z "$NEW_STATION" ]] ; then
 | 
					 | 
				
			||||||
        exit 0
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # number correlating to selected name
 | 
					 | 
				
			||||||
    STATIONID=$(echo "$STATIONS"| gojq --arg name "$NEW_STATION" '. | select( .name == $name) | .station_id' | tr -d '"') # trim quotes
 | 
					 | 
				
			||||||
    # setting data/.station file
 | 
					 | 
				
			||||||
    output=$(printf 'STATIONID=%s\nSTATION_NAME="%s"\n' "$STATIONID" "$NEW_STATION")
 | 
					 | 
				
			||||||
    echo "$output" > "$WORKINGDIR/data/.station"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
colorize() {
 | 
					 | 
				
			||||||
    # colorizes $BIKES and $DOCKS for tmux
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    case $1 in
 | 
					 | 
				
			||||||
        [0-2])
 | 
					 | 
				
			||||||
            clr='#[fg=color1]' # red
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        [3-6])
 | 
					 | 
				
			||||||
            clr='#[fg=color184]' # yellow
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        *)
 | 
					 | 
				
			||||||
            clr='#[fg=color34]' # green
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
    printf '%s%d' "$clr" $1
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
print_status() {
 | 
					 | 
				
			||||||
    # prints
 | 
					 | 
				
			||||||
    get_station_info # sets $DOCKS $BIKES and $STATIONID
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ -e "$WORKINGDIR/data/alias.json" ]] ; then
 | 
					 | 
				
			||||||
        FMT_STATIONID=$(printf '"%d"' $STATIONID)
 | 
					 | 
				
			||||||
        ALIAS=$(cat "$WORKINGDIR/data/alias.json" | gojq ".$FMT_STATIONID" | tr -d '"')
 | 
					 | 
				
			||||||
        if [[ ! -z "$ALIAS" ]] ; then
 | 
					 | 
				
			||||||
            STATION_NAME="$ALIAS"
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    DEFAULT=""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ "$COLORIZE" = true ]] ; then
 | 
					 | 
				
			||||||
        # adding tmux colors
 | 
					 | 
				
			||||||
        DEFAULT="#[default]"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        BIKES=$(colorize $BIKES)
 | 
					 | 
				
			||||||
        DOCKS=$(colorize $DOCKS)
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
    printf '%s   %s  %s%s\n' $BIKES $DOCKS "$DEFAULT" "$STATION_NAME"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# always check/clean status
 | 
					 | 
				
			||||||
check_update
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# change long form
 | 
					 | 
				
			||||||
for arg in "$@"; do
 | 
					 | 
				
			||||||
    shift
 | 
					 | 
				
			||||||
    case "$arg" in
 | 
					 | 
				
			||||||
        '--help')       set -- "$@" "-h"    ;;
 | 
					 | 
				
			||||||
        '--search')     set -- "$@" "-s"    ;;
 | 
					 | 
				
			||||||
        '--force')      set -- "$@" "-f"    ;;
 | 
					 | 
				
			||||||
        '--rename')     set -- "$@" "-r"    ;;
 | 
					 | 
				
			||||||
        '--colorize')   set -- "$@" "-c"    ;;
 | 
					 | 
				
			||||||
        *)              set -- "$@" "$arg"  ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# parsing args
 | 
					 | 
				
			||||||
while getopts "hsfcr" opt ; do
 | 
					 | 
				
			||||||
    case "$opt" in
 | 
					 | 
				
			||||||
        'h' )
 | 
					 | 
				
			||||||
            usage
 | 
					 | 
				
			||||||
            exit 0
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        's' )
 | 
					 | 
				
			||||||
            update_station
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        'f' )
 | 
					 | 
				
			||||||
            UPDATE=true
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        'c' )
 | 
					 | 
				
			||||||
            COLORIZE=true
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        'r' )
 | 
					 | 
				
			||||||
            nextopt=${!OPTIND}
 | 
					 | 
				
			||||||
            if [[ -n "$nextopt" && "$nextopt" != -* ]] ; then
 | 
					 | 
				
			||||||
                ALIAS="$nextopt"
 | 
					 | 
				
			||||||
            fi
 | 
					 | 
				
			||||||
            set_station_alias
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        '?' )
 | 
					 | 
				
			||||||
            usage
 | 
					 | 
				
			||||||
            exit 1
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# finish by printing
 | 
					 | 
				
			||||||
print_status
 | 
					 | 
				
			||||||
@ -1,53 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set_greeting() {
 | 
					 | 
				
			||||||
    # sets the TOD variable based on time of calling
 | 
					 | 
				
			||||||
    cur_time=$(date +%H) # hour
 | 
					 | 
				
			||||||
    # this control flow will be scuffed because I need to deal with early AM = evening
 | 
					 | 
				
			||||||
    if [[ $cur_time -lt 4 || $cur_time -gt 17 ]] ; then
 | 
					 | 
				
			||||||
        # between 5:00 pm and 4:00 am
 | 
					 | 
				
			||||||
        Greeting="Evening"
 | 
					 | 
				
			||||||
    elif [[ $cur_time -lt 12 ]] ; then
 | 
					 | 
				
			||||||
        # between 4:00 am and 12:00 pm
 | 
					 | 
				
			||||||
        Greeting="Morning"
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        Greeting="Afternoon"
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
format_doormat() {
 | 
					 | 
				
			||||||
    # formats doormat on entry
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    set_greeting # set $Greeting based on TOD
 | 
					 | 
				
			||||||
    window="Good $Greeting"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    tmux select-window -t "$SESSION:0"
 | 
					 | 
				
			||||||
    # creating a weather view on right quater
 | 
					 | 
				
			||||||
    tmux split-window -h -p 40
 | 
					 | 
				
			||||||
    # creating quote area
 | 
					 | 
				
			||||||
    tmux split-window -v -p 20
 | 
					 | 
				
			||||||
    # weather
 | 
					 | 
				
			||||||
    tmux select-pane -t 1
 | 
					 | 
				
			||||||
    tmux send-keys 'c && curl --silent -fL https://wttr.in?Fn' C-m
 | 
					 | 
				
			||||||
    # quote
 | 
					 | 
				
			||||||
    tmux select-pane -t 2 
 | 
					 | 
				
			||||||
    tmux send-keys 'c && quote.sh' C-m
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # opening vim
 | 
					 | 
				
			||||||
    tmux select-pane -t 0
 | 
					 | 
				
			||||||
    tmux send-keys 'c && vim' C-m
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # renaming based on TOD
 | 
					 | 
				
			||||||
    tmux rename-window -t "$SESSION:0" "$window"
 | 
					 | 
				
			||||||
    tmux set-hook -u -t $SESSION client-attached
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
eval "$(tmux_start.sh -s)"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [[ ! -z $SESSION ]] ; then
 | 
					 | 
				
			||||||
    # session is set
 | 
					 | 
				
			||||||
    format_doormat
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
@ -1,27 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
get_qotd() {
 | 
					 | 
				
			||||||
    # needs $quotes_json to be set
 | 
					 | 
				
			||||||
    len=$(echo "$quotes_json" | gojq '. | length ')
 | 
					 | 
				
			||||||
    qotd=$(( $RANDOM % $len ))
 | 
					 | 
				
			||||||
    quote=$(echo "$quotes_json" | gojq -r ".[$qotd].q")
 | 
					 | 
				
			||||||
    author=$(echo "$quotes_json" | gojq -r ".[$qotd].a")
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cur_date=$(date +%m-%d)
 | 
					 | 
				
			||||||
quotes_file="$HOME/.dotfiles/bin/startup/$cur_date.json"
 | 
					 | 
				
			||||||
if [[ ! -f $quotes_file ]] ; then
 | 
					 | 
				
			||||||
    # quotes file doesn't exist
 | 
					 | 
				
			||||||
    # remove old files and create new one
 | 
					 | 
				
			||||||
    quotes_json=$(curl --silent -fL "https://zenquotes.io/api/quotes/")
 | 
					 | 
				
			||||||
    old_files="$HOME"/.dotfiles/bin/startup/*.json
 | 
					 | 
				
			||||||
    if [[ ! -z $old_files ]] ; then
 | 
					 | 
				
			||||||
        rm "$HOME"/.dotfiles/bin/startup/*.json
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
    echo "$quotes_json" > "$HOME/.dotfiles/bin/startup/$cur_date.json"
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
    # quotes file doesn't exist
 | 
					 | 
				
			||||||
    quotes_json=$(cat "$quotes_file")
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
get_qotd # sets quote and author
 | 
					 | 
				
			||||||
printf '"%s"\n   - %s\n' "$quote" "$author" | fold -s
 | 
					 | 
				
			||||||
@ -1,36 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
SESSION="doormat" # welcom session name
 | 
					 | 
				
			||||||
START_SERVER=false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set_session() {
 | 
					 | 
				
			||||||
    # sets $SESSION variable to doormat
 | 
					 | 
				
			||||||
    active_sessions=$(tmux list-sessions 2>/dev/null)
 | 
					 | 
				
			||||||
    if [[ ! -z "$active_sessions" ]] ; then
 | 
					 | 
				
			||||||
        # active sessions
 | 
					 | 
				
			||||||
        session=$(echo "$active_sessions" | grep "$SESSION" | cut -d ':' -f 1 2>/dev/null)
 | 
					 | 
				
			||||||
# tmux doormat script
 | 
					 | 
				
			||||||
        if [[ "$session" != "$SESSION" ]] ; then
 | 
					 | 
				
			||||||
            # door mat doesn't exist
 | 
					 | 
				
			||||||
            START_SERVER=true
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        START_SERVER=true
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    if $START_SERVER ; then
 | 
					 | 
				
			||||||
        # need to start server
 | 
					 | 
				
			||||||
        tmux new-session -d -s "$SESSION"
 | 
					 | 
				
			||||||
        tmux set-hook -t "$SESSION" client-attached 'run-shell ~/.dotfiles/bin/startup/lay_doormat.sh'
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set_session
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
while getopts "s" arg; do
 | 
					 | 
				
			||||||
    case $arg in
 | 
					 | 
				
			||||||
        s)
 | 
					 | 
				
			||||||
            echo "SESSION=$SESSION"
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
done    
 | 
					 | 
				
			||||||
							
								
								
									
										1
									
								
								bin/timetracker
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								bin/timetracker
									
									
									
									
									
										Symbolic link
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					/home/keegan/.dotfiles/src/timetracker/timetracker.sh
 | 
				
			||||||
@ -1,134 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Time sheet creator
 | 
					 | 
				
			||||||
# Stores clock in and outs to timesheet named for the ending date of the ts
 | 
					 | 
				
			||||||
usage() {
 | 
					 | 
				
			||||||
    cat <<EOF
 | 
					 | 
				
			||||||
Usage: timetracker [-i|o|t|v|h]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Tracks timesheets automatically
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Options:
 | 
					 | 
				
			||||||
  -i, --in          clock in
 | 
					 | 
				
			||||||
  -o, --out         clock out
 | 
					 | 
				
			||||||
  -t, --total       totals the hours worked
 | 
					 | 
				
			||||||
  -v, --visualize   prints the timesheet
 | 
					 | 
				
			||||||
  -h, --help        display this message
 | 
					 | 
				
			||||||
EOF
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# dir for timesheets
 | 
					 | 
				
			||||||
TIMESHEET_DIR="$HOME/.dotfiles/bin/timetracker/timesheets"
 | 
					 | 
				
			||||||
# existing
 | 
					 | 
				
			||||||
TIMESHEET=$(ls "$HOME/.dotfiles/bin/timetracker/timesheets" | grep ".csv")
 | 
					 | 
				
			||||||
# generated by clock in
 | 
					 | 
				
			||||||
CURRENT_SESSION="${TIMESHEET_DIR}/.session"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
createTimesheet() {
 | 
					 | 
				
			||||||
    payperiods=$((($(date +%s) - $(date -d "Dec-30-22" +%s)) / (14*24*3600)))
 | 
					 | 
				
			||||||
    period_end=$(date -d "Dec-30-22 + $((($payperiods + 1) * 14)) days" +%b-%d-%y)
 | 
					 | 
				
			||||||
    TIMESHEET=$(printf "%s.csv" "$period_end")
 | 
					 | 
				
			||||||
    # create timesheet 
 | 
					 | 
				
			||||||
    echo "Date, Time In, Time Out, Total Time (HH:MM)" > "${TIMESHEET_DIR}/${TIMESHEET}"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
getTimesheet() {
 | 
					 | 
				
			||||||
    # get Timesheet to use
 | 
					 | 
				
			||||||
    if [[ -z "$TIMESHEET" ]] ; then
 | 
					 | 
				
			||||||
        # no timesheet, create one
 | 
					 | 
				
			||||||
        createTimesheet
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        # timesheet found, check we are still in period
 | 
					 | 
				
			||||||
        period_end=$(date -d "$(echo "$TIMESHEET" | awk -F . '{print $1}') + 1 days" +%s) 
 | 
					 | 
				
			||||||
        if [[ $(date +%s) -ge $period_end ]] ; then
 | 
					 | 
				
			||||||
            # past timesheet, moving to archive and creating new
 | 
					 | 
				
			||||||
            mv ${TIMESHEET_DIR}/${TIMESHEET} ${TIMESHEET_DIR}/archive
 | 
					 | 
				
			||||||
            createTimesheet
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
clockIn() {
 | 
					 | 
				
			||||||
    # clock in by creating env file
 | 
					 | 
				
			||||||
    curdate=$(date +%s)
 | 
					 | 
				
			||||||
    env_details=$(printf 'DATE=%s\nTIME_IN=%s\n' "$curdate" "$curdate")
 | 
					 | 
				
			||||||
    if [[ ! -f "$CURRENT_SESSION" ]] ; then
 | 
					 | 
				
			||||||
        # creating session
 | 
					 | 
				
			||||||
        echo "$env_details" > "$CURRENT_SESSION"
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        echo "Already Clocked In!" >&2
 | 
					 | 
				
			||||||
        exit 1
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
clockOut() {
 | 
					 | 
				
			||||||
    # clock out
 | 
					 | 
				
			||||||
    if [[ -f "$CURRENT_SESSION" ]] ; then
 | 
					 | 
				
			||||||
        # session exists, get info
 | 
					 | 
				
			||||||
        source "$CURRENT_SESSION"
 | 
					 | 
				
			||||||
        # printing to timesheet
 | 
					 | 
				
			||||||
        TIME_OUT=$(date +%s) 
 | 
					 | 
				
			||||||
        TOTAL_TIME=$(($TIME_OUT - $TIME_IN + 3600 * 5)) 
 | 
					 | 
				
			||||||
        echo "$TOTAL_TIME"
 | 
					 | 
				
			||||||
        # printing to timesheet
 | 
					 | 
				
			||||||
        printf '%s, %s, %s, %s\n' "$(date -d @$DATE "+%a %b-%d")" "$(date -d @$TIME_IN +%I:%M%P)" "$(date -d @$TIME_OUT +%I:%M%P)" "$(date -d @$TOTAL_TIME +%H:%M)" >> ${TIMESHEET_DIR}/${TIMESHEET}
 | 
					 | 
				
			||||||
        # cleaning up session
 | 
					 | 
				
			||||||
        rm ${CURRENT_SESSION}
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        # no session
 | 
					 | 
				
			||||||
        echo "Not clocked in!" >&2
 | 
					 | 
				
			||||||
        exit 1
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
visualize() {
 | 
					 | 
				
			||||||
    # visualize the current timesheet
 | 
					 | 
				
			||||||
    column -s "," -t < ${TIMESHEET_DIR}/${TIMESHEET}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
totalHours() {
 | 
					 | 
				
			||||||
    # tally up hours for the current timesheet
 | 
					 | 
				
			||||||
    while read -r entry; do
 | 
					 | 
				
			||||||
        date=$(echo "$entry" | awk -F , '{print $1}' | tr -d ",\n")
 | 
					 | 
				
			||||||
        time=$(echo "$entry" | awk -F , '{print $4}' | tr -d " ,\n")
 | 
					 | 
				
			||||||
        if [[ "$date" != "Date" ]] ; then
 | 
					 | 
				
			||||||
            printf 'On %s worked %s\n' "$date" "$time"
 | 
					 | 
				
			||||||
            hours=$(($hours + 10#$(echo "$time" | awk -F : '{print $1}')))
 | 
					 | 
				
			||||||
            mins=$(($mins + 10#$(echo "$time" | awk -F : '{print $2}')))
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    done < ${TIMESHEET_DIR}/${TIMESHEET}
 | 
					 | 
				
			||||||
    hours=$(($hours + $mins/60)) # overflow
 | 
					 | 
				
			||||||
    mins=$(($mins%60))
 | 
					 | 
				
			||||||
    printf 'Worked %d hours, %d minutes\n' "$hours" "$mins"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# get the timesheet
 | 
					 | 
				
			||||||
getTimesheet
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# parse args
 | 
					 | 
				
			||||||
while [[ $# -gt 0 ]] ; do
 | 
					 | 
				
			||||||
    case $1 in
 | 
					 | 
				
			||||||
        -h | --help)
 | 
					 | 
				
			||||||
            usage
 | 
					 | 
				
			||||||
            exit 0
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        -i | --in)
 | 
					 | 
				
			||||||
            clockIn
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        -o | --out)
 | 
					 | 
				
			||||||
            clockOut
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        -v | --visualize)
 | 
					 | 
				
			||||||
            visualize
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        -t | --total)
 | 
					 | 
				
			||||||
            totalHours
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        *)
 | 
					 | 
				
			||||||
            echo "Error: Unrecognized" >&2
 | 
					 | 
				
			||||||
            usage
 | 
					 | 
				
			||||||
            exit 1
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
    shift
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
							
								
								
									
										1
									
								
								bin/water
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								bin/water
									
									
									
									
									
										Symbolic link
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					/home/keegan/.dotfiles/src/watertracker/watertracker.sh
 | 
				
			||||||
@ -1,291 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# this script enables water tracking in tmux status bar via a simple command
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
usage() {
 | 
					 | 
				
			||||||
    cat <<EOF
 | 
					 | 
				
			||||||
usage: $0 [-chr][-s|S][-u|U QTY] [WATER]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Options:
 | 
					 | 
				
			||||||
  -c, --colorize    enables tmux color options
 | 
					 | 
				
			||||||
  -s, --symbol      enables static nerdfont compaitable symbol
 | 
					 | 
				
			||||||
  -S                enables dynamic nf symbol 
 | 
					 | 
				
			||||||
  -u, --undo        removes the last entry
 | 
					 | 
				
			||||||
  -U                removes the last QTY entries.
 | 
					 | 
				
			||||||
                     use all as QTY to remove all entries
 | 
					 | 
				
			||||||
  -r, --reminder    creates a tmux pop up to remind you to hydrate
 | 
					 | 
				
			||||||
  -h, --help        display this message
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The reminder works based on specified water goals
 | 
					 | 
				
			||||||
Defaults to 32 ounces by 10 am, 64 by 1 pm, 96 by 5 pm, and 128 by 8 pm
 | 
					 | 
				
			||||||
Goals are defined in the script itself.
 | 
					 | 
				
			||||||
If a sub goal is not reached, the reminder will trigger
 | 
					 | 
				
			||||||
Reminders have a dismiss option as well as an entry box to enter the water drank
 | 
					 | 
				
			||||||
Reminders will pop up every 30 minutes until the goal is reached
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The WATER arguement is an integer and will be added to the current total.
 | 
					 | 
				
			||||||
If a mistake is made, -u can remove the faulty entry.
 | 
					 | 
				
			||||||
EOF
 | 
					 | 
				
			||||||
exit $1
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Hydration thresholds for reminders, all in fl. oz.
 | 
					 | 
				
			||||||
# Triggers reminder if you aren't at GOAL#/INTAKE by the assocaited time
 | 
					 | 
				
			||||||
# so in this example, if I don't drink 32 ounces by 10 am, I will get an alert
 | 
					 | 
				
			||||||
# 64 ounces by 1 pm, etc.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
####################################
 | 
					 | 
				
			||||||
GOAL_AMT=128
 | 
					 | 
				
			||||||
GOALS=( "10:00" "13:00" "16:00" "20:00" ) 
 | 
					 | 
				
			||||||
SNOOZE=$((30 * 60)) # time between reminders (s)
 | 
					 | 
				
			||||||
####################################
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
DATE=$(date +%b_%d_%y)
 | 
					 | 
				
			||||||
TIME=$(date +%H:%M:%S)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
WATER_DIR="$HOME/.dotfiles/bin/water"
 | 
					 | 
				
			||||||
WATERFILE="${WATER_DIR}/${DATE}.csv" # makes it easy to reset on each new day
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# make dir on fresh installs
 | 
					 | 
				
			||||||
if [[ ! -d "${WATER_DIR}/archive" ]] ; then
 | 
					 | 
				
			||||||
    mkdir -p "${WATER_DIR}/archive"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
check_reminder() {
 | 
					 | 
				
			||||||
    # checks for reminder
 | 
					 | 
				
			||||||
    # uses tmux to push reminder
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ -z "$TMUX" ]] ; then
 | 
					 | 
				
			||||||
        echo "TMUX required for reminder!"
 | 
					 | 
				
			||||||
        exit 1
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # this will round up
 | 
					 | 
				
			||||||
    goal_incr=$((($GOAL_AMT + ${#GOALS[@]}-1) / ${#GOALS[@]}))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # based on water drank, time to check
 | 
					 | 
				
			||||||
    cur_indx=$(($CURRENT_WATER / $goal_incr))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ $CURRENT_WATER -lt $GOAL_AMT ]] ; then
 | 
					 | 
				
			||||||
        # goals not finished, check pace
 | 
					 | 
				
			||||||
        time_unix=$(date -d "$TIME" +%s)
 | 
					 | 
				
			||||||
        expired=$(( $(date -d "${GOALS[$cur_indx]}" +%s) - $time_unix))
 | 
					 | 
				
			||||||
         
 | 
					 | 
				
			||||||
        if [[ $expired -lt 0 ]] ; then
 | 
					 | 
				
			||||||
            # goal missed, check snooze
 | 
					 | 
				
			||||||
            source "$WATER_DIR/.reminder" 2>/dev/null
 | 
					 | 
				
			||||||
            # check elapsed
 | 
					 | 
				
			||||||
            if [[ $time_unix -gt $REMINDER_SNOOZE ]] ; then
 | 
					 | 
				
			||||||
                # trigger reminder
 | 
					 | 
				
			||||||
                goal=$(( ($GOAL_AMT * ($cur_indx + 1)) / ${#GOALS[@]}))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                fmt_time=$(date -d "${GOALS[$cur_indx]}" "+%l:%M %P")
 | 
					 | 
				
			||||||
                rem_info=$(printf 'You have only drank %d fl. oz. while your goal is to drink %d fl. oz. by %s!\n\nThis reminder will reappear in %d minutes unless you consume fluids!\n\nOr, mute this reminder until tomorrow' $CURRENT_WATER $goal "$fmt_time" $(($SNOOZE/60)))
 | 
					 | 
				
			||||||
                tmux display-popup -E\
 | 
					 | 
				
			||||||
                    dialog\
 | 
					 | 
				
			||||||
                    --title 'DEHYDRATION ALERT'\
 | 
					 | 
				
			||||||
                    --yes-label 'Dismiss'\
 | 
					 | 
				
			||||||
                    --no-label 'Mute'\
 | 
					 | 
				
			||||||
                    --yesno \
 | 
					 | 
				
			||||||
                    "$rem_info" 0 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                # check for mute
 | 
					 | 
				
			||||||
                if [[ $? == 1 ]] ; then
 | 
					 | 
				
			||||||
                    # muted until tomorrow
 | 
					 | 
				
			||||||
                    TTS=$(date -d "tomorrow 00:00:00" +%s)
 | 
					 | 
				
			||||||
                else 
 | 
					 | 
				
			||||||
                    TTS=$(( $(date +%s) + $SNOOZE))
 | 
					 | 
				
			||||||
                fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                # update last_reminder
 | 
					 | 
				
			||||||
                printf 'REMINDER_SNOOZE=%d\n' $TTS > "$WATER_DIR/.reminder"
 | 
					 | 
				
			||||||
            fi
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
get_current_amt() {
 | 
					 | 
				
			||||||
    # gets the current water intake
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ ! -f "$WATERFILE" ]] ; then
 | 
					 | 
				
			||||||
        # no waterfile
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # archiving old file
 | 
					 | 
				
			||||||
        mv ${WATER_DIR}/*.csv ${WATER_DIR}/archive
 | 
					 | 
				
			||||||
        # creating new file for the day
 | 
					 | 
				
			||||||
        printf 'Time, Change, Running Total\n' > "$WATERFILE"
 | 
					 | 
				
			||||||
        printf '%s, 0, 0\n' "$TIME" >> "$WATERFILE"
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        # waterfile exists
 | 
					 | 
				
			||||||
        CURRENT_WATER=$(cat $WATERFILE | tail -n 1 | awk '{print $3}')
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
update_water() {
 | 
					 | 
				
			||||||
    # updates water based on $WATER_CHANGE
 | 
					 | 
				
			||||||
    CURRENT_WATER=$(($CURRENT_WATER + $WATER_CHANGE))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # putting in file
 | 
					 | 
				
			||||||
    printf '%s, %d, %d\n' "$TIME" $WATER_CHANGE $CURRENT_WATER >> "$WATERFILE"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
undo_changes() {
 | 
					 | 
				
			||||||
    # removes specifed entries
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # gets the lines of entries
 | 
					 | 
				
			||||||
    WATER_LINES=$(($(wc -l < "$WATERFILE") - 2)) 
 | 
					 | 
				
			||||||
    if [[ $WATER_LINES -gt 0 ]] ; then
 | 
					 | 
				
			||||||
        # removing entries
 | 
					 | 
				
			||||||
        if [[ "$1" == "all" || "$1" == "ALL" ]] ; then
 | 
					 | 
				
			||||||
            # force a reset
 | 
					 | 
				
			||||||
            REMOVAL=$WATER_LINES
 | 
					 | 
				
			||||||
        elif [[ $1 =~ ^[0-9]+$ ]] ; then
 | 
					 | 
				
			||||||
            # remove $1 changes
 | 
					 | 
				
			||||||
            REMOVAL=$1
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
            printf 'Arguement %s not recognized\n' "$1"
 | 
					 | 
				
			||||||
            usage
 | 
					 | 
				
			||||||
            exit 1
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        choice=$(bash -c "read -p 'Are you sure you want to remove the changes? (y/n)' -n 1 -r c; echo \$c")
 | 
					 | 
				
			||||||
        echo ""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if [[ $REPLY =~ ^[Yy]$ ]] ; then
 | 
					 | 
				
			||||||
            # remove
 | 
					 | 
				
			||||||
            if [[ $WATER_LINES -gt $REMOVAL ]] ; then
 | 
					 | 
				
			||||||
                # removing specified lines
 | 
					 | 
				
			||||||
                last_line=$(($WATER_LINES - $1 + 1)) # account for offset
 | 
					 | 
				
			||||||
                sed -i "$last_line ,$ d" "$WATERFILE"
 | 
					 | 
				
			||||||
            else 
 | 
					 | 
				
			||||||
                # essentially a reset
 | 
					 | 
				
			||||||
                printf 'Time, Change, Running Total\n' > "$WATERFILE"
 | 
					 | 
				
			||||||
                printf '%s, 0, 0\n' "$TIME" >> "$WATERFILE"
 | 
					 | 
				
			||||||
            fi
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
    echo "Done!\n"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
colorize() {
 | 
					 | 
				
			||||||
    # sends water intake level through conditionals to be colorized
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ $1 -lt 32 ]] ; then
 | 
					 | 
				
			||||||
        color='#[fg=color1]' # red
 | 
					 | 
				
			||||||
    elif [[ $1 -lt 64 ]] ; then
 | 
					 | 
				
			||||||
        color='#[fg=color3]' # bad yellow
 | 
					 | 
				
			||||||
    elif [[ $1 -lt 96 ]] ; then
 | 
					 | 
				
			||||||
        color='#[fg=color226]' # pale yellow
 | 
					 | 
				
			||||||
    elif [[ $1 -lt 128 ]] ; then
 | 
					 | 
				
			||||||
        color='#[fg=color10]' # light green
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        color='#[fg=color21]' # blue 
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    printf '%s' "$color"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
print_water() {
 | 
					 | 
				
			||||||
    # prints total
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # dynamic symbol, uses battery because close enough
 | 
					 | 
				
			||||||
    # colors blue to avoid mistaking
 | 
					 | 
				
			||||||
    if [ "$DYN_SYMBOL" = true ] ; then
 | 
					 | 
				
			||||||
        lvl=$((($CURRENT_WATER * 10) / $GOAL_AMT)) # rounds down to nearst 10%
 | 
					 | 
				
			||||||
        # base = full
 | 
					 | 
				
			||||||
        SYM='\uf578'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if [[ $lvl -eq 0 ]] ; then
 | 
					 | 
				
			||||||
            SYM='\uf58d'
 | 
					 | 
				
			||||||
        elif [[ $lvl -lt 9 ]] ; then
 | 
					 | 
				
			||||||
            # leverage consecutive symbols
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SYM=$(printf 'f5%x' $((120+$lvl)))
 | 
					 | 
				
			||||||
            SYM=$(echo -e "\u$SYM")
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
        if [ "$COLORIZE" = true ] ; then
 | 
					 | 
				
			||||||
            clr="#[fg=color21]"
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
        printf '%s%s ' "$clr" "$SYM"
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [ "$COLORIZE" = true ] ; then
 | 
					 | 
				
			||||||
        dflt="#[default]"
 | 
					 | 
				
			||||||
        printf '%s' "$(colorize $CURRENT_WATER)"
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # static symbol
 | 
					 | 
				
			||||||
    if [ "$SYMBOL" = true ] ; then
 | 
					 | 
				
			||||||
        printf '\uf6aa '
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    printf '%d%s\n' $CURRENT_WATER "$dflt"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # checks for a reminder
 | 
					 | 
				
			||||||
    if [[ "$REMINDER" = true ]] ; then
 | 
					 | 
				
			||||||
        # reminders enabled
 | 
					 | 
				
			||||||
        check_reminder
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# handle long forms
 | 
					 | 
				
			||||||
for arg in "$@"; do
 | 
					 | 
				
			||||||
    shift
 | 
					 | 
				
			||||||
    case "$arg" in
 | 
					 | 
				
			||||||
        '--help')       set -- "$@" "-h"    ;;
 | 
					 | 
				
			||||||
        '--colorize')   set -- "$@" "-c"    ;;
 | 
					 | 
				
			||||||
        '--reminder')   set -- "$@" "-r"    ;;
 | 
					 | 
				
			||||||
        '--undo')       set -- "$@" "-u"    ;;
 | 
					 | 
				
			||||||
        '--symbol')     set -- "$@" "-s"    ;;
 | 
					 | 
				
			||||||
        *)              set -- "$@" "$arg"  ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
get_current_amt
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# parsing args
 | 
					 | 
				
			||||||
while getopts "hcrsSuU:" opt ; do
 | 
					 | 
				
			||||||
    case "$opt" in 
 | 
					 | 
				
			||||||
        'c' )
 | 
					 | 
				
			||||||
            COLORIZE=true
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        's' )
 | 
					 | 
				
			||||||
            [ -n "$DYN_SYMBOL" ] && usage 1 || SYMBOL=true
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        'S' )
 | 
					 | 
				
			||||||
            [ -n "$SYMBOL" ] && usage 1 || DYN_SYMBOL=true
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        'u' )
 | 
					 | 
				
			||||||
            [ -n "$UNDO" ] && usage 1 || UNDO=1
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        'U' )
 | 
					 | 
				
			||||||
            [ -n "$UNDO" ] && usage 1 || UNDO="$optarg"
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        'r' )
 | 
					 | 
				
			||||||
            REMINDER=true
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        'h' )
 | 
					 | 
				
			||||||
            usage
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        '?' )
 | 
					 | 
				
			||||||
            usage 1 >&2
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# perform undo
 | 
					 | 
				
			||||||
if [[ ! -z "$UNDO" ]] ; then
 | 
					 | 
				
			||||||
    undo_changes "$UNDO"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
shift $(($OPTIND - 1))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
WATER_CHANGE=$1
 | 
					 | 
				
			||||||
if [[ ! -z "$WATER_CHANGE" ]] ; then
 | 
					 | 
				
			||||||
    # prevent empty/0 updates
 | 
					 | 
				
			||||||
    update_water
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
print_water
 | 
					 | 
				
			||||||
							
								
								
									
										1
									
								
								bin/weather
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								bin/weather
									
									
									
									
									
										Symbolic link
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					/home/keegan/.dotfiles/src/weather/weather.sh
 | 
				
			||||||
@ -1,4 +0,0 @@
 | 
				
			|||||||
STATE=MA
 | 
					 | 
				
			||||||
CITY=Cambridge
 | 
					 | 
				
			||||||
LAT=42.3737
 | 
					 | 
				
			||||||
LON=-71.1284
 | 
					 | 
				
			||||||
@ -1,9 +0,0 @@
 | 
				
			|||||||
TEMP=42.08000000000000000000
 | 
					 | 
				
			||||||
HUMIDITY=88.816089115542
 | 
					 | 
				
			||||||
ICON=ovc
 | 
					 | 
				
			||||||
LOCATION=
 | 
					 | 
				
			||||||
ZONE=https://api.weather.gov/zones/forecast/MAZ014
 | 
					 | 
				
			||||||
CITY=Cambridge
 | 
					 | 
				
			||||||
STATE=MA
 | 
					 | 
				
			||||||
TOD=night
 | 
					 | 
				
			||||||
EXPIRATION=1673570865
 | 
					 | 
				
			||||||
@ -1,48 +0,0 @@
 | 
				
			|||||||
    "113": "Sunny",
 | 
					 | 
				
			||||||
    "116": "PartlyCloudy",
 | 
					 | 
				
			||||||
    "119": "Cloudy",
 | 
					 | 
				
			||||||
    "122": "VeryCloudy",
 | 
					 | 
				
			||||||
    "143": "Fog",
 | 
					 | 
				
			||||||
    "176": "LightShowers",
 | 
					 | 
				
			||||||
    "179": "LightSleetShowers",
 | 
					 | 
				
			||||||
    "182": "LightSleet",
 | 
					 | 
				
			||||||
    "185": "LightSleet",
 | 
					 | 
				
			||||||
    "200": "ThunderyShowers",
 | 
					 | 
				
			||||||
    "227": "LightSnow",
 | 
					 | 
				
			||||||
    "230": "HeavySnow",
 | 
					 | 
				
			||||||
    "248": "Fog",
 | 
					 | 
				
			||||||
    "260": "Fog",
 | 
					 | 
				
			||||||
    "263": "LightShowers",
 | 
					 | 
				
			||||||
    "266": "LightRain",
 | 
					 | 
				
			||||||
    "281": "LightSleet",
 | 
					 | 
				
			||||||
    "284": "LightSleet",
 | 
					 | 
				
			||||||
    "293": "LightRain",
 | 
					 | 
				
			||||||
    "296": "LightRain",
 | 
					 | 
				
			||||||
    "299": "HeavyShowers",
 | 
					 | 
				
			||||||
    "302": "HeavyRain",
 | 
					 | 
				
			||||||
    "305": "HeavyShowers",
 | 
					 | 
				
			||||||
    "308": "HeavyRain",
 | 
					 | 
				
			||||||
    "311": "LightSleet",
 | 
					 | 
				
			||||||
    "314": "LightSleet",
 | 
					 | 
				
			||||||
    "317": "LightSleet",
 | 
					 | 
				
			||||||
    "320": "LightSnow",
 | 
					 | 
				
			||||||
    "323": "LightSnowShowers",
 | 
					 | 
				
			||||||
    "326": "LightSnowShowers",
 | 
					 | 
				
			||||||
    "329": "HeavySnow",
 | 
					 | 
				
			||||||
    "332": "HeavySnow",
 | 
					 | 
				
			||||||
    "335": "HeavySnowShowers",
 | 
					 | 
				
			||||||
    "338": "HeavySnow",
 | 
					 | 
				
			||||||
    "350": "LightSleet",
 | 
					 | 
				
			||||||
    "353": "LightShowers",
 | 
					 | 
				
			||||||
    "356": "HeavyShowers",
 | 
					 | 
				
			||||||
    "359": "HeavyRain",
 | 
					 | 
				
			||||||
    "362": "LightSleetShowers",
 | 
					 | 
				
			||||||
    "365": "LightSleetShowers",
 | 
					 | 
				
			||||||
    "368": "LightSnowShowers",
 | 
					 | 
				
			||||||
    "371": "HeavySnowShowers",
 | 
					 | 
				
			||||||
    "374": "LightSleetShowers",
 | 
					 | 
				
			||||||
    "377": "LightSleet",
 | 
					 | 
				
			||||||
    "386": "ThunderyShowers",
 | 
					 | 
				
			||||||
    "389": "ThunderyHeavyRain",
 | 
					 | 
				
			||||||
    "392": "ThunderySnowShowers",
 | 
					 | 
				
			||||||
    "395": "HeavySnowShowers",
 | 
					 | 
				
			||||||
@ -1,5 +0,0 @@
 | 
				
			|||||||
module weather
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
go 1.18
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
require github.com/joho/godotenv v1.4.0 // indirect
 | 
					 | 
				
			||||||
@ -1,2 +0,0 @@
 | 
				
			|||||||
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
 | 
					 | 
				
			||||||
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
 | 
					 | 
				
			||||||
@ -1,35 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
# creates a hidden file of your location details based on your address, will expand to support addition via zip codes
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
usage() { echo "Usage: $0 [-z zipcode]" 1>&2; exit 1; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [[ $# -eq 0 ]] ; then
 | 
					 | 
				
			||||||
    # called without args
 | 
					 | 
				
			||||||
    CURRENT_LOCATION=$(curl --silent http://ip-api.com/csv)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    CITY=$(echo "$CURRENT_LOCATION" | cut -d , -f 6)
 | 
					 | 
				
			||||||
    LAT=$(echo "$CURRENT_LOCATION" | cut -d , -f 8)
 | 
					 | 
				
			||||||
    LON=$(echo "$CURRENT_LOCATION" | cut -d , -f 9)
 | 
					 | 
				
			||||||
    printf "CITY=%s\nLAT=%s\nLON=%s\n" "$CITY" $LAT $LON > "$HOME/.dotfiles/bin/weather/.env.location"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
while getopts "z:" arg; do
 | 
					 | 
				
			||||||
    case ${arg} in
 | 
					 | 
				
			||||||
        z)
 | 
					 | 
				
			||||||
            ZIPCODE=${OPTARG}
 | 
					 | 
				
			||||||
            source "$HOME/.dotfiles/.priv/key"
 | 
					 | 
				
			||||||
            URL="http://api.openweathermap.org/geo/1.0/zip?zip=$ZIPCODE&appid=$API_KEY"
 | 
					 | 
				
			||||||
            LOCATION=$(curl --silent "$URL")
 | 
					 | 
				
			||||||
            CITY=$(echo $LOCATION | jq -r '.name')
 | 
					 | 
				
			||||||
            LAT=$(echo $LOCATION | jq -r '.lat')
 | 
					 | 
				
			||||||
            LON=$(echo $LOCATION | jq -r '.lon')
 | 
					 | 
				
			||||||
            printf "CITY=%s\nLAT=%s\nLON=%s\n" "$CITY" $LAT $LON > "$HOME/.dotfiles/bin/weather/.env.location"
 | 
					 | 
				
			||||||
            # emptying weather buffer
 | 
					 | 
				
			||||||
            >"$HOME/.dotfiles/bin/weather/.env.weather"
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        ?)
 | 
					 | 
				
			||||||
            usage
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,112 +0,0 @@
 | 
				
			|||||||
package main
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import (
 | 
					 | 
				
			||||||
	"fmt"
 | 
					 | 
				
			||||||
	"os"
 | 
					 | 
				
			||||||
	"os/exec"
 | 
					 | 
				
			||||||
	"strconv"
 | 
					 | 
				
			||||||
	"strings"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/joho/godotenv"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type Weather struct {
 | 
					 | 
				
			||||||
	Temp       float64
 | 
					 | 
				
			||||||
	Humidity   int
 | 
					 | 
				
			||||||
	Icon       rune
 | 
					 | 
				
			||||||
	City       string
 | 
					 | 
				
			||||||
	LastPinged int64
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type weathercode rune
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const (
 | 
					 | 
				
			||||||
	CLEAR_DAY           weathercode = '\ue30d'
 | 
					 | 
				
			||||||
	CLEAR_NIGHT         weathercode = '\ue32b'
 | 
					 | 
				
			||||||
	PARTLY_CLOUDY_DAY   weathercode = '\ue302'
 | 
					 | 
				
			||||||
	PARTLY_CLOUDY_NIGHT weathercode = '\ue379'
 | 
					 | 
				
			||||||
	CLOUDY              weathercode = '\ue312'
 | 
					 | 
				
			||||||
	RAIN                weathercode = '\ue318'
 | 
					 | 
				
			||||||
	THUNDERSTORM        weathercode = '\ue31d'
 | 
					 | 
				
			||||||
	SNOW                weathercode = '\ue31a'
 | 
					 | 
				
			||||||
	FOG                 weathercode = '\ue313'
 | 
					 | 
				
			||||||
	DEGREES_F           weathercode = '\ue341'
 | 
					 | 
				
			||||||
	HUMIDITY            weathercode = '\ue373'
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (w *Weather) String() string {
 | 
					 | 
				
			||||||
	return fmt.Sprintf(" %c  %.1f%c %d%c in %s", w.Icon, w.Temp, DEGREES_F, w.Humidity, HUMIDITY, w.City) // Output as ICON ##.#*F ##% in City, ST where the rune is a degree sign
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func main() {
 | 
					 | 
				
			||||||
	// getting weather
 | 
					 | 
				
			||||||
	if err := exec.Command(os.ExpandEnv("$HOME/.dotfiles/bin/weather/weather.sh")).Run(); err != nil {
 | 
					 | 
				
			||||||
		panic(err)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	// get up to date info
 | 
					 | 
				
			||||||
	loc := os.ExpandEnv(fmt.Sprintf("$HOME/.dotfiles/bin/weather/.env.location"))
 | 
					 | 
				
			||||||
	weath := os.ExpandEnv(fmt.Sprintf("$HOME/.dotfiles/bin/weather/.env.weather"))
 | 
					 | 
				
			||||||
	if err := godotenv.Load(weath, loc); err != nil {
 | 
					 | 
				
			||||||
		panic(err)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	var humidity int
 | 
					 | 
				
			||||||
	var temp float64
 | 
					 | 
				
			||||||
	var err error
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	city := os.Getenv("CITY")
 | 
					 | 
				
			||||||
	icon := getIcon(os.Getenv("ICON"))
 | 
					 | 
				
			||||||
	h := os.Getenv("HUMIDITY")
 | 
					 | 
				
			||||||
	t := os.Getenv("TEMP")
 | 
					 | 
				
			||||||
	if h != "" {
 | 
					 | 
				
			||||||
		hum, err := strconv.ParseInt(h, 10, 64)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			panic(err)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		humidity = int(hum)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if t != "" {
 | 
					 | 
				
			||||||
		temp, err = strconv.ParseFloat(t, 64)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			panic(err)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	weather := &Weather{City: city, Icon: icon, Humidity: humidity, Temp: temp}
 | 
					 | 
				
			||||||
	fmt.Print(weather)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func tod(day bool, dayrune weathercode, nightrune weathercode) rune {
 | 
					 | 
				
			||||||
	if day {
 | 
					 | 
				
			||||||
		return rune(dayrune)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return rune(nightrune)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func getIcon(code string) rune {
 | 
					 | 
				
			||||||
	weather := strings.Trim(code, "nd") // trimming day or night tag
 | 
					 | 
				
			||||||
	var day bool
 | 
					 | 
				
			||||||
	if strings.Contains(code, "d") {
 | 
					 | 
				
			||||||
		day = true
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		day = false
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	switch weather {
 | 
					 | 
				
			||||||
	case "01":
 | 
					 | 
				
			||||||
		return tod(day, CLEAR_DAY, CLEAR_NIGHT) // clear skies
 | 
					 | 
				
			||||||
	case "02", "03":
 | 
					 | 
				
			||||||
		return tod(day, PARTLY_CLOUDY_DAY, PARTLY_CLOUDY_NIGHT) // small clouds
 | 
					 | 
				
			||||||
	case "04":
 | 
					 | 
				
			||||||
		return rune(CLOUDY) // big clouds with sun
 | 
					 | 
				
			||||||
	case "09", "10":
 | 
					 | 
				
			||||||
		return rune(RAIN)
 | 
					 | 
				
			||||||
	case "11":
 | 
					 | 
				
			||||||
		return rune(THUNDERSTORM)
 | 
					 | 
				
			||||||
	case "13":
 | 
					 | 
				
			||||||
		return rune(SNOW)
 | 
					 | 
				
			||||||
	case "50":
 | 
					 | 
				
			||||||
		return rune(FOG)
 | 
					 | 
				
			||||||
	default:
 | 
					 | 
				
			||||||
		return '\uFFFD' // question mark
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,189 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
#source "$HOME/.dotfiles/.priv/key"
 | 
					 | 
				
			||||||
#source "$HOME/.dotfiles/bin/weather/.env.location"
 | 
					 | 
				
			||||||
#source "$HOME/.dotfiles/bin/weather/.env.weather"
 | 
					 | 
				
			||||||
# API_KEY=$(cat "$HOME/.dotfiles/bin/weather/.priv/key")
 | 
					 | 
				
			||||||
# getting weather
 | 
					 | 
				
			||||||
CUR_TIMESTAMP=$(date +%s)
 | 
					 | 
				
			||||||
# only update weather every 30 seconds
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [[ $CUR_TIMESTAMP -gt $EXPIRATION  || -z $EXPIRATION ]] ; then
 | 
					 | 
				
			||||||
    WEATHER=$(curl --silent "http://wttr.in/${LOCATION}?format=j2" | gojq -r '.current_condition[0]')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    echo $WEATHER
 | 
					 | 
				
			||||||
    TEMP=$(echo $WEATHER | gojq -r '.temp_F')
 | 
					 | 
				
			||||||
    HUMIDITY=$(echo $WEATHER | gojq -r '.humidity')
 | 
					 | 
				
			||||||
    ICON=$(echo $WEATHER | gojq -r '.weatherCode')
 | 
					 | 
				
			||||||
    EXPIRATION=$(($CUR_TIMESTAMP+30))
 | 
					 | 
				
			||||||
    echo "TEMP: $TEMP HUMIDITY: $HUMIDITY ICON: $ICON"
 | 
					 | 
				
			||||||
    #printf 'TEMP=%s\nHUMIDITY=%s\nICON=%s\nEXPIRATION=%s\n' "$TEMP" "$HUMIDITY" "$ICON" "$EXPIRATION" >"$HOME/.dotfiles/bin/weather/.env.weather"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
WEATHER_DIR="${HOME}/.dotfiles/bin/weather"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
usage() {
 | 
					 | 
				
			||||||
    cat <<EOF
 | 
					 | 
				
			||||||
Usage: wttr [-s] [-d] [-u] [-i] [-f] [-h]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Queries the weather and outputs it in a Nerd Font compaitable way
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Options:
 | 
					 | 
				
			||||||
  -p, --print           print the current weather information
 | 
					 | 
				
			||||||
  -s, --setloc=<LOC>    change location used for wttr.in query
 | 
					 | 
				
			||||||
                          will use IP if left blank
 | 
					 | 
				
			||||||
  -d, --disploc=<LOC>   show location used in query
 | 
					 | 
				
			||||||
  -f, --force           force refresh weather data
 | 
					 | 
				
			||||||
  -h, --help            Show this help message
 | 
					 | 
				
			||||||
EOF
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
get_wttr() {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ -z "$ZONE" || ! -z "$UPDATE" ]] ; then
 | 
					 | 
				
			||||||
        # getting grid points
 | 
					 | 
				
			||||||
        url="https://api.weather.gov/points/$LATITUDE,$LONGITUDE"
 | 
					 | 
				
			||||||
        GRID=$(curl --silent -fL "$url")
 | 
					 | 
				
			||||||
        query="{\
 | 
					 | 
				
			||||||
            zone:           .properties.forecastZone,\
 | 
					 | 
				
			||||||
            city:           .properties.relativeLocation.properties.city,\
 | 
					 | 
				
			||||||
            state:          .properties.relativeLocation.properties.state}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        res=$(echo "$GRID" | gojq "$query")
 | 
					 | 
				
			||||||
        echo "$res"
 | 
					 | 
				
			||||||
        CITY=$(echo "$res" | gojq '.city')
 | 
					 | 
				
			||||||
        STATE=$(echo "$res" | gojq '.state')
 | 
					 | 
				
			||||||
        ZONE=$(echo "$res" | gojq '.zone' | tr -d '"')
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    WEATHER=$(curl --silent -fL "$ZONE/observations" | gojq '.features[0].properties')
 | 
					 | 
				
			||||||
    query="{\
 | 
					 | 
				
			||||||
        temp:       .temperature.value,\
 | 
					 | 
				
			||||||
        humidity:   .relativeHumidity.value,\
 | 
					 | 
				
			||||||
        icon:       .icon}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    PARSED=$(echo "$WEATHER" | gojq "$query")
 | 
					 | 
				
			||||||
    TEMP=$(echo "$PARSED" | gojq '.temp')
 | 
					 | 
				
			||||||
    TEMP=$(echo "$TEMP * (9/5) + 32" | bc -l)
 | 
					 | 
				
			||||||
    HUMIDITY=$(echo "$PARSED" | gojq '.humidity')
 | 
					 | 
				
			||||||
    TOD=$(echo "$PARSED" | gojq '.icon' | awk -F / '{print $6}')
 | 
					 | 
				
			||||||
    ICON=$(echo "$PARSED" | gojq '.icon' | awk -F / '{print $7}' | awk -F ? '{print $1}')
 | 
					 | 
				
			||||||
    EXPIRATION=$(($(date +%s) + 60))
 | 
					 | 
				
			||||||
    printf 'TEMP=%s\nHUMIDITY=%s\nICON=%s\nLOCATION=%s\nZONE=%s\nCITY=%s\nSTATE=%s\nTOD=%s\nEXPIRATION=%s\n' "$TEMP" "$HUMIDITY" "$ICON" "$LOCATION" "$ZONE" "$CITY" "$STATE" "$TOD" "$EXPIRATION" > ${WEATHER_DIR}/.weather
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #### 
 | 
					 | 
				
			||||||
    # below is WTTR impl, using NWS above
 | 
					 | 
				
			||||||
    ####
 | 
					 | 
				
			||||||
    # gets weather for $LOCATION and stores it into file with timestamp
 | 
					 | 
				
			||||||
    # url="https://wttr.in/?format=j1&nonce=$RANDOM"
 | 
					 | 
				
			||||||
    # FULL_WTTR=$(curl --silent -fL "$url")
 | 
					 | 
				
			||||||
    # # parse relevant info
 | 
					 | 
				
			||||||
    # query="{\
 | 
					 | 
				
			||||||
    #     temp_F:       .current_condition[0].temp_F,\
 | 
					 | 
				
			||||||
    #     temp_C:       .current_condition[0].temp_C,\
 | 
					 | 
				
			||||||
    #     humidity:   .current_condition[0].humidity,\
 | 
					 | 
				
			||||||
    #     conditions: .current_condition[0].weatherCode,\
 | 
					 | 
				
			||||||
    #     location:   .nearest_area[0].areaName[0].value,\
 | 
					 | 
				
			||||||
    #     sunset:     .weather[0].astronomy[0].sunset,\
 | 
					 | 
				
			||||||
    #     sunrise:    .weather[1].astronomy[0].sunrise}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # WTTR=$(echo "$FULL_WTTR" | gojq "$query")
 | 
					 | 
				
			||||||
    # # Parsing info
 | 
					 | 
				
			||||||
    # TEMP=$(echo "$WTTR" | gojq .temp_"$UNITS")
 | 
					 | 
				
			||||||
    # HUMIDITY=$(echo "$WTTR" | gojq '.humidity')
 | 
					 | 
				
			||||||
    # CONDITIONS=$(echo "$WTTR" | gojq '.conditions')
 | 
					 | 
				
			||||||
    # LOCATION=$(echo "$WTTR" | gojq '.location')
 | 
					 | 
				
			||||||
    # # TOD info
 | 
					 | 
				
			||||||
    # SUNSET=$(echo "$WTTR" | gojq '.sunset' | tr -d ' "')
 | 
					 | 
				
			||||||
    # SUNRISE=$(echo "$WTTR" | gojq '.sunrise' | tr -d ' "')
 | 
					 | 
				
			||||||
    # # getting TOD
 | 
					 | 
				
			||||||
    # get_tod
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # # setting symbol
 | 
					 | 
				
			||||||
    # # updating weather info
 | 
					 | 
				
			||||||
    # printf 'UNITS=%s\nTEMP=%s\nHUMIDITY=%s\nCONDITIONS=%s\nLOCATION=%s\nEXPIRATION=%s\nTOD=%s\n' "$UNITS" "$TEMP" "$HUMIDITY" "$CONDITIONS" "$LOCATION" "$EXPIRATION" "$TOD" > ${WEATHER_DIR}/.weather
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set_location() {
 | 
					 | 
				
			||||||
    # updates location of weather query to $new_loc, can be empty
 | 
					 | 
				
			||||||
    LOCATION="$new_loc"
 | 
					 | 
				
			||||||
    UPDATE="true"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    url="https://v2.wttr.in/$LOCATION?format=j1"
 | 
					 | 
				
			||||||
    query="{\
 | 
					 | 
				
			||||||
        lat:   .nearest_area[0].latitude,\
 | 
					 | 
				
			||||||
        lon:   .nearest_area[0].longitude}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    WTTR=$(curl --silent -fL "$url" | gojq "$query")
 | 
					 | 
				
			||||||
    # Grabbing env vars
 | 
					 | 
				
			||||||
    LATITUDE=$(echo "$WTTR" | gojq '.lat' | tr -d ' "')
 | 
					 | 
				
			||||||
    LONGITUDE=$(echo "$WTTR" | gojq '.lon' | tr -d ' "')
 | 
					 | 
				
			||||||
    get_wttr
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
display_location() {
 | 
					 | 
				
			||||||
    # updates location to display to $disp_loc
 | 
					 | 
				
			||||||
    printf 'Searching %s, (%s, %s)\n' "$LOCATION" "$CITY" "$STATE"
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
load_wttr() {
 | 
					 | 
				
			||||||
    # loads and checks weather
 | 
					 | 
				
			||||||
    if [[ ! -f ${WEATHER_DIR}/.weather ]] ; then
 | 
					 | 
				
			||||||
        # file doesnt exist
 | 
					 | 
				
			||||||
        UNITS="F" # defaults to farenheit
 | 
					 | 
				
			||||||
        get_wttr
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # load env
 | 
					 | 
				
			||||||
    source ${WEATHER_DIR}/.weather
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # check for expiration
 | 
					 | 
				
			||||||
    if [[ $(date +%s) -ge $EXPIRATION ]] ; then
 | 
					 | 
				
			||||||
        get_wttr
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
print_wttr() {
 | 
					 | 
				
			||||||
    # stripping and reformatting quotations
 | 
					 | 
				
			||||||
    query=$(printf '.%s.%s' $TOD $ICON)
 | 
					 | 
				
			||||||
    SYMBOL=$(cat ${WEATHER_DIR}/symbols.json | gojq "$query" | tr -d '"')
 | 
					 | 
				
			||||||
    UNIT=$(echo -e "\ufa04")
 | 
					 | 
				
			||||||
    HUMID_SYMB=$(echo -e "\ue373")
 | 
					 | 
				
			||||||
    printf '%s %.1f%s %0.1f %s in %s, %s\n' "$SYMBOL" "$TEMP" "$UNIT" "$HUMIDITY" "$HUMID_SYMB" "$CITY" "$STATE"
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
load_wttr
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
while [[ "$1" != "" ]]; do
 | 
					 | 
				
			||||||
    case $1 in
 | 
					 | 
				
			||||||
    -h | --help)
 | 
					 | 
				
			||||||
        usage
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    -p | --print)
 | 
					 | 
				
			||||||
        print_wttr
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    -s | --setloc)
 | 
					 | 
				
			||||||
        shift
 | 
					 | 
				
			||||||
        new_loc="$1"
 | 
					 | 
				
			||||||
        set_location
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    -d | --disploc)
 | 
					 | 
				
			||||||
        shift
 | 
					 | 
				
			||||||
        display_location
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    -f | --force)
 | 
					 | 
				
			||||||
        get_wttr
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    *)
 | 
					 | 
				
			||||||
        echo "Error: wttr $@"
 | 
					 | 
				
			||||||
        usage
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
    shift
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
@ -1,11 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
# prints all symbols that can be used to test output with font
 | 
					 | 
				
			||||||
echo -e '\ue30d Clear (Day)'
 | 
					 | 
				
			||||||
echo -e '\ue32b Clear (Night)'
 | 
					 | 
				
			||||||
echo -e '\ue302 Partly Cloud (Day)'
 | 
					 | 
				
			||||||
echo -e '\ue379 Partly Cloudy (Night)'
 | 
					 | 
				
			||||||
echo -e '\ue312 Cloud'
 | 
					 | 
				
			||||||
echo -e '\ue318 Rain'
 | 
					 | 
				
			||||||
echo -e '\ue31d Thunderstorm'
 | 
					 | 
				
			||||||
echo -e '\ue31a Snow'
 | 
					 | 
				
			||||||
echo -e '\ue313 Fog'
 | 
					 | 
				
			||||||
@ -1,56 +0,0 @@
 | 
				
			|||||||
package main
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import "fmt"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var WeatherCodesDay map[string]rune
 | 
					 | 
				
			||||||
var WeatherCodesNight map[string]rune
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func SymbolTest() {
 | 
					 | 
				
			||||||
	WeatherCodesDay := map[string]rune{
 | 
					 | 
				
			||||||
		"Unkown":              '\ue374',
 | 
					 | 
				
			||||||
		"Cloudy":              '\ue302',
 | 
					 | 
				
			||||||
		"Fog":                 '\ue303',
 | 
					 | 
				
			||||||
		"HeavyRain":           '\ue318',
 | 
					 | 
				
			||||||
		"HeavyShowers":        '\ue318',
 | 
					 | 
				
			||||||
		"HeavySnow":           '\ue31a',
 | 
					 | 
				
			||||||
		"HeavySnowShowers":    '\ue31a',
 | 
					 | 
				
			||||||
		"LightRain":           '\ue308',
 | 
					 | 
				
			||||||
		"LightShowers":        '\ue308',
 | 
					 | 
				
			||||||
		"LightSleet":          '\ue3aa',
 | 
					 | 
				
			||||||
		"LightSleetShowers":   '\ue3aa',
 | 
					 | 
				
			||||||
		"LightSnow":           '\ue30a',
 | 
					 | 
				
			||||||
		"LightSnowShowers":    '\ue30a',
 | 
					 | 
				
			||||||
		"PartlyCloudy":        '\ue37b',
 | 
					 | 
				
			||||||
		"Sunny":               '\ue30d',
 | 
					 | 
				
			||||||
		"ThunderyHeavyRain":   '\ue31d',
 | 
					 | 
				
			||||||
		"ThunderyShowers":     '\ue31d',
 | 
					 | 
				
			||||||
		"ThunderySnowShowers": '\ue365',
 | 
					 | 
				
			||||||
		"VeryCloudy":          '\ue312',
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	WeatherCodesNight := map[string]rune{
 | 
					 | 
				
			||||||
		"Unkown":              '\ue374',
 | 
					 | 
				
			||||||
		"Cloudy":              '\ue37e',
 | 
					 | 
				
			||||||
		"Fog":                 '\ue346',
 | 
					 | 
				
			||||||
		"HeavyRain":           '\ue318',
 | 
					 | 
				
			||||||
		"HeavyShowers":        '\ue318',
 | 
					 | 
				
			||||||
		"HeavySnow":           '\ue31a',
 | 
					 | 
				
			||||||
		"HeavySnowShowers":    '\ue31a',
 | 
					 | 
				
			||||||
		"LightRain":           '\ue325',
 | 
					 | 
				
			||||||
		"LightShowers":        '\ue325',
 | 
					 | 
				
			||||||
		"LightSleet":          '\ue3ac',
 | 
					 | 
				
			||||||
		"LightSleetShowers":   '\ue3ac',
 | 
					 | 
				
			||||||
		"LightSnow":           '\ue361',
 | 
					 | 
				
			||||||
		"LightSnowShowers":    '\ue361',
 | 
					 | 
				
			||||||
		"PartlyCloudy":        '\ue379',
 | 
					 | 
				
			||||||
		"Sunny":               '\ue32b',
 | 
					 | 
				
			||||||
		"ThunderyHeavyRain":   '\ue31d',
 | 
					 | 
				
			||||||
		"ThunderyShowers":     '\ue31d',
 | 
					 | 
				
			||||||
		"ThunderySnowShowers": '\ue366',
 | 
					 | 
				
			||||||
		"VeryCloudy":          '\ue312',
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for k, v := range WeatherCodesDay {
 | 
					 | 
				
			||||||
		fmt.Printf("%s: %c %c\n", k, v, WeatherCodesNight[k])
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							@ -1,20 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
source "$HOME/.dotfiles/.priv/key"
 | 
					 | 
				
			||||||
source "$HOME/.dotfiles/bin/weather/.env.location"
 | 
					 | 
				
			||||||
source "$HOME/.dotfiles/bin/weather/.env.weather"
 | 
					 | 
				
			||||||
# API_KEY=$(cat "$HOME/.dotfiles/bin/weather/.priv/key")
 | 
					 | 
				
			||||||
# getting weather
 | 
					 | 
				
			||||||
CUR_TIMESTAMP=$(date +%s)
 | 
					 | 
				
			||||||
# only update weather every 30 seconds
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [[ $CUR_TIMESTAMP -gt $EXPIRATION  || -z $EXPIRATION ]] ; then
 | 
					 | 
				
			||||||
    WEATHER=$(curl --silent http://api.openweathermap.org/data/2.5/weather\?lat="$LAT"\&lon="$LON"\&appid="$API_KEY"\&units=imperial)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    echo $WEATHER
 | 
					 | 
				
			||||||
    TEMP=$(echo $WEATHER | gojq -r '.main.temp')
 | 
					 | 
				
			||||||
    HUMIDITY=$(echo $WEATHER | gojq -r '.main.humidity')
 | 
					 | 
				
			||||||
    ICON=$(echo $WEATHER | gojq -r '.weather[0].icon')
 | 
					 | 
				
			||||||
    EXPIRATION=$(($CUR_TIMESTAMP+30))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    printf 'TEMP=%s\nHUMIDITY=%s\nICON=%s\nEXPIRATION=%s\n' "$TEMP" "$HUMIDITY" "$ICON" "$EXPIRATION" >"$HOME/.dotfiles/bin/weather/.env.weather"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
@ -1,60 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
    "day": {
 | 
					 | 
				
			||||||
        "Unknown":              "",
 | 
					 | 
				
			||||||
        "bkn":                  "",
 | 
					 | 
				
			||||||
        "wind_bkn":             "",
 | 
					 | 
				
			||||||
        "fog":                  "",
 | 
					 | 
				
			||||||
        "rain":                 "",
 | 
					 | 
				
			||||||
        "rain_showers":         "",
 | 
					 | 
				
			||||||
        "rain_showers_hi":      "",
 | 
					 | 
				
			||||||
        "rain_snow":            "",
 | 
					 | 
				
			||||||
        "rain":                 "",
 | 
					 | 
				
			||||||
        "sleet":                "",
 | 
					 | 
				
			||||||
        "rain_sleet":           "",
 | 
					 | 
				
			||||||
        "fzra":                 "",
 | 
					 | 
				
			||||||
        "rain_fzra":            "",
 | 
					 | 
				
			||||||
        "snow_sleet":           "",
 | 
					 | 
				
			||||||
        "snow_frza":            "",
 | 
					 | 
				
			||||||
        "snow":                 "",
 | 
					 | 
				
			||||||
        "sct":                  "",
 | 
					 | 
				
			||||||
        "few":                  "",
 | 
					 | 
				
			||||||
        "wind_sct":             "",
 | 
					 | 
				
			||||||
        "wind_few":             "",
 | 
					 | 
				
			||||||
        "skc":                  "",
 | 
					 | 
				
			||||||
        "wind_skc":             "",
 | 
					 | 
				
			||||||
        "trsa":                 "",
 | 
					 | 
				
			||||||
        "trsa_sct":             "",
 | 
					 | 
				
			||||||
        "trsa_hi":              "",
 | 
					 | 
				
			||||||
        "ovc":                  "",
 | 
					 | 
				
			||||||
        "wind_ovc":             ""
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "night": {
 | 
					 | 
				
			||||||
        "Unknown":              "",
 | 
					 | 
				
			||||||
        "bkn":                  "",
 | 
					 | 
				
			||||||
        "wind_bkn":             "",
 | 
					 | 
				
			||||||
        "fog":                  "",
 | 
					 | 
				
			||||||
        "rain":                 "",
 | 
					 | 
				
			||||||
        "rain_showers":         "",
 | 
					 | 
				
			||||||
        "rain_showers_hi":      "",
 | 
					 | 
				
			||||||
        "rain_snow":            "",
 | 
					 | 
				
			||||||
        "rain":                 "",
 | 
					 | 
				
			||||||
        "rain_showers":         "",
 | 
					 | 
				
			||||||
        "rain_showers_hi":      "",
 | 
					 | 
				
			||||||
        "sleet":                "",
 | 
					 | 
				
			||||||
        "snow_sleet":           "",
 | 
					 | 
				
			||||||
        "snow_frza":            "",
 | 
					 | 
				
			||||||
        "snow":                 "",
 | 
					 | 
				
			||||||
        "sct":                  "",
 | 
					 | 
				
			||||||
        "few":                  "",
 | 
					 | 
				
			||||||
        "wind_sct":             "",
 | 
					 | 
				
			||||||
        "wind_few":             "",
 | 
					 | 
				
			||||||
        "skc":                  "",
 | 
					 | 
				
			||||||
        "wind_skc":             "",
 | 
					 | 
				
			||||||
        "trsa":                 "",
 | 
					 | 
				
			||||||
        "trsa_sct":             "",
 | 
					 | 
				
			||||||
        "trsa_hi":              "",
 | 
					 | 
				
			||||||
        "ovc":                  "",
 | 
					 | 
				
			||||||
        "wind_ovc":             ""
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,168 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
WEATHER_DIR="${HOME}/.dotfiles/bin/weather"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
usage() {
 | 
					 | 
				
			||||||
    cat <<EOF
 | 
					 | 
				
			||||||
Usage: wttr [-s] [-d] [-u] [-i] [-f] [-h]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Queries the weather and outputs it in a Nerd Font compaitable way
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Options:
 | 
					 | 
				
			||||||
  -p, --print           print the current weather information
 | 
					 | 
				
			||||||
  -s, --setloc=<LOC>    change location used for wttr.in query
 | 
					 | 
				
			||||||
                          will use IP if left blank
 | 
					 | 
				
			||||||
  -d, --disploc=<LOC>   show location used in query
 | 
					 | 
				
			||||||
  -f, --force           force refresh weather data
 | 
					 | 
				
			||||||
  -h, --help            Show this help message
 | 
					 | 
				
			||||||
EOF
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
get_wttr() {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [[ -z "$ZONE" || ! -z "$UPDATE" ]] ; then
 | 
					 | 
				
			||||||
        # getting grid points
 | 
					 | 
				
			||||||
        url="https://api.weather.gov/points/$LATITUDE,$LONGITUDE"
 | 
					 | 
				
			||||||
        GRID=$(curl --silent -fL "$url")
 | 
					 | 
				
			||||||
        query="{\
 | 
					 | 
				
			||||||
            zone:           .properties.forecastZone,\
 | 
					 | 
				
			||||||
            city:           .properties.relativeLocation.properties.city,\
 | 
					 | 
				
			||||||
            state:          .properties.relativeLocation.properties.state}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        res=$(echo "$GRID" | gojq "$query")
 | 
					 | 
				
			||||||
        echo "$res"
 | 
					 | 
				
			||||||
        CITY=$(echo "$res" | gojq '.city')
 | 
					 | 
				
			||||||
        STATE=$(echo "$res" | gojq '.state')
 | 
					 | 
				
			||||||
        ZONE=$(echo "$res" | gojq '.zone' | tr -d '"')
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    WEATHER=$(curl --silent -fL "$ZONE/observations" | gojq '.features[0].properties')
 | 
					 | 
				
			||||||
    query="{\
 | 
					 | 
				
			||||||
        temp:       .temperature.value,\
 | 
					 | 
				
			||||||
        humidity:   .relativeHumidity.value,\
 | 
					 | 
				
			||||||
        icon:       .icon}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    PARSED=$(echo "$WEATHER" | gojq "$query")
 | 
					 | 
				
			||||||
    TEMP=$(echo "$PARSED" | gojq '.temp')
 | 
					 | 
				
			||||||
    TEMP=$(echo "$TEMP * (9/5) + 32" | bc -l)
 | 
					 | 
				
			||||||
    HUMIDITY=$(echo "$PARSED" | gojq '.humidity')
 | 
					 | 
				
			||||||
    TOD=$(echo "$PARSED" | gojq '.icon' | awk -F / '{print $6}')
 | 
					 | 
				
			||||||
    ICON=$(echo "$PARSED" | gojq '.icon' | awk -F / '{print $7}' | awk -F ? '{print $1}')
 | 
					 | 
				
			||||||
    EXPIRATION=$(($(date +%s) + 60))
 | 
					 | 
				
			||||||
    printf 'TEMP=%s\nHUMIDITY=%s\nICON=%s\nLOCATION=%s\nZONE=%s\nCITY=%s\nSTATE=%s\nTOD=%s\nEXPIRATION=%s\n' "$TEMP" "$HUMIDITY" "$ICON" "$LOCATION" "$ZONE" "$CITY" "$STATE" "$TOD" "$EXPIRATION" > ${WEATHER_DIR}/.weather
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #### 
 | 
					 | 
				
			||||||
    # below is WTTR impl, using NWS above
 | 
					 | 
				
			||||||
    ####
 | 
					 | 
				
			||||||
    # gets weather for $LOCATION and stores it into file with timestamp
 | 
					 | 
				
			||||||
    # url="https://wttr.in/?format=j1&nonce=$RANDOM"
 | 
					 | 
				
			||||||
    # FULL_WTTR=$(curl --silent -fL "$url")
 | 
					 | 
				
			||||||
    # # parse relevant info
 | 
					 | 
				
			||||||
    # query="{\
 | 
					 | 
				
			||||||
    #     temp_F:       .current_condition[0].temp_F,\
 | 
					 | 
				
			||||||
    #     temp_C:       .current_condition[0].temp_C,\
 | 
					 | 
				
			||||||
    #     humidity:   .current_condition[0].humidity,\
 | 
					 | 
				
			||||||
    #     conditions: .current_condition[0].weatherCode,\
 | 
					 | 
				
			||||||
    #     location:   .nearest_area[0].areaName[0].value,\
 | 
					 | 
				
			||||||
    #     sunset:     .weather[0].astronomy[0].sunset,\
 | 
					 | 
				
			||||||
    #     sunrise:    .weather[1].astronomy[0].sunrise}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # WTTR=$(echo "$FULL_WTTR" | gojq "$query")
 | 
					 | 
				
			||||||
    # # Parsing info
 | 
					 | 
				
			||||||
    # TEMP=$(echo "$WTTR" | gojq .temp_"$UNITS")
 | 
					 | 
				
			||||||
    # HUMIDITY=$(echo "$WTTR" | gojq '.humidity')
 | 
					 | 
				
			||||||
    # CONDITIONS=$(echo "$WTTR" | gojq '.conditions')
 | 
					 | 
				
			||||||
    # LOCATION=$(echo "$WTTR" | gojq '.location')
 | 
					 | 
				
			||||||
    # # TOD info
 | 
					 | 
				
			||||||
    # SUNSET=$(echo "$WTTR" | gojq '.sunset' | tr -d ' "')
 | 
					 | 
				
			||||||
    # SUNRISE=$(echo "$WTTR" | gojq '.sunrise' | tr -d ' "')
 | 
					 | 
				
			||||||
    # # getting TOD
 | 
					 | 
				
			||||||
    # get_tod
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # # setting symbol
 | 
					 | 
				
			||||||
    # # updating weather info
 | 
					 | 
				
			||||||
    # printf 'UNITS=%s\nTEMP=%s\nHUMIDITY=%s\nCONDITIONS=%s\nLOCATION=%s\nEXPIRATION=%s\nTOD=%s\n' "$UNITS" "$TEMP" "$HUMIDITY" "$CONDITIONS" "$LOCATION" "$EXPIRATION" "$TOD" > ${WEATHER_DIR}/.weather
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set_location() {
 | 
					 | 
				
			||||||
    # updates location of weather query to $new_loc, can be empty
 | 
					 | 
				
			||||||
    LOCATION="$new_loc"
 | 
					 | 
				
			||||||
    UPDATE="true"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    url="https://v2.wttr.in/$LOCATION?format=j1"
 | 
					 | 
				
			||||||
    query="{\
 | 
					 | 
				
			||||||
        lat:   .nearest_area[0].latitude,\
 | 
					 | 
				
			||||||
        lon:   .nearest_area[0].longitude}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    WTTR=$(curl --silent -fL "$url" | gojq "$query")
 | 
					 | 
				
			||||||
    # Grabbing env vars
 | 
					 | 
				
			||||||
    LATITUDE=$(echo "$WTTR" | gojq '.lat' | tr -d ' "')
 | 
					 | 
				
			||||||
    LONGITUDE=$(echo "$WTTR" | gojq '.lon' | tr -d ' "')
 | 
					 | 
				
			||||||
    get_wttr
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
display_location() {
 | 
					 | 
				
			||||||
    # updates location to display to $disp_loc
 | 
					 | 
				
			||||||
    printf 'Searching %s, (%s, %s)\n' "$LOCATION" "$CITY" "$STATE"
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
load_wttr() {
 | 
					 | 
				
			||||||
    # loads and checks weather
 | 
					 | 
				
			||||||
    if [[ ! -f ${WEATHER_DIR}/.weather ]] ; then
 | 
					 | 
				
			||||||
        # file doesnt exist
 | 
					 | 
				
			||||||
        UNITS="F" # defaults to farenheit
 | 
					 | 
				
			||||||
        get_wttr
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # load env
 | 
					 | 
				
			||||||
    source ${WEATHER_DIR}/.weather
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # check for expiration
 | 
					 | 
				
			||||||
    if [[ $(date +%s) -ge $EXPIRATION ]] ; then
 | 
					 | 
				
			||||||
        get_wttr
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
print_wttr() {
 | 
					 | 
				
			||||||
    # stripping and reformatting quotations
 | 
					 | 
				
			||||||
    query=$(printf '.%s.%s' $TOD $ICON)
 | 
					 | 
				
			||||||
    SYMBOL=$(cat ${WEATHER_DIR}/symbols.json | gojq "$query" | tr -d '"')
 | 
					 | 
				
			||||||
    UNIT=$(echo -e "\ufa04")
 | 
					 | 
				
			||||||
    HUMID_SYMB=$(echo -e "\ue373")
 | 
					 | 
				
			||||||
    printf '%s %.1f%s %0.1f %s in %s, %s\n' "$SYMBOL" "$TEMP" "$UNIT" "$HUMIDITY" "$HUMID_SYMB" "$CITY" "$STATE"
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
load_wttr
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
while [[ "$1" != "" ]]; do
 | 
					 | 
				
			||||||
    case $1 in
 | 
					 | 
				
			||||||
    -h | --help)
 | 
					 | 
				
			||||||
        usage
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    -p | --print)
 | 
					 | 
				
			||||||
        print_wttr
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    -s | --setloc)
 | 
					 | 
				
			||||||
        shift
 | 
					 | 
				
			||||||
        new_loc="$1"
 | 
					 | 
				
			||||||
        set_location
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    -d | --disploc)
 | 
					 | 
				
			||||||
        shift
 | 
					 | 
				
			||||||
        display_location
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    -f | --force)
 | 
					 | 
				
			||||||
        get_wttr
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    *)
 | 
					 | 
				
			||||||
        echo "Error: wttr $@"
 | 
					 | 
				
			||||||
        usage
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
    shift
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
							
								
								
									
										2
									
								
								dotbot
									
									
									
									
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								dotbot
									
									
									
									
									
								
							@ -1 +1 @@
 | 
				
			|||||||
Subproject commit d2f76a25933f97cd37ef94e3bf9c134b9c55a02a
 | 
					Subproject commit da928a4c6b65148bfda3138674da1730c143f396
 | 
				
			||||||
							
								
								
									
										2
									
								
								fzf
									
									
									
									
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								fzf
									
									
									
									
									
								
							@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 9d041aa58246fbcaf15ae60224ec8121b86f51cd
 | 
					Subproject commit 3109b865d202c73c7065a3142b7ed317ce9b9382
 | 
				
			||||||
@ -7,14 +7,16 @@
 | 
				
			|||||||
- clean: ['~', '~/.oh-my-zsh/custom/', '~/.vim', '~/.tmux']
 | 
					- clean: ['~', '~/.oh-my-zsh/custom/', '~/.vim', '~/.tmux']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- shell:
 | 
					- shell:
 | 
				
			||||||
    - [git submodule update --init --recursive --force, Installing submodules]
 | 
					    - [git submodule update --init --recursive --remote, Installing submodules]
 | 
				
			||||||
    - [bin/font_install.sh, Installing Hack font]
 | 
					      #    - [bin/font_install.sh, Installing Hack font]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- link: 
 | 
					- link: 
 | 
				
			||||||
    ~/.vim:
 | 
					    ~/.vim:
 | 
				
			||||||
    ~/.vimrc:
 | 
					    ~/.vimrc:
 | 
				
			||||||
    ~/.zshrc:
 | 
					    ~/.zshrc:
 | 
				
			||||||
        force: true
 | 
					        force: true
 | 
				
			||||||
 | 
					    ~/.zprofile:
 | 
				
			||||||
 | 
					        force: true
 | 
				
			||||||
    ~/.tmux:
 | 
					    ~/.tmux:
 | 
				
			||||||
    ~/.tmux.conf: tmux.conf
 | 
					    ~/.tmux.conf: tmux.conf
 | 
				
			||||||
    ~/.config/ranger/rc.conf:
 | 
					    ~/.config/ranger/rc.conf:
 | 
				
			||||||
@ -23,23 +25,31 @@
 | 
				
			|||||||
        force: true
 | 
					        force: true
 | 
				
			||||||
        path: oh-my-zsh/custom/plugins/zsh-autosuggestions
 | 
					        path: oh-my-zsh/custom/plugins/zsh-autosuggestions
 | 
				
			||||||
    ~/.oh-my-zsh/custom/themes/powerlevel10k.zsh-theme: oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme
 | 
					    ~/.oh-my-zsh/custom/themes/powerlevel10k.zsh-theme: oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme
 | 
				
			||||||
 | 
					      # symlink bin for scripts
 | 
				
			||||||
 | 
					    ~/bin:
 | 
				
			||||||
 | 
					      # adding scripts
 | 
				
			||||||
 | 
					    ~/bin/bb: src/bluebikes/bb
 | 
				
			||||||
 | 
					    ~/bin/weather: src/weather/weather.sh
 | 
				
			||||||
 | 
					    ~/bin/water: src/watertracker/watertracker.sh
 | 
				
			||||||
 | 
					    ~/bin/timetracker: src/timetracker/timetracker.sh
 | 
				
			||||||
 | 
					    ~/.config/systemd/user/timesheet.service: src/timetracker/timesheet.service
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- shell:
 | 
					- shell:
 | 
				
			||||||
    - [cp ./vim/hybrid/colors/hybrid.vim ./vim/colors/hybrid.vim, Setting up theme]
 | 
					    - [cp ./vim/hybrid/colors/hybrid.vim ./vim/colors/hybrid.vim, Setting up theme]
 | 
				
			||||||
    - [tmux/plugins/tpm/bin/install_plugins, Installing Tmux Plugins]
 | 
					    - [tmux/plugins/tpm/bin/install_plugins, Installing Tmux Plugins]
 | 
				
			||||||
    - [tmux/plugins/tpm/bin/update_plugins all, Updating Tmux Plugins]
 | 
					    - [tmux/plugins/tpm/bin/update_plugins all, Updating Tmux Plugins]
 | 
				
			||||||
    -
 | 
					    -
 | 
				
			||||||
      command: bin/mclinstall.sh
 | 
					      command: cd src/tmux-mem-cpu-load && cmake . && make && sudo make install
 | 
				
			||||||
      stdin: true
 | 
					      stdin: true
 | 
				
			||||||
      stdout: true
 | 
					      stdout: true
 | 
				
			||||||
      stderr: true
 | 
					      stderr: true
 | 
				
			||||||
      description: Installing tmux_mem_cpu_load
 | 
					      description: Making and installing tmux-mem-cpu-load
 | 
				
			||||||
    -
 | 
					    # -
 | 
				
			||||||
      command: pip install ranger-fm
 | 
					    #   command: pip install ranger-fm
 | 
				
			||||||
      stdin: true
 | 
					    #   stdin: true
 | 
				
			||||||
      stdout: true
 | 
					    #   stdout: true
 | 
				
			||||||
      stderr: true
 | 
					    #   stderr: true
 | 
				
			||||||
      description: Installing ranger
 | 
					    #   description: Installing ranger
 | 
				
			||||||
    -
 | 
					    -
 | 
				
			||||||
      command: pip install ranger-tmux && python -m ranger_tmux install
 | 
					      command: pip install ranger-tmux && python -m ranger_tmux install
 | 
				
			||||||
      stdin: true
 | 
					      stdin: true
 | 
				
			||||||
@ -52,7 +62,3 @@
 | 
				
			|||||||
      stdout: true
 | 
					      stdout: true
 | 
				
			||||||
      stderr: true
 | 
					      stderr: true
 | 
				
			||||||
      description: Installing Fzf
 | 
					      description: Installing Fzf
 | 
				
			||||||
    - 
 | 
					 | 
				
			||||||
      command: bin/weather/symbol_test.sh
 | 
					 | 
				
			||||||
      stdout: true
 | 
					 | 
				
			||||||
      description: Testing weather symbols in Stdout
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit cf67cad46557d57d5d2399e6d893c317126e037c
 | 
					Subproject commit a066b55f855c8e488d3ea9e26e861bdd5ecd4fe8
 | 
				
			||||||
							
								
								
									
										1
									
								
								src/bluebikes
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										1
									
								
								src/bluebikes
									
									
									
									
									
										Submodule
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					Subproject commit cdab40acf97c51502a495e7e90762fdb76ffb63a
 | 
				
			||||||
							
								
								
									
										1
									
								
								src/timetracker
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										1
									
								
								src/timetracker
									
									
									
									
									
										Submodule
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					Subproject commit 0a2a41c7c2485284ac1177995291154d0cc0c8f0
 | 
				
			||||||
							
								
								
									
										1
									
								
								src/watertracker
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										1
									
								
								src/watertracker
									
									
									
									
									
										Submodule
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					Subproject commit b21ba67adf7d0c68b229b5971ea560c0ee0410cd
 | 
				
			||||||
							
								
								
									
										1
									
								
								src/weather
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										1
									
								
								src/weather
									
									
									
									
									
										Submodule
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					Subproject commit 73f8ae2f828566ee82d16ae39e17190b7f9e369b
 | 
				
			||||||
							
								
								
									
										10
									
								
								tmux.conf
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								tmux.conf
									
									
									
									
									
								
							@ -8,6 +8,8 @@ set -g display-panes-time 5000
 | 
				
			|||||||
# setup automatic renaming
 | 
					# setup automatic renaming
 | 
				
			||||||
set -g automatic-rename on
 | 
					set -g automatic-rename on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#set -g default-command /bin/zsh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# keybinds
 | 
					# keybinds
 | 
				
			||||||
bind-key v select-layout even-vertical
 | 
					bind-key v select-layout even-vertical
 | 
				
			||||||
bind-key h select-layout even-horizontal
 | 
					bind-key h select-layout even-horizontal
 | 
				
			||||||
@ -16,19 +18,15 @@ bind-key h select-layout even-horizontal
 | 
				
			|||||||
set -g @plugin 'tmux-plugins/tpm'
 | 
					set -g @plugin 'tmux-plugins/tpm'
 | 
				
			||||||
set -g @plugin 'tmux-plugins/tmux-sensible'
 | 
					set -g @plugin 'tmux-plugins/tmux-sensible'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# status bar
 | 
					 | 
				
			||||||
#set -g @plugin 'thewtex/tmux-mem-cpu-load'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# clock settings
 | 
					# clock settings
 | 
				
			||||||
set -g clock-mode-colour white
 | 
					set -g clock-mode-colour white
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# status config
 | 
					# status config
 | 
				
			||||||
set -g status-interval 10
 | 
					set -g status-interval 10
 | 
				
			||||||
set -g status-style "bg=black, fg=brightWhite"
 | 
					set -g status-style "bg=black, fg=brightWhite"
 | 
				
			||||||
#set -g status-right "#(~/.dotfiles/bin/docker.sh)| #(~/.dotfiles/bin/agent/checker.sh) | #($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load -p -i 1 -a 1) | #(~/.dotfiles/bin/up.sh) | %A, %b %d %l:%M %P "
 | 
					set -g status-right "#(~/bin/docker_check.sh)| #(~/bin/ssh_agent_check.sh) | #(tmux-mem-cpu-load -p -i 1 -a 1) | #(~/bin/up.sh) | %A, %b %d %l:%M %P "
 | 
				
			||||||
set -g status-right "#(~/.dotfiles/bin/docker.sh)| #(~/.dotfiles/bin/agent/checker.sh) | #(tmux-mem-cpu-load -p -i 1 -a 1) | #(~/.dotfiles/bin/up.sh) | %A, %b %d %l:%M %P "
 | 
					 | 
				
			||||||
set -g status-right-length 100
 | 
					set -g status-right-length 100
 | 
				
			||||||
set -g status-left "#(~/.dotfiles/bin/weather/weather -p) | #(~/.dotfiles/bin/bluebikes/bb -c) | #(~/.dotfiles/bin/water/water.sh -Scr) |"
 | 
					set -g status-left " #(~/bin/weather -p) | #(~/bin/bb -pc) | #(~/bin/water -Scr) |"
 | 
				
			||||||
set -g status-left-length 100
 | 
					set -g status-left-length 100
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# tmux auto start
 | 
					# tmux auto start
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 9d20473e912ab39008a25b1902e5f35189e67aad
 | 
					Subproject commit 1ecbc7668276eb2780181d7fe4d6bd8e1a27716e
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 3654775824337f466109f00eaf6759760f65be34
 | 
					Subproject commit e87cd90dc09c2a203e13af9704bd0ef79303d755
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit b411b753f805b969cca856e2ae51fdbab49880df
 | 
					Subproject commit 9c5f675db54139c18ed4a1a18989ea2da37d6cae
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit c491d702b76c6b4918abb80be3cfb57d1b618ffa
 | 
					Subproject commit 9c37e6801b432a4046511b14414f488487b61973
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit b524371788bcdd87215c6e59ca4b2853553077a4
 | 
					Subproject commit 9e64fc1ab60b2e97d39410482b64289dbbaf4eda
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 7d39576149d17bde3c096fd57e3a2cdae65deaf5
 | 
					Subproject commit fe9d3e1a9a50171e7d316a52e1e56d868e4c1fe5
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit bf3480dc9ae7bea34c78fbba4c65b4548b5b1fea
 | 
					Subproject commit 3d188ed2113431cf8dac77be61b842acb64433d9
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 54fd9f5ba70ba907e683a42e2b1903133a98dd60
 | 
					Subproject commit 57da13348bce93dda80d4d4494db42e07c96b018
 | 
				
			||||||
							
								
								
									
										7
									
								
								zshrc
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								zshrc
									
									
									
									
									
								
							@ -28,7 +28,7 @@ export ZSH="$HOME/.oh-my-zsh"
 | 
				
			|||||||
export PATH=$PATH:/usr/local/go/bin
 | 
					export PATH=$PATH:/usr/local/go/bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# adding scripts to path
 | 
					# adding scripts to path
 | 
				
			||||||
export PATH=$PATH:$HOME/.dotfiles/bin/startup:$HOME/.dotfiles/bin:$HOME/.dotfiles/bin/weather:$HOME/.dotfiles/bin/bluebikes
 | 
					export PATH=$PATH:$HOME/bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Set name of the theme to load --- if set to "random", it will
 | 
					# Set name of the theme to load --- if set to "random", it will
 | 
				
			||||||
# load a random theme each time oh-my-zsh is loaded, in which case,
 | 
					# load a random theme each time oh-my-zsh is loaded, in which case,
 | 
				
			||||||
@ -149,8 +149,7 @@ export PATH=$PATH:$HOME/.local/bin
 | 
				
			|||||||
alias c="cd && clear"
 | 
					alias c="cd && clear"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# water tracking alias
 | 
					# water tracking alias
 | 
				
			||||||
alias nalgene="$HOME/.dotfiles/bin/water/water.sh 32"
 | 
					alias nalgene="$HOME/bin/water 32"
 | 
				
			||||||
alias water="$HOME/.dotfiles/bin/water/water.sh"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# setting up location variables
 | 
					# setting up location variables
 | 
				
			||||||
# source "$HOME/.dotfiles/bin/weather/location.sh"
 | 
					# source "$HOME/.dotfiles/bin/weather/location.sh"
 | 
				
			||||||
@ -160,5 +159,5 @@ alias water="$HOME/.dotfiles/bin/water/water.sh"
 | 
				
			|||||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
 | 
					[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
 | 
				
			||||||
export FZF_DEFAULT_OPTS='--layout=reverse --border --height=40%'
 | 
					export FZF_DEFAULT_OPTS='--layout=reverse --border --height=40%'
 | 
				
			||||||
alias bat="batcat"
 | 
					alias bat="batcat"
 | 
				
			||||||
alias tt="$HOME/.dotfiles/bin/timetracker/timetracker"
 | 
					alias tt="$HOME/bin/timetracker"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user