Scripts: Fix cpuusage, currency, cxev
parent
ec18117b17
commit
9706c8c819
|
@ -35,22 +35,22 @@ fi
|
||||||
##
|
##
|
||||||
## Only the first 4 values are interesting here.
|
## Only the first 4 values are interesting here.
|
||||||
|
|
||||||
cpuarray="$(grep 'cpu ' /proc/stat)"
|
cpuarray="$(grep '^cpu ' /proc/stat)"
|
||||||
f1=$(echo $cpuarray | cut -f3 -d' ')
|
## We start at field #3 since there are 2 spaces after 'cpu'.
|
||||||
f2=$(echo $cpuarray | cut -f4 -d' ')
|
f1=$(echo "$cpuarray" | cut -f3 -d' ')
|
||||||
f3=$(echo $cpuarray | cut -f5 -d' ')
|
f2=$(echo "$cpuarray" | cut -f4 -d' ')
|
||||||
f4=$(echo $cpuarray | cut -f6 -d' ')
|
f3=$(echo "$cpuarray" | cut -f5 -d' ')
|
||||||
|
f4=$(echo "$cpuarray" | cut -f6 -d' ')
|
||||||
|
|
||||||
totalA=$(($f1+$f2+$f3+$f4))
|
totalA=$(($f1+$f2+$f3+$f4))
|
||||||
idleA=$f4
|
idleA=$f4
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
cpuarray="$(grep 'cpu ' /proc/stat)"
|
cpuarray="$(grep '^cpu ' /proc/stat)"
|
||||||
f1=$(echo $cpuarray | cut -f3 -d' ')
|
f1=$(echo "$cpuarray" | cut -f3 -d' ')
|
||||||
f2=$(echo $cpuarray | cut -f4 -d' ')
|
f2=$(echo "$cpuarray" | cut -f4 -d' ')
|
||||||
f3=$(echo $cpuarray | cut -f5 -d' ')
|
f3=$(echo "$cpuarray" | cut -f5 -d' ')
|
||||||
f4=$(echo $cpuarray | cut -f6 -d' ')
|
f4=$(echo "$cpuarray" | cut -f6 -d' ')
|
||||||
|
|
||||||
totalB=$(($f1+$f2+$f3+$f4))
|
totalB=$(($f1+$f2+$f3+$f4))
|
||||||
idleB=$f4
|
idleB=$f4
|
||||||
|
|
|
@ -12,4 +12,4 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -sA "Mozilla/5.0" "http://www.google.com/finance?q=$2$3" | \
|
curl -sA "Mozilla/5.0" "http://www.google.com/finance?q=$2$3" | \
|
||||||
awk -v value=$1 -F '<|>' '/^1 / {print value * substr($3, 1, index($3," "))}'
|
awk -v value="$1" -F '<|>' '/^1 / {print value * substr($3, 1, index($3," "))}'
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
xev | awk '/KeyPress|KeyRelease/ {
|
compat=""
|
||||||
|
if [ $(awk --version | grep -c GNU) -gt 0 ]; then
|
||||||
|
# This is for hex-to-decimal conversion.
|
||||||
|
compat="--non-decimal"
|
||||||
|
fi
|
||||||
|
xev "$@" | awk $compat '/KeyPress|KeyRelease/ {
|
||||||
if ($1 == "KeyPress")
|
if ($1 == "KeyPress")
|
||||||
event="pressed";
|
event="pressed";
|
||||||
else
|
else
|
||||||
|
@ -11,8 +16,15 @@ xev | awk '/KeyPress|KeyRelease/ {
|
||||||
keycode = $4;
|
keycode = $4;
|
||||||
keysym = substr($7, 1, length($7)-2);
|
keysym = substr($7, 1, length($7)-2);
|
||||||
|
|
||||||
getline;
|
printf "%-16s code=%-3s state=%s event=%-8s", keysym, keycode, state, event
|
||||||
string=$6;
|
|
||||||
|
|
||||||
printf "%-10s: code=%-3s state=%s event=%-8s string=%s\n", keysym, keycode, state, event, string
|
getline;
|
||||||
|
gsub(/\(|\)/, "", $5)
|
||||||
|
code=int(sprintf("%d", "0x" $5))
|
||||||
|
if (code > 32 && code != 127) {
|
||||||
|
/* Ignore non-printable characters" */
|
||||||
|
gsub(/"/, "", $NF)
|
||||||
|
printf " string=%s", $NF
|
||||||
|
}
|
||||||
|
print ""
|
||||||
}'
|
}'
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
zenity --info --text "IP: $(curl -s 192.168.1.1 | awk -F'>: |<' '/Adresse IP/{getline;print $3;exit}')"
|
|
Loading…
Reference in New Issue