Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - leogtz

#661
Son una bola de retrasados haciendo pings de la muerte, se ponen de acuerdo para hacerlo todos al mismo tiempo

1... 2 ... 3... [ENTER]

Y listo!  :P
#662
Scripting / Re: [Bash] TODO list
15 Junio 2011, 23:48 PM
Gracias, he hecho una pequeña modificación, agregar la opción -q|Q para eliminar las tareas que ya tengan el estado de "Hecho", aquí el código:

Código (bash) [Seleccionar]
#!/bin/bash

#===============================================================================
#
#          FILE:  todo.sh
#
#         USAGE:  ./todo.sh OPTIONS
#
#   DESCRIPTION:  TODO List, nos permite hacer anotaciones sobre acciones que haremos en un futuro.
#
#       OPTIONS:  ./todo -h|H
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR: Leo Gutiérrez R. (), leorocko13@hotmail.com | leogutierrez@elhacker.net
#       COMPANY:
#       CREATED: 13/06/11 16:45:05 MDT
#      REVISION:  ---
#===============================================================================

FILE=~/.todo/todo

source functions
# Checar que exista la carpeta y archivo de lista.

[ ! -d ~/.todo ] && {
ask "No existe la carpeta, desea crearla ?" && {
mkdir ~/.todo
echo -e "Creando archivo \"todo\" en ~/.todo";
touch ~/.todo/todo
} || {
echo -e "Saliendo . . .";
exit 0
}
}

[ $# = 0 ] && usage;

while getopts "hHr:R:lLn:N:d:D:be:E:g:G:kKs:S:qQ" OPTION
do
     case $OPTION in
         h|H)
             usage
             exit 1
             ;;
         n|N)
             TEST=$OPTARG
             
             # Actualizar el archivo :
             updateList;
             
             #echo -e "Opción n, valor : ${TEST}";
             echo -e "$(tput bold)$(tput setaf 2)TODO : [$[ $(cat $FILE | wc -l) + 1 ]] ${TEST}";
             echo -e "[$[ $(cat $FILE | wc -l) + 1 ]] ${TEST}" >> $FILE
             tput sgr0;
             exit 0;
             ;;
             
         g|G)

(( $OPTARG > $(cat $FILE | wc -l) )) && {
echo -e "$(tput bold)$(tput setaf 1)ERROR, tarea inexistente, consulte las tareas con -L ó -l"
tput sgr0;
exit 1;
}

read -p "Texto : " texto

sed -i "${OPTARG}s/^\(.*\)$/\1 $texto/g" $FILE
updateList;

exit 0;

;;

         d|D)
             
             # Cercionarnos que elija una TODO hecha.
             
             (( $OPTARG > $(cat $FILE | wc -l) )) && {
echo -e "$(tput bold)$(tput setaf 1)ERROR, tarea inexistente, consulte las tareas con -L ó -l"
tput sgr0;
exit 1;
}
             
             sed -i "${OPTARG}d" $FILE
             updateList;
             
             exit 0;
             
             ;;
             
         k|K)
         
         [ ! -e ~/.todo/todo ] && {
echo -e "$(tput bold)$(tput setaf 1)No existe el archivo \"todo\" en ~/.todo/";

ask "Desea crearlo? " && {
touch $FILE
}
tput sgr0;
exit 1;
}

cp $FILE ${FILE}.bkp
echo -e "\n$(tput bold)$(tput setaf 1)Archivo de respaldo creado\n";
tput sgr0;
exit 0;
         
;;
         r|R)
             
             (( $OPTARG > $(cat $FILE | wc -l) )) && {
echo -e "$(tput bold)$(tput setaf 1)ERROR, tarea inexistente, consulte las tareas con -L ó -l"
tput sgr0;
exit 1;
}

read -p "Texto : " texto

# Detectar status
sed -n "${OPTARG}p" $FILE | grep "^\[.*\] \[.*\] " &> /dev/null && {
sed -i "2s/.*\(\[.*\]\)\s\(\[.*\]\)\s\(.*\)/\1 \2 $texto/g" $FILE
} || {
sed -i "${OPTARG}s/.*\(\[.*\]\)\s\(.*\)/\1 $texto/g" $FILE
}
updateList;

exit 0;
             
             ;;
             
         # -lL Mostrar, listar tareas.
         l|L)

(( $(cat $FILE | wc -l) == 0 )) && {
echo -e "$(tput bold)$(tput setaf 1)TODO List vacía, agregue nuevas tareas.";
tput sgr0;
exit 0;
}

updateList;

while read line
do
echo -e "$(tput bold)$(tput setaf 1)${line}";

done < $FILE

tput sgr0;

exit 0;
;;

b|B)

ask "$(tput bold)$(tput setaf 1)Esto borrará todas las tareas, desea continuar? " && {
sed -i '1,$d' $FILE
}

tput sgr0;
exit 0;
;;

q|Q)

sed -i "/\[Hecho\]/d" $FILE
updateList;
exit 0;
;;


s|S)

(( $(cat $FILE | wc -l) == 0 )) && {
echo -e "$(tput bold)$(tput setaf 1)TODO List vacía, agregue nuevas tareas.";
tput sgr0;
exit 0;
}

read -p "Estado de tarea : " status

sed -n "${OPTARG}p" $FILE | grep "^\[.*\] \[.*\] " &> /dev/null && {

sed -i "${OPTARG}s/.*\(\[.*\]\)\s\(\[.*\]\)\s\(.*\)/\1 [$status] \3/g" $FILE

} || {

sed -i "${OPTARG}s/^\(\[.*\]\)\s\(.*\)$/\1 [$status] \2/g" $FILE

}

;;

         ?)
             usage
             exit
             ;;
     esac
done


Saludos.
#663
El programa es feedingbottle3.2, ejecutalo desde la consola a ver qué errores da.
#664
Scripting / [Bash] TODO list
14 Junio 2011, 23:12 PM
Hola a todos, acabo de hacer esta pequeña herramienta, es un script en Bash que me sirve para tener una lista organizada de lo que tengo que hacer, y pues como paso un 30% de mi tiempo en la consola, pues me es de gran utilidad y quiero compartirlo.

todo.sh
Código (bash) [Seleccionar]
#!/bin/bash

#===============================================================================
#
#          FILE:  todo.sh
#
#         USAGE:  ./todo.sh OPTIONS
#
#   DESCRIPTION:  TODO List, nos permite hacer anotaciones sobre acciones que haremos en un futuro.
#
#       OPTIONS:  ./todo -h|H
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR: Leo Gutiérrez R. (), leorocko13@hotmail.com | leogutierrez@elhacker.net
#       COMPANY:
#       CREATED: 13/06/11 16:45:05 MDT
#      REVISION:  ---
#===============================================================================

FILE=~/.todo/todo

source functions
# Checar que exista la carpeta y archivo de lista.

[ ! -d ~/.todo ] && {
ask "No existe la carpeta, desea crearla ?" && {
mkdir ~/.todo
echo -e "Creando archivo \"todo\" en ~/.todo";
touch ~/.todo/todo
} || {
echo -e "Saliendo . . .";
exit 0
}
}

[ $# = 0 ] && usage;

while getopts "hHr:R:lLn:N:d:D:be:E:g:G:kKs:S:" OPTION
do
    case $OPTION in
        h|H)
            usage
            exit 1
            ;;
        n|N)
            TEST=$OPTARG
           
            # Actualizar el archivo :
            updateList;
           
            #echo -e "Opción n, valor : ${TEST}";
            echo -e "$(tput bold)$(tput setaf 2)TODO : [$[ $(cat $FILE | wc -l) + 1 ]] ${TEST}";
            echo -e "[$[ $(cat $FILE | wc -l) + 1 ]] ${TEST}" >> $FILE
            tput sgr0;
            exit 0;
            ;;
           
        g|G)

(( $OPTARG > $(cat $FILE | wc -l) )) && {
echo -e "$(tput bold)$(tput setaf 1)ERROR, tarea inexistente, consulte las tareas con -L ó -l"
tput sgr0;
exit 1;
}

read -p "Texto : " texto

sed -i "${OPTARG}s/^\(.*\)$/\1 $texto/g" $FILE
updateList;

exit 0;

;;

        d|D)
           
            # Cercionarnos que elija una TODO hecha.
           
            (( $OPTARG > $(cat $FILE | wc -l) )) && {
echo -e "$(tput bold)$(tput setaf 1)ERROR, tarea inexistente, consulte las tareas con -L ó -l"
tput sgr0;
exit 1;
}
           
            sed -i "${OPTARG}d" $FILE
            updateList;
           
            exit 0;
           
            ;;
           
        k|K)
       
        [ ! -e ~/.todo/todo ] && {
echo -e "$(tput bold)$(tput setaf 1)No existe el archivo \"todo\" en ~/.todo/";

ask "Desea crearlo? " && {
touch $FILE
}
tput sgr0;
exit 1;
}

cp $FILE ${FILE}.bkp
echo -e "\n$(tput bold)$(tput setaf 1)Archivo de respaldo creado\n";
tput sgr0;
exit 0;
       
;;
        r|R)
           
            (( $OPTARG > $(cat $FILE | wc -l) )) && {
echo -e "$(tput bold)$(tput setaf 1)ERROR, tarea inexistente, consulte las tareas con -L ó -l"
tput sgr0;
exit 1;
}

read -p "Texto : " texto

# Detectar status
sed -n "${OPTARG}p" $FILE | grep "^\[.*\] \[.*\] " &> /dev/null && {
sed -i "2s/.*\(\[.*\]\)\s\(\[.*\]\)\s\(.*\)/\1 \2 $texto/g" $FILE
} || {
sed -i "${OPTARG}s/.*\(\[.*\]\)\s\(.*\)/\1 $texto/g" $FILE
}
updateList;

exit 0;
           
            ;;
           
        # -lL Mostrar, listar tareas.
        l|L)

(( $(cat $FILE | wc -l) == 0 )) && {
echo -e "$(tput bold)$(tput setaf 1)TODO List vacía, agregue nuevas tareas.";
tput sgr0;
exit 0;
}

updateList;

while read line
do
echo -e "$(tput bold)$(tput setaf 1)${line}";

done < $FILE

tput sgr0;

exit 0;
;;

b|B)

ask "$(tput bold)$(tput setaf 1)Esto borrará todas las tareas, desea continuar? " && {
sed -i '1,$d' $FILE
}

tput sgr0;
exit 0;
;;

s|S)

(( $(cat $FILE | wc -l) == 0 )) && {
echo -e "$(tput bold)$(tput setaf 1)TODO List vacía, agregue nuevas tareas.";
tput sgr0;
exit 0;
}

read -p "Estado de tarea : " status

sed -n "${OPTARG}p" $FILE | grep "^\[.*\] \[.*\] " &> /dev/null && {

sed -i "${OPTARG}s/.*\(\[.*\]\)\s\(\[.*\]\)\s\(.*\)/\1 [$status] \3/g" $FILE

} || {

sed -i "${OPTARG}s/^\(\[.*\]\)\s\(.*\)$/\1 [$status] \2/g" $FILE

}

;;

        ?)
            usage
            exit
            ;;
    esac
done


functions
Código (bash) [Seleccionar]
function usage()
{
tput bold
tput setaf 6
cat << EOF
Uso: $0 options

TODO List v1.0 | leorocko13@hotmail.com

OPTIONS:
 
  -h|H        Muestra este mensaje
  -n|N [#TAREA]    Nueva tarea
  -l|L          Listar tareas
  -d|D [#TAREA]    Eliminar tarea
  -r|R [#TAREA]    Reemplazar tarea
  -b|B            Borrar todas las tareas
  -g|G [#TAREA]    Agregar a una tarea
  -k|K            Crear respaldo de tareas
  -s|S [#TAREA]    Agregar estado de la tarea
 
EOF
tput sgr0;
}

function ask()
{
echo -n "$@" '[y/n] ';
read ans;
case "$ans" in
y*|Y*)
return 0 ;;
*)
return 1 ;;
esac
}

# Detectar status
# sed -n "${OPTARG}p" $FILE | grep "^\[.*\] \[.*\] " &> /dev/null && {
# sed -i "2s/.*\(\[.*\]\)\s\(\[.*\]\)\s\(.*\)/\1 \2 $texto/g" $FILE
# } || {
# sed -i "${OPTARG}s/.*\(\[.*\]\)\s\(.*\)/\1 $texto/g" $FILE
# }

function updateList()
{
rm -f /tmp/todo_temp

# Checamos si la lista no está vacía.
(( $(cat $FILE | wc -l) == 0 )) && {
return;
}

((contador = 1));
while read line
do
echo -e "$line" | grep "^\[.*\] \[.*\] " &> /dev/null && {
echo -e "[$contador] $(echo -e "$line" | sed "s/^\(\[.*\]\)\s\(\[.*\]\)\s\(.*\)/\2 \3/g")" >> /tmp/todo_temp
} || {
echo -e "[$contador] $(echo -e "$line" | sed "s/^\(\[.*\]\)\s\(.*\)/\2/g")" >> /tmp/todo_temp
}
((contador++));
done < $FILE

cp /tmp/todo_temp $FILE

}


Aquí algunas capturas:
#665
En lo que podemos ayudar es en hacer todavía más evidente la estupidez de estas personas, para a ver si alguna persona por arriba de los 50 de coeficiente intelectual que en promedio tienen los políticos entra en razón.
#666
Supongo que ya probaste CTRL + ALT + F7

Ya probaste con:
startx
X

¿?
#667
Sería un gran avance si se pudiera obtener toda la funcionalidad del shell bash en Windows, honestamente tengo mis dudas, ya que el shell está intimamente ligada al SO, así que...

Pero ánimo.
#668
Python y luego comienza con C, o comienza directamente con C.
#669
Sí, Perl es un lenguaje, ActiveState Perl es el interprete para Windows, y pesa alrededor de 150 megas. :s
#670
Dice que está escrito para Bash, pasarlo a Batch sería un engorro :s

Para usar cygwin es sencillo, instalarlo también, cuando lo instales te saldrá la lista de paquetes, trata de ver que vengan:

grep
sed (o sino bajar sed for Windows)

Y lo más importante, el programa usa Perl, así que tal vez tengas que instalar active Perl o Strawberry Perl. . .