3 # transform md anotations into PDF
4 mdpdf () { pandoc "$1".md -t beamer -o "$1".pdf ;}
6 metadata () { echo "Salida del comando stat" ; stat "$1" ; echo "Salida del comando ls -lisan" ; ls -lisan "$1" ; echo "salida del comando exiftool" ; exiftool "$1" ;}
7 # activates the autocd mode
9 edit () { du -a -L "$1" | awk '{print $2}' | fzf | xargs -r "$VISUAL" ;}
13 # if no DIR given, go home
17 builtin cd "${DIR}" && \
18 # use your preferred ls command
23 #vicat is a color and line number cat
32 top10() { history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}' | sort -rn | head; }
33 # goes up by the number of directories
37 for ((i=1 ; i <= limit ; i++)); do
40 d=$(echo $d | sed 's/^\///')
41 if [[ -z "$d" ]]; then
46 # ARCHIVE EXTRACTOR {{{
48 clrstart="\033[1;34m" #color codes
51 if [[ "$#" -lt 1 ]]; then
52 echo -e "${clrstart}Pass a filename. Optionally a destination folder. You can also append a v for verbose output.${clrend}"
53 exit 1 #not enough args
56 if [[ ! -e "$1" ]]; then
57 echo -e "${clrstart}File does not exist!${clrend}"
58 exit 2 #file not found
61 if [[ -z "$2" ]]; then
62 DESTDIR="." #set destdir to current dir
63 elif [[ ! -d "$2" ]]; then
64 echo -e -n "${clrstart}Destination folder doesn't exist or isnt a directory. Create? (y/n): ${clrend}"
67 if [[ $response == y || $response == Y ]]; then
72 exit 6 #Write perms error
75 echo -e "${clrstart}Closing.${clrend}"; exit 3 # n/wrong response
81 if [[ ! -z "$3" ]]; then
82 if [[ "$3" != "v" ]]; then
83 echo -e "${clrstart}Wrong argument $3 !${clrend}"
88 filename=`basename "$1"`
90 #echo "${filename##*.}" debug
92 case "${filename##*.}" in
94 echo -e "${clrstart}Extracting $1 to $DESTDIR: (uncompressed tar)${clrend}"
95 tar x${3}f "$1" -C "$DESTDIR"
98 echo -e "${clrstart}Extracting $1 to $DESTDIR: (gip compressed tar)${clrend}"
99 tar x${3}fz "$1" -C "$DESTDIR"
102 echo -e "${clrstart}Extracting $1 to $DESTDIR: (gip compressed tar)${clrend}"
103 tar x${3}fz "$1" -C "$DESTDIR"
106 echo -e "${clrstart}Extracting $1 to $DESTDIR: (gip compressed tar)${clrend}"
107 tar x${3}f -J "$1" -C "$DESTDIR"
110 echo -e "${clrstart}Extracting $1 to $DESTDIR: (bzip compressed tar)${clrend}"
111 tar x${3}fj "$1" -C "$DESTDIR"
114 echo -e "${clrstart}Extracting $1 to $DESTDIR: (zipp compressed file)${clrend}"
115 unzip "$1" -d "$DESTDIR"
118 echo -e "${clrstart}Extracting $1 to $DESTDIR: (rar compressed file)${clrend}"
119 unrar x "$1" "$DESTDIR"
122 echo -e "${clrstart}Extracting $1 to $DESTDIR: (7zip compressed file)${clrend}"
123 7za e "$1" -o"$DESTDIR"
126 echo -e "${clrstart}Unknown archieve format!"
135 # REMIND ME, ITS IMPORTANT! {{{
136 # usage: remindme <time> <text>
137 # e.g.: remindme 10m "omg, the pizza"
139 if [[ "$#" -lt 2 ]]; then
140 echo -e "Usage: remindme [time] '[message]'"
141 echo -e "Example: remindme 50s 'check mail'"
142 echo -e "Example: remindme 10m 'go to class'"
143 #exit 0 #not enough args
145 if [[ "$#" -gt 2 ]]; then
146 echo -e "Usage: remindme [time] '[message]'"
147 echo -e "Example: remindme 50s 'check mail'"
148 echo -e "Example: remindme 10m 'go to class'"
149 #exit 0 #more than enough args
151 if [[ "$#" == 2 ]]; then
152 sleep $1 && notify-send -t 15000 "$2" & echo 'Reminder set'
160 pacget () { pacman -Slq | fzf --multi --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S ;}
161 pacdel () { pacman -Qq | fzf --multi --preview 'pacman -Qi {1}' | xargs -ro sudo pacman -Rns ;}