Skip to content

Instantly share code, notes, and snippets.

@icharge
Forked from narate/archey
Created July 6, 2014 14:51
Show Gist options
  • Select an option

  • Save icharge/15d6a6ee86063010029c to your computer and use it in GitHub Desktop.

Select an option

Save icharge/15d6a6ee86063010029c to your computer and use it in GitHub Desktop.

Revisions

  1. @narate narate revised this gist Jun 25, 2014. 1 changed file with 22 additions and 23 deletions.
    45 changes: 22 additions & 23 deletions archey
    Original file line number Diff line number Diff line change
    @@ -34,13 +34,13 @@ normal=$(tput sgr0)

    # Add a -c option to enable classic color logo
    if [[ $1 == "-c" ]] || [[ $1 == "--color" ]] || [[ $2 == "-c" ]] || [[ $2 == "--color" ]]; then
    GREEN='\033[00;32m'
    YELLOW='\033[00;33m'
    LRED='\033[01;31m'
    RED='\033[00;31m'
    PURPLE='\033[00;35m'
    CYAN='\033[00;36m'
    BLUE='\033[00;34m'
    GR='\033[00;32m'
    YE='\033[00;33m'
    LR='\033[01;31m'
    RE='\033[00;31m'
    PU='\033[00;35m'
    CY='\033[00;36m'
    BL='\033[00;34m'
    fi

    # Add a -m command to switch to macports or default to brew
    @@ -65,20 +65,19 @@ diskText="${textColor}Disk Used:${normal}"
    availText="${textColor}Disk Available:${normal}"

    echo -e "
    ${GREEN} ,
    ${GREEN} ,##;
    ${GREEN} ### $userText $user
    ${GREEN} ;#' $hostnameText $hostname
    ${GREEN} ,#####;, ,;#####;, $distroText $distro
    ${YELLOW} ####################' $kernelText $kernel
    ${YELLOW} ####################' $uptimeText $uptime
    ${RED} #################### $shellText $shell
    ${RED} #################### $terminalText $terminal
    ${RED} #####################, $packagehandlerText $packagehandler
    ${PURPLE} ###################### $cpuText $cpu
    ${PURPLE} ####################' $memoryText $ram
    ${BLUE} ################' $diskText $disk
    ${BLUE} '####''''####' ${normal} $availText $disk_avail
    ${GR} ,
    ${GR} ,##;
    ${GR} ### $userText $user
    ${GR} ;#' $hostnameText $hostname
    ${GR} ,#####;, ,;#####;, $distroText $distro
    ${YE} ####################' $kernelText $kernel
    ${YE} ####################' $uptimeText $uptime
    ${RE} #################### $shellText $shell
    ${RE} #################### $terminalText $terminal
    ${RE} #####################, $packagehandlerText $packagehandler
    ${PU} ###################### $cpuText $cpu
    ${PU} ####################' $memoryText $ram
    ${BL} ################' $diskText $disk
    ${BL} '####''''####' $availText $disk_avail
    ${normal}
    "
  2. @narate narate created this gist Jun 25, 2014.
    84 changes: 84 additions & 0 deletions archey
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,84 @@
    #!/bin/bash

    # System Variables
    user=$(whoami)
    hostname=$(hostname | sed 's/.local//g')
    distro="OS X $(sw_vers -productVersion)"
    kernel=$(uname)
    uptime=$(uptime | sed 's/.*up \([^,]*\), .*/\1/')
    shell="$SHELL"
    terminal="$TERM"
    cpu=$(sysctl -n machdep.cpu.brand_string)
    packagehandler=""

    # removes (R) and (TM) from the CPU name so it fits in a standard 80 window

    cpu=$(echo "$cpu" | awk '$1=$1' | sed 's/([A-Z]\{1,2\})//g')

    mem=$(sysctl -n hw.memsize)
    ram="$((mem/1073741824)) GB"
    disk=`df | head -2 | tail -1 | awk '{print $5}'`
    disk_avail=`df -h | head -2 | tail -1 | awk '{print $4}'`

    # Colors Variables
    red="1"
    green="2"
    yellow="3"
    blue="4"
    purple="5"
    lightblue="6"
    grey="7"

    textColor=$(tput setaf $lightblue)
    normal=$(tput sgr0)

    # Add a -c option to enable classic color logo
    if [[ $1 == "-c" ]] || [[ $1 == "--color" ]] || [[ $2 == "-c" ]] || [[ $2 == "--color" ]]; then
    GREEN='\033[00;32m'
    YELLOW='\033[00;33m'
    LRED='\033[01;31m'
    RED='\033[00;31m'
    PURPLE='\033[00;35m'
    CYAN='\033[00;36m'
    BLUE='\033[00;34m'
    fi

    # Add a -m command to switch to macports or default to brew
    if [[ $1 == "-m" ]] || [[ $1 == "--macports" ]] || [[ $2 == "-m" ]] || [[ $2 == "--macports" ]]
    then
    packagehandler="`port installed | wc -l | awk '{print $1 }'`"
    else
    packagehandler="`brew list -l | wc -l | awk '{print $1 }'`"
    fi

    userText="${textColor}User:${normal}"
    hostnameText="${textColor}Hostname:${normal}"
    distroText="${textColor}Distro:${normal}"
    kernelText="${textColor}Kernel:${normal}"
    uptimeText="${textColor}Uptime:${normal}"
    shellText="${textColor}Shell:${normal}"
    terminalText="${textColor}Terminal:${normal}"
    packagehandlerText="${textColor}Packages:${normal}"
    cpuText="${textColor}CPU:${normal}"
    memoryText="${textColor}Memory:${normal}"
    diskText="${textColor}Disk Used:${normal}"
    availText="${textColor}Disk Available:${normal}"

    echo -e "
    ${GREEN} ,
    ${GREEN} ,##;
    ${GREEN} ### $userText $user
    ${GREEN} ;#' $hostnameText $hostname
    ${GREEN} ,#####;, ,;#####;, $distroText $distro
    ${YELLOW} ####################' $kernelText $kernel
    ${YELLOW} ####################' $uptimeText $uptime
    ${RED} #################### $shellText $shell
    ${RED} #################### $terminalText $terminal
    ${RED} #####################, $packagehandlerText $packagehandler
    ${PURPLE} ###################### $cpuText $cpu
    ${PURPLE} ####################' $memoryText $ram
    ${BLUE} ################' $diskText $disk
    ${BLUE} '####''''####' ${normal} $availText $disk_avail
    "