blob: be7397005a232137145e8ac629267a7314b4eab6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
mcd() {
mkdir -p "$1" && cd "$1"
}
ppgrep() {
pgrep "$@" | xargs --no-run-if-empty ps fp
}
stocks() {
if [ -z "$1" ] ; then
cat <<EOM
stocks NAME
Get current stock value for NAME.
Example:
$ stocks GOOG
$ stocks EURUSD=x
EOM
return
fi
curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s='$1'&f=l1'
}
xe() {
if [ -z "$1" ] ; then
cat <<EOM
xe NAME
Get exchange rates.
Example:
$ xe EURRUB
$ xe usdrub
EOM
return
fi
stocks "$1=x"
}
setgov() {
GOVS=($(cpufreq-info -g))
if [ -z "$1" ] ; then
cat <<EOM
setgov GOVNAME
Set CPU governor, available are: $GOVS
Current governor is: $(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | sort -u | xargs echo)
EOM
return
fi
if [ ${GOVS[(i)$1]} -le ${#GOVS} ] ; then
for ((i=0; i<$(nproc); i++)) ; do
sudo cpufreq-set -c $i -r -g $1
done
else
echo "Unsupported governor: $1"
return 1
fi
}
# vim: ft=zsh :
|