From Electron Cloud
Jump to: navigation, search
Line 64: Line 64:
 
present rate:            2200 mA
 
present rate:            2200 mA
 
present voltage:        11663 mV
 
present voltage:        11663 mV
Charge:             1606 mAh / 3799 mAh = 42%
+
Charge:           1606 mAh / 3799 mAh = 42%
 
temperature:            45 C
 
temperature:            45 C
 
temperature:            48 C
 
temperature:            48 C

Revision as of 14:14, 29 March 2009

My usual aliases:

alias cdp='cd project-dir'
alias cdb='cd project-binary-dir'
alias cdl='cd /var/log'
alias iw='watch "iwconfig wlan0; ifconfig wlan0; ps aux | grep dhcp | grep -v grep"'
alias ko='killall -9 "binary1" "binary2" etc'
alias l='ls -F'
alias ll='ls -la'
alias lt='ls -ltr'
alias pow='cat /proc/acpi/battery/BAT1/info | grep last | cat - /proc/acpi/battery/BAT1/state /proc/acpi/thermal_zone/THRM/temperature'
alias rxvt='rxvt -sr -bg black -fg white -geometry 80x60 -sl 10000'

Bash prompt (yellow for "foreign" systems):

# prompt
case $TERM in
    xterm*)
        TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        ;;
    *)
        TITLEBAR=''
        ;;
esac

        BLUE="\[\033[0;34m\]"
  LIGHT_GRAY="\[\033[0;37m\]"
 LIGHT_GREEN="\[\033[1;32m\]"
  LIGHT_BLUE="\[\033[1;34m\]"
  LIGHT_CYAN="\[\033[1;36m\]"
      YELLOW="\[\033[1;33m\]"
       WHITE="\[\033[1;37m\]"
         RED="\[\033[0;31m\]"
    NO_COLOR="\[\033[0m\]"

PS1="${TITLEBAR}\n\
$LIGHT_CYAN\w$NO_COLOR\n\
[$RED\h$NO_COLOR][$YELLOW\$(date +%r)$NO_COLOR] \
"
PS2='> '
PS4='+ '

Another way to implement the "pow" command:

#!/bin/sh
CHARGE_NOW=`cat /sys/class/power_supply/BAT0/charge_now`
CHARGE_FULL=`cat /sys/class/power_supply/BAT0/charge_full`
CHARGE_PERCENT=$(( $CHARGE_NOW * 100 / $CHARGE_FULL ))
CHARGE_NOW=`cat /proc/acpi/battery/BAT0/state | grep remaining | cut -c26-`
CHARGE_FULL=`cat /proc/acpi/battery/BAT0/info | grep last | cut -c26-`
cat /proc/acpi/battery/BAT0/state | grep -v remaining
echo "Charge:                    $CHARGE_NOW / $CHARGE_FULL = $CHARGE_PERCENT%"
cat /proc/acpi/thermal_zone/TZS0/temperature /proc/acpi/thermal_zone/TZS1/temperature

which produces output like this:

[acer][02:10:26 PM] pow
present:                 yes
capacity state:          ok
charging state:          charging
present rate:            2200 mA
present voltage:         11663 mV
Charge:	           1606 mAh / 3799 mAh = 42%
temperature:             45 C
temperature:             48 C

Below is a script for an upper-right console clock. It can be called bgclock but I don't know the best way to make it put itself into the background. Could use raw ANSI codes rather than tput, but I'm lazy.

#!/bin/sh
while [ 1 ]
do
        COLS=$((`tput cols` - 8))
        tput sc; tput cup 0 $COLS; date +%H:%M:%S; tput rc
        sleep 1
done