aboutsummaryrefslogtreecommitdiff
path: root/base/zsh/functions.zsh
blob: 9f02ffa3cc623c7ce29f62ee87a5879acdd2572c (plain)
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
function todo {
  ack TODO $@ |
    sed -e 's/.*TODO //;s/ \*\/$//;s/ -->//' |
    LC_ALL=C sort -u
}

function which {
  (alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
} #export -f which

function trash {
  mkdir -p "$HOME/.trash"
  for file in "$@"; do
    mv "$file" "$HOME/.trash/$(basename $file).$(date +%Y%m%d-%H%M%S)"
  done
} # Add this to your crontab:
# 43 0 * * 3 find ~/.trash -mindepth 1 -mtime +90 -delete

wttr() {
  curl -q -s --compressed -H "Accept-Language: ${LANG%_*}" \
    "https://wttr.in/${1:-Pleasant Grove}?${2:-0q}"
  # "format=%l%0A%c+%t+%w+%m"
}

hex() {
  emulate -L zsh
  if [[ -n "$1" ]]; then printf "%X\n" $1
  else print 'Usage: hex <number-to-convert>'; fi
}

trc() {
  if [[ `uname -n` = "aristotle" ]]; then
    transmission-remote-cli
  else
    ssh dhd.ahov.co ssh aristotle transmission-remote-cli
  fi
}

httpless() {
  http --pretty=all --print=hb "$@" | less -R
}

colors() {
  for i in `seq 0 21`; do
    echo -ne "\e[48;5;${i}m ${i} "
  done; echo -e "\e[0m"
}

export PASSWORD_STORE_ENABLE_EXTENSIONS=true