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 --multi --preview 'vicat {1}' | xargs -r "$VISUAL" ;}
13 # if no DIR given, go home
17 builtin cd "${DIR}" && \
18 # use your preferred ls command
26 top10() { history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}' | sort -rn | head; }
27 # goes up by the number of directories
31 for ((i=1 ; i <= limit ; i++)); do
34 d=$(echo $d | sed 's/^\///')
35 if [[ -z "$d" ]]; then
40 # ARCHIVE EXTRACTOR {{{
42 clrstart="\033[1;34m" #color codes
45 if [[ "$#" -lt 1 ]]; then
46 echo -e "${clrstart}Pass a filename. Optionally a destination folder. You can also append a v for verbose output.${clrend}"
47 exit 1 #not enough args
50 if [[ ! -e "$1" ]]; then
51 echo -e "${clrstart}File does not exist!${clrend}"
52 exit 2 #file not found
55 if [[ -z "$2" ]]; then
56 DESTDIR="." #set destdir to current dir
57 elif [[ ! -d "$2" ]]; then
58 echo -e -n "${clrstart}Destination folder doesn't exist or isnt a directory. Create? (y/n): ${clrend}"
61 if [[ $response == y || $response == Y ]]; then
66 exit 6 #Write perms error
69 echo -e "${clrstart}Closing.${clrend}"; exit 3 # n/wrong response
75 if [[ ! -z "$3" ]]; then
76 if [[ "$3" != "v" ]]; then
77 echo -e "${clrstart}Wrong argument $3 !${clrend}"
82 filename=`basename "$1"`
84 #echo "${filename##*.}" debug
86 case "${filename##*.}" in
88 echo -e "${clrstart}Extracting $1 to $DESTDIR: (uncompressed tar)${clrend}"
89 tar x${3}f "$1" -C "$DESTDIR"
92 echo -e "${clrstart}Extracting $1 to $DESTDIR: (gip compressed tar)${clrend}"
93 tar x${3}fz "$1" -C "$DESTDIR"
96 echo -e "${clrstart}Extracting $1 to $DESTDIR: (gip compressed tar)${clrend}"
97 tar x${3}fz "$1" -C "$DESTDIR"
100 echo -e "${clrstart}Extracting $1 to $DESTDIR: (gip compressed tar)${clrend}"
101 tar x${3}f -J "$1" -C "$DESTDIR"
104 echo -e "${clrstart}Extracting $1 to $DESTDIR: (bzip compressed tar)${clrend}"
105 tar x${3}fj "$1" -C "$DESTDIR"
108 echo -e "${clrstart}Extracting $1 to $DESTDIR: (zipp compressed file)${clrend}"
109 unzip "$1" -d "$DESTDIR"
112 echo -e "${clrstart}Extracting $1 to $DESTDIR: (rar compressed file)${clrend}"
113 unrar x "$1" "$DESTDIR"
116 echo -e "${clrstart}Extracting $1 to $DESTDIR: (7zip compressed file)${clrend}"
117 7za e "$1" -o"$DESTDIR"
120 echo -e "${clrstart}Unknown archieve format!"
129 # REMIND ME, ITS IMPORTANT! {{{
130 # usage: remindme <time> <text>
131 # e.g.: remindme 10m "omg, the pizza"
133 if [[ "$#" -lt 2 ]]; then
134 echo -e "Usage: remindme [time] '[message]'"
135 echo -e "Example: remindme 50s 'check mail'"
136 echo -e "Example: remindme 10m 'go to class'"
137 #exit 0 #not enough args
139 if [[ "$#" -gt 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 #more than enough args
145 if [[ "$#" == 2 ]]; then
146 sleep $1 && notify-send -t 15000 "$2" & echo 'Reminder set'
154 pacget () { pacman -Slq | fzf --multi --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S ;}
155 pacdel () { pacman -Qq | fzf --multi --preview 'pacman -Qi {1}' | xargs -ro sudo pacman -Rns ;}