The tty

Inicio :: Perfil :: Archivos :: Amigos

ii + dialog

#!/bin/bash
name=$(basename ${0})
server="irc.arrakis.es"
nick=""
key=""
canal=""
ruta="/irc/"

: ${dialog_ok=0}
: ${dialog_cancel=1}
: ${dialog_help=2}
: ${dialog_extra=3}
: ${dialog_item_help=4}
: ${dialog_escape=255}

yesno () {
 exec 3>&1
dialog  --yesno " $1 " 0 0 2>&1 1>&3  
retcode=$?
exec 3>&-
    case $retcode in
        $dialog_ok) $2 ;;
        $dialog_cancel) $3 ;;
    esac
}

inputbox () {
exec 3>&1
respuesta=$(dialog --title " $1 " --inputbox " $2 " 0 0  2>&1 1>&3)
retcode=$?
exec 3>&-
    case $retcode in
        dialog_ok) respuesta=$respuesta ;;
        dialog_cancel) dump_canal $ruta_out ;;
    esac        
}

tailbox () {
exec 3>&1
dialog --title "Esc = Salir "  --exit-label "Input Text" --tailbox "$1" 0 0  2>&1 1>&3
retcode=$?
exec 3>&-
         
}


msgbox () {
dialog --title " $1 " --msgbox " $2 " 0 0
}


salir () {
yesno "Cerrar $name ? " "killall ii" "dump_canal $ruta_out"
}

dump_canal (){
tailbox $1
  case $retcode in
        $dialog_ok) input_text ;;
        $dialog_escape) salir ;;
  esac
}

conectar () {
ii -s $server -n $nick -k $key & sleep 10
}

enter_canal () {
 echo "/j #$canal" > $HOME$ruta$server/in
}

input_text () {
inputbox "" "Enter text: " 0 0
texto=$respuesta
echo "$texto" >> $ruta_in
dump_canal $ruta_out
}

settings () {
returncode=0
while test $returncode != 1 && test $returncode != 250
do
exec 3>&1
value=`dialog --clear
--title "Esc = Salir"
--ok-label "Aplicar"
--cancel-label "Conectar"
--inputmenu "Settings"
20 50 10
        "Server:"       "$server"
        "Nick:"         "$nick"
        "key:"          "$key"
        "canal:"        "$canal"
2>&1 1>&3`
returncode=$?
exec 3>&-

        case $returncode in
        $dialog_cancel)
                echo "Conectando con $server..."
                        ;;
                       
        $dialog_ok)
                dialog
                --clear
        --title "Nuevos settings"
                --msgbox "
             Server: $server 
                     Nick:   $nick 
                     Key:    $key 
                     Canal:  #$canal" 0 0
                ;;
        $dialog_extra)
                tag=`echo "$value" |sed -e 's/^RENAMED //' -e 's/:.*//'`
                item=`echo "$value" |sed -e 's/^.*:[ ]*//' -e 's/[ ]*$//'`

                case "$tag" in
                Server)
                        server="$item"
                        ;;
                Nick)
                        nick="$item"
                        ;;
                key)
                        key="$item"
                        ;;
                canal)
                        canal="$item"
                        ;;
                esac
                ;;

        $dialog_escape)
                yesno "Salir de $name ?" "exit" "settings"
       
                 ;;
  esac
done
}
#------------------------
settings
conectar
enter_canal
ruta_out="$HOME$ruta/$server/#$canal/out"
ruta_in="$HOME$ruta/$server/#$canal/in"
dump_canal $ruta_out
exit 0



 



 


date: 26/12/2011

Mi dialogrc

aspect = 0
separate_widget = ""
tab_len = 0
visit_items = OFF
use_shadow = On
use_colors = ON
screen_color = (blue,black,on)
shadow_color = (red,black,On)
dialog_color = (cyan,black,off)
title_color = (cyan,black,Off)
border_color = (cyan,black,Off)
button_active_color = (yellow,Black,Off)
button_inactive_color = dialog_color
button_key_active_color = button_active_color
button_key_inactive_color = (white,black,OFF)
button_label_active_color = (yellow,Black,ON)
button_label_inactive_color = (white,black,Off)
inputbox_color = dialog_color
inputbox_border_color = dialog_color
searchbox_color = dialog_color
searchbox_title_color = title_color
searchbox_border_color = border_color
position_indicator_color = title_color
menubox_color = dialog_color
menubox_border_color = border_color
item_color = dialog_color
item_selected_color = button_active_color
tag_color = title_color
tag_selected_color = button_label_active_color
tag_key_color = button_key_inactive_color
tag_key_selected_color = (green,Black,ON)
check_color = dialog_color
check_selected_color = button_active_color
uarrow_color = (GREEN,black,Off)
darrow_color = uarrow_color
itemhelp_color = (cyan,BLACK,Off)
form_active_text_color = button_active_color
form_text_color = (WHITE,CYAN,ON)
form_item_readonly_color = (CYAN,WHITE,ON)
gauge_color = title_color
border2_color = dialog_color
inputbox_border2_color = dialog_color
searchbox_border2_color = dialog_color
menubox_border2_color = dialog_color


date: 18/12/2011

Survival manual for the Babel tower

#!/bin/bash
dialog="/usr/bin/dialog"
wget=/usr/bin/wget
name=$(basename ${0})
btitulo="BabelFish Translator"
langtran=""
tmpfile="/tmp/tmpfile"

select_lang(){
exec 3>&1
langtran=$($dialog --scrollbar \
            --backtitle "$btitulo" \
            --title "$name " \
            --menu "Escoje una pareja de idiomas" 16 55 9 \
  "zh_en" "Chinese-simple to English" \
  "zh_zt" "Chinese-simple to Chinese-traditional" \
  "zt_en" "Chinese-traditional to English" \
  "zt_zh" "Chinese-traditional to Chinese-simple" \
  "en_zh" "English to Chinese-simple" \
  "en_zt" "English to Chinese-trad" \
  "en_nl" "English to Dutch" \
  "en_fr" "English to French" \
  "en_de" "English to German" \
  "en_el" "English to Greek" \
  "en_it" "English to Italian" \
  "en_ja" "English to Japanese" \
  "en_ko" "English to Korean" \
  "en_pt" "English to Portuguese" \
  "en_ru" "English to Russian" \
  "en_es" "English to Spanish" \
  "nl_en" "Dutch to English" \
  "nl_fr" "Dutch to French" \
  "fr_nl" "French to Dutch" \
  "fr_en" "French to English" \
  "fr_de" "French to German" \
  "fr_el" "French to Greek" \
  "fr_it" "French to Italian" \
  "fr_pt" "French to Portuguese" \
  "fr_es" "French to Spanish" \
  "de_en" "German to English" \
  "de_fr" "German to French" \
  "el_en" "Greek to English" \
  "el_fr" "Greek to French" \
  "it_en" "Italian to English" \
  "it_fr" "Italian to French" \
  "ja_en" "Japanese to English" \
  "ko_en" "Korean to English" \
  "pt_en" "Portuguese to English" \
  "pt_fr" "Portuguese to French" \
  "ru_en" "Russian to English" \
  "es_en" "Spanish to English" \
  "es_fr" "Spanish to French" 2>&1 1>&3)

ret=$?
 case $ret in
    0) ;;
    1) menu ;;
    255) ;;
    esac
exec 3>&-
  input_text
}



input_text(){
exec 3>&1
texto=$($dialog --title "Traducir entre $langtran" \
        --backtitle "$btitulo" \
        --cancel-label "Volver" \
        --inputbox "Introduce la frase a traducir:" 10 50 2>&1 1>&3)

ret=$?
 case $ret in
    0) ;;
    1) select_lang ;;
    255) ;;
    esac
exec 3>&-
texto2=`echo $texto | sed -e 's/?/\\?/' -e 's/&/and/' -e 's/ /+/g'`

salida=$($wget -nv -O - http://babelfish.yahoo.com/translate_txt?ei=UTF-8\&doit=done\&fr=bf-res\&intl=1\&tt=urltext\&trtext=$texto2\&lp=$langtran\&btnTrTxt=Translate 2>&1|grep -i 'result'|egrep -iv 'txt-form|tips 1'|sed -e 's/$/\n/' -e :a -e 's/<[^>]*>/ /g;/
$dialog --backtitle "$btitulo" \
    --title "Traducción" \
        --msgbox "$texto  \n  $salida" 16 55
input_text

}

menu(){

$dialog --backtitle "$btitulo" \
    --title "$name" \
    --menu "" 8 55 3 \
    1 "Seleccionar idiomas" \
    2 "Exit" 2> $tmpfile   
retv=$?
choice=$(cat $tmpfile)
#[ $retv -eq 1 -o $retv -eq 255 ] && exit
    case $choice in
        1) select_lang  ;;
        2) exit ;;
    esac    

}

if [ -f $dialog ]; then
    menu      
    else
        echo "Necesitas instalar Dialog"
    exit 0
    fi



date: 18/12/2011

Lang to lang

#!/bin/bash
browser="lynx -dump -nolist "
name=$(basename ${0})
origen=""
destino=""
btitulo="Lang to Lang -   Diccionario Multilenguaje"
tmpfile1="/tmp/opciones_menu"
dialog="/usr/bin/dialog"


lista_idiomas(){
$dialog --title " $name " \
       --backtitle "$btitulo" --msgbox "
   Traduce entre los siguientes idiomas usando la  web

                 http://www.langtolang.com

English, Albanian, Arabic, Breton, Catalan, Chinese Simplified,
Chinese Traditional, Corsican, Czech, Danish, Dutch, Esperanto,
Estonian,  Finnish, French, Gaelic, Georgian, German, Greek,
Hebrew, Hungarian,  Icelandic, Indonesian, Italian, Japanese,
Korean, Kurdish, Latvian, Lithuanian, Malagasy, Norwegian,
Polish, Portuguese Brazil, Portuguese Portugal, Romanian, Russian,
Serbo Croat, Slovak, Slovenian,  Spanish, Swahili, Swedish,
Turkish, Vietnamese, Yiddish, Walloon, Welsh


                  kir@sdf-eu.org


" 14 70
}

escoje_idioma(){
exec 3>&1
idioma=$($dialog --scrollbar --backtitle "$btitulo" \
       --title " " \
       --menu "Escoje la lengua de $fromto" 16 55 9 \
   "English" ""\
   "Albanian" "" \
   "Arabic" "" \
   "Breton" "" \
   "Catala" "" \
   "Chinese Simplified" "" \
   "Chinese Traditional" "" \
   "Corsican" "" \
   "Czech" "" \
   "Danish" "" \
   "Dutch" "" \
   "Esperanto" "" \
   "Estonian" "" \
   "Finnish" "" \
   "French" "" \
   "Gaelic" "" \
   "Georgian" "" \
   "German" "" \
   "Greek" "" \
   "Hebrew" "" \
   "Hungarian" "" \
   "Icelandic" "" \
   "Indonesian" "" \
   "Italian" "" \
   "Japanese" "" \
   "Korean" "" \
   "Kurdish" "" \
   "Latvian" "" \
   "Lithuanian" "" \
   "Malagasy" "" \
   "Norwegian" "" \
   "Polish" "" \
   "Portuguese Brazil" "" \
   "Portuguese Portugal" "" \
   "Romanian" "" \
   "Russian" "" \
   "Serbo Croat" "" \
   "Slovak" "" \
   "Slovenian" "" \
   "Spanish" "" \
   "Swahili" "" \
   "Swedish" "" \
   "Turkish" "" \
   "Vietnamese" "" \
   "Yiddish" "" \
   "Walloon" ""  2>&1 1>&3 )
 exec 3>&- 
}

input_palabra(){
exec 3>&1
palabra=$($dialog --title "De $origen a $destino" \
          --backtitle "$btitulo" \
          --cancel-label "Volver" \
          --inputbox "Introduce la palabra a traducir:" 8 50 2>&1 1>&3)
ret=$?
  case $ret in
       0)  ;;
       1) menu ;;
       255) ;;
       esac
exec 3>&-
url="http://www.langtolang.com/?selectFrom=\
$origen&selectTo=$destino&txtLang=$palabra&submitButton=Search"
salida=$($browser $url | sed '1, 13d' |tac | sed '1, 6d' | tac )
$dialog --backtitle "$btitulo" \
    --msgbox "$salida" 16 55
input_palabra
}

menu(){
$dialog --item-help \
    --title "" \
       --backtitle "$btitulo" \
       --menu "" 15 55 6 \
              1 "Lista de idiomas " "Lista de idiomas disponibles" \
              2 "Idioma de origen " "Idioma desde el que se va a traducir" \
              3 "Idioma de destino " "Idioma al que se va a traducir" \
              4 "Traducir " "Introducción de palabra y búsqueda de la traducción" \
          5 "Exit" "Pues eso" 2> $tmpfile1
retv=$?
choice=$(cat $tmpfile1)            
[ $retv -eq 1 -o $retv -eq 255 ] && exit
    case $choice in
        1) lista_idiomas
           menu ;;
        2) fromto="origen"
              escoje_idioma
           origen=$idioma
           menu ;;
        3) fromto="destino"
           escoje_idioma
           destino=$idioma
           menu ;;
        4) input_palabra ;;
        5) clear
           exit ;;
        esac   
}


if [ -f $dialog ]; then
    menu
else
    echo "Necesitas instalar Dialog"; exit 0
fi


date: 18/12/2011

Biblia 's Dialog

#!/bin/bash
libro=""
vers="1" # versiculo
capitulo=""
version="61" # Default Reina-Valera 1995
browser="lynx -dump -nolist"
dialog="/usr/bin/dialog"
name=$(basename ${0})
btitulo=" $name - Bible Gateway - (www.biblegateway.com) by kir"

: ${dialog_ok=0}
: ${dialog_cancel=1}
: ${dialog_help=2}
: ${dialog_extra=3}
: ${dialog_item_help=4}
: ${dialog_escape=255}


#######################################################
# Input capítulo del libro
# Se guarda en $vers
#######################################################
get_capitulo () {
exec 3>&1
vers=$(dialog
--backtitle "$btitulo"
--title "Liber $libro"
--cancel-label "Libro"
--inputbox "Introduce el número de capítulo para lelerlo entero o capítulo:versículo para un solo versículo" 10 50 2>&1 1>&3)
retcode=$?
exec 3>&-
case $retcode in
$dialog_ok)
main_command ;;
$dialog_cancel)
choice_libro;;
esac

}

#######################################################
# Busca en la web y vuelca el resultado
# en $salida
#######################################################

main_command () {
exec 3>&1
capitulo=$libro%20%20$vers
web="http://www.biblegateway.com/passage/?search=$capitulo&version=$version"
salida=$($browser $web | sed '1, 40 d') 2>&1 1>&3
dialog
--backtitle "$btitulo"
--title "Liber $libro $vers"
--msgbox "$salida" 20 76
exec 3>&-
get_capitulo
}

##########################################################
# Menu para escoger Libro de la biblia
# La eleccion se guarda en $libro
##########################################################

choice_libro (){
exec 3>&1

libro=$(dialog
--scrollbar
--backtitle " $btitulo"
--cancel-label "Versión"
--title " LIBER "
--extra-button
--extra-label "Capítulo"
--menu "Selecciona Libro: " 16 55 9
"genesis" ""
"exodo" ""
"levitico" ""
"numeros" ""
"deuteronomio" ""
"josue" ""
"jueces" ""
"rut" ""
"1samuel" ""
"2samuel" ""
"1reyes" ""
"2reyes" ""
"1cronicas" ""
"2cronicas" ""
"esdras" ""
"nehemias" ""
"ester" ""
"job" ""
"salmos" ""
"proverbios" ""
"eclesiastes" ""
"cantares" ""
"isaias" ""
"jeremias" ""
"lamentaciones" ""
"ezequiel" ""
"daniel" ""
"oseas" ""
"joel" ""
"amos" ""
"abdias" ""
"jonas" ""
"miqueas" ""
"nahum" ""
"habacuc" ""
"sofonias" ""
"hageo" ""
"zacarias" ""
"malaquias" ""
"mateo" ""
"marcos" ""
"lucas" ""
"juan" ""
"hechos" ""
"romanos" ""
"1corintios" ""
"2corintios" ""
"galatas" ""
"efesios" ""
"filipenses" ""
"1tesalonicenses" ""
"2tesalonicenses" ""
"1timoteo" ""
"2timoteo" ""
"tito" ""
"filemon" ""
"hebreos" ""
"santiago" ""
"1pedro" ""
"2pedro" ""
"1juan" ""
"2juan" ""
"3juan" ""
"judas" ""
"apocalipsis" "" 2>&1 1>&3 )

retcode=$?
exec 3>&-
case $retcode in
$dialog_cancel)
choice_version ;;
$dialog_ok)
main_command ;;
$dialog_escape)
exit ;;
$dialog_extra)
get_capitulo ;;
esac

}

##########################################################
# Menu para escojer la versión de la biblia
# La version escojida se pasa a la variable $version
######################################################

choice_version () {
exec 3>&1
version=$(dialog
--scrollbar
--backtitle " $btitulo "
--cancel-label "Exit"
--title " TRADVCTIO "
--menu "Selecciona Versión o traducción: " 16 55 9
"1" "ALB Biblia en albanés"
"2" "LSG Louis Segond"
"3" "CEI Conferenza Episcopale Italiana"
"4" "VULGATE Biblia Sacra Vulgata"
"5" "DNB1930 Det Norsk Bibelselkap 1930"
"6" "RVA Reina-Valera Antigua "
"7" "SV1917 Svenska 1917"
"8" "ASV American Standard Version"
"9" "KJV King James Version "
"10" "LUTH1545 Luther Bibel 1545 "
"11" "DN1933 Dette er Biblen pa dansk"
"13" "RUSV Russian Synodal Version"
"14" "RMNN Romanian "
"15" "YLT Young's Literal Translation "
"16" "DARBY Darby Translation"
"17" "KAR Hungarian Kairoli "
"18" "ICELAND Icelandic Bible"
"19" "VIET Vietnamese Bible "
"21" "BULG Bulgarian Bible "
"22" "CUV Chinese Union Version Traditional"
"23" "HCV Haitian Creole Version "
"24" "MAORI Maori Bible"
"25" "AA Joao Ferreira de Almeida Act. "
"27" "UKR Ukrainian Bible "
"28" "ALAB Arabic Life Application B"
"29" "SNC Slovo na cestu (N. Testamento)"
"30" "HTB Het Boek"
"31" "NIV New International Version 2010 "
"32" "BDS La Bible du Semeur"
"33" "HOF Hoffnung für Alla (N.Testamento) "
"34" "LM La Parola è Vita (N.Testamento) "
"35" "LB Levande Bibeln (N.Testamento) "
"37" "OL O livro "
"38" "TLCR Romanian (N.Testamento)"
"39" "SZ Slovo Zhizny (N.Testamento) "
"40" "NPK Nádej pre kazdého (N.Testamento)"
"41" "CST Castilian (N.Testamento) "
"42" "NVI Nueva Versión Internacional"
"43" "SND Ang Salita ng Diyos (N.T) "
"44" "SVL Levande Bibeln"
"45" "AMP Amplified Bible"
"46" "CEV Contemporary English Version"
"47" "ESV English Standard Version "
"48" "KJ21 21st Century King James V."
"49" "NASB New American Standard Bible"
"50" "NKJV New King James Version"
"51" "NLT New Living Translation"
"53" "WYC Wycliffe New Testament"
"55" "LND La Nuova Diodati "
"56" "REIMER Reimer 2001 (N.Testamento)"
"57" "TLA Traducción en lenguage actual "
"58" "DHH Dios habla hoy"
"59" "LBLA La Biblia de las Américas"
"60" "RVR1969 Reina-Valera 1960"
"61" "RVR1995 Reina-Valera 1995 "
"62" "CRO Croatian Bible (N.Testamento)"
"63" "DRA Douay-Rheims 1899 American Edit "
"64" "NIVUK New International Vers. UK"
"65" "MSG The Message "
"68" "WHNU 1881 Westcott-Hort New Test."
"69" "TR1550 1550 Stephanus New Test. "
"70" "TR1894 1894 Scrivener New Testament"
"71" "HLGN Hiligaynon Bible "
"72" "TNIV Today’s New International Vers."
"73" "WE Worldwide English (New Testament) "
"75" "SNT Swahili New Testament "
"76" "NIRV New International Reader's Vers."
"77" "HCSB Holman Christian Standard Bible "
"78" "NCV New Century Version "
"80" "CUVS Chinese Union Version (Simplified)"
"81" "WLC The Westminster Leningrad Codex "
"82" "BG1940 1940 Bulgarian Bible "
"86" "GNT Good News Translation"
"88" "MVC Mam, Central (N.Testamento) "
"90" "CCO Chinanteco de Comaltepec "
"94" "AMU Amuzgo de Guerrero (N.Testamento) "
"98" "CKW Cakchiquel Occidental (N.Test.) "
"102" "NIV1984 New Internat. Version 1984 "
"103" "JAC Jacalteco, Oriental (N.T.) "
"104" "KEK Kekchi (N.T.) "
"107" "MVJ Mam Todos Santos Chuchumatán "
"109" "NGU Náhuatl de Guerrero (NT) "
"111" "QUT Quiché, Centro Occidental NT "
"113" "USP Uspanteco (N.T) "
"122" "MNT Macedonian New Testament" 2>&1 1>&3 )
retcode=$?
exec 3>&-
case $retcode in
$dialog_ok)
choice_libro ;;
$dialog_cancel)
exit ;;
esac
}

if [ -f $dialog ]; then
choice_version
else
echo -e "Este script necesita dialog instalado"
exit
fi


date: 18/12/2011

web translator

#!/bin/bash
name=$(basename ${0})
langpair=$1
browser="w3m"

function traduce(){
 if [ $# = 0 ]; then
echo
echo -e "Traduce sitios web con Babelfish
Uso : $name IdiomaOrigen_IdiomaDestino url
      $name -l para la lista de idiomas    "
echo
return
fi

if [ $langpair = "-l" ]; then
echo -e "Lista de idiomas :"
echo
echo -e "es_en Español a inglés
es_fr Español a francés
en_es Inglés a español
en_zt Inglés a chino trad.
en_nl Inglés a neerlandés
en_fr Inglés a francés

en_de Inglés a alemán
en_el Inglés a griego
en_it Inglés a italiano
en_ja Inglés a japonés
en_ko Inglés a coreano
en_pt Inglés a portugués
en_ru Inglés a ruso
en_zh Inglés a chino simp.
pt_en Portugués a inglés

pt_fr Portugués a francés
it_en Italiano a inglés
it_fr Italiano a francés
nl_en Neerlandés a inglés
nl_fr Neerlandés a francés
fr_nl Francés a neerlandés
fr_en Francés a inglés
fr_de Francés a alemán
fr_el Francés a griego

fr_it Francés a italiano
fr_pt Francés a portugués
fr_es Francés a español
de_en Alemán a inglés
de_fr Alemán a francés
el_en Griego a inglés
el_fr Griego a francés
ja_en Japonés a inglés
ko_en Coreano a inglés

ru_en Ruso a inglés
zh_en Chino simp. a inglés
zh_zt Chino simplificado a chino tradicional
zt_en Chino trad. a inglés
zt_zh Chinese-trad to Chinese-simp"
echo
return
fi

shift
url=$@
$browser "http://98.139.168.220/babelfish/translate_url_content?.intl=es&lp=$langpair&trurl=$url"
}
traduce $*



date: 1/11/2011

Calculadora para trastes (Bash)


#!/bin/bash

function ayuda(){
    echo
     echo -e "Calcula la distancia desde la cejuela hasta los trastes para cualquier tiro
según la regla del 18.
Se pasan como parámetros el tiro en milímetros y el número de trastes. "
echo
     echo -e "Uso:
  $(basename ${0}) Tiro Trastes"
     echo -e "Ejemplo: "
     echo -e "  $(basename ${0}) 650 21 "
         
exit 0
   
}
 

function calculos(){
 distance=0
  for i in $(seq $num_frets)
do
    localizacion=`echo "scale=3;$tiro-$distance" | bc -l`
    scaling_factor=`echo "scale=3;$localizacion/$divisor" | bc -l`
    distance=`echo "scale=3;$distance+$scaling_factor" | bc -l`
    distancia_puente=`echo "scale=3;$tiro-$distance" | bc -l`   
    echo "$i ............ $distance ......... $distancia_puente "
done

}


if [ $# -lt 2 ]; then
 ayuda
fi

divisor=17.817
tiro=$1
num_frets=$2
echo
echo "Traste         Distancia       Distancia"
echo "               a  la cej.      al puente"
echo "----------------------------------------"
calculos $*


date: 9/10/2011

Translator charrán

Retoque del anterior script traductor para que utilice TTS (text to speech). Si el idioma de destino es distinto del español tendremos sonido con la pronunciación en el idioma elegido; no funciona con todos los idiomas y, en algunos es poco práctico pues "describe" los acentos en lugar de pronunciarlos.
Necesita mplayer para reproducir el streaming.

#!/bin/bash

function translate () {
    if [ $# = 0 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
        echo -e "Traduce texto con el Google Translator."
        echo -e " Uso :"
        echo -e "  $(basename ${0}) idioma_de_origen idioma_de_destino texto "
        echo -e "  $(basename ${0}) -l para la lista de idiomas"
        exit
    fi
    if [ "$1" = "-l" ]; then
echo -e "        afrikaans af   
       albanés      sq    francés      fr    persa     fa
    alemán      de    galés       cy    polaco      pl
    árabe      ar    gallego      gl    portugués pt
                    rumano      ro   
            griego      el    ruso      ru
    bieloruso be    hebreo      iw    serbio      sr
    búlgaro      bg    hindi      hi    suajili      sw
    catalán   ca    holandés  nl    sueco     sv
    checo      cs    húngaro      hu    tagalo    tl
    chino       zh    indonesio id    tailandés th
            inglés      en     turco      tr
    coreano      ko    irlandés  ga    ucraniano uk
    creole .H ht    islandés  is   
    croata      hr    italiano  it    vietnamit vi
    danés      da    japonés      ja    yiddish   yi
    eslovaco  sk    letón     lv
    esloveno  sl    lituano   lt
    español      es    macedonio mk
    estonio      et    malayo      ms
            maltés    mt
    finlandés fi    noruego   no"
return
    fi
SRC=$1
DST=$2
    shift
    shift
TEXT="$@"

 wget -qO- "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$TEXT&langpair=${SRC}|${DST}" | sed 's/.*"translatedText":"([^"]*)".*}/ /' > /tmp/voz

texto=`cat /tmp/voz`
echo $texto

if [ "${DST}" != "es" ]; then
 mplayer -really-quiet "http://translate.google.com/translate_tts?tl=${DST}&q=$texto" 2> null
fi
}

translate $*


Editado 1-11-2011 :

Google Translate API v2 is now available as a paid service. The courtesy limit for existing Translate API v2 projects created prior to August 24, 2011 will be reduced to zero on December 1, 2011. In addition, the number of requests your application can make per day will be limited. Google Translate API v1 will be shut off completely on the same date (December 1, 2011); it was officially deprecated on May 26, 2011. These changes are being made due to the substantial economic burden caused by extensive abuse. For website translations, we encourage you to use the Google Website Translator gadget.


date: 8/10/2011

fret calculator

program trastes;
uses crt;
var scaling_factor,distance,scale,localizacion:real;
var num_frets,f:shortint;

procedure datos;
begin
clrscr;
     write('Introducir el tiro en mm: ');
       read(scale);
     write('Introducir numero de trastes: ');
       read(num_frets);
     writeln;
     writeln('Traste  Distancia a la cejuela');
     writeln('------------------------------');
end;

procedure calculos;
begin
 distance:=0;
   for f := 1 to num_frets  do
 begin
    localizacion:=scale-distance;
    scaling_factor:=localizacion/17.817;
    distance:=distance+scaling_factor;
    writeln(f,' ....   ',distance:7:2);
  end;
 end;

begin
  datos;
  calculos;
end.


date: 7/12/2010

Biblia (script)

#!/bin/bash
color1=""
color2=""
function uso(){
clear
echo
echo -e "${color2} Muestra capítulos o versículos de la Biblia en diferentes"
echo -e "versiones y traducciones"
echo
echo -e "                      -*-"
echo -e "$color1"
echo -e "Uso:"
echo -e " $(basename ${0}) <-h> <--help> :  Ayuda"
echo -e " $(basename ${0}) [libro] [capitul]o: [versión](código o número)"
echo -e "$color2"
echo -e "Ej: "
echo -e " $(basename ${0}) gen 11:9 ALB
 $(basename ${0}) gen 11 1"
echo
return
}
function ayuda(){
echo -e "Para la versión puede usarse el número o la abreviatura, poniendo
en mayúsculas al menos la primera letraa "
echo
echo -e "                      -*-"
echo -e " Libros:"
echo -e " Para el nombre del libro pueden usarse abreviaturas"
echo -e "en algunos casos, por ejemplo:"
echo -e "$color1 gen Génesis ex  Éxodo lev Levítico num Números deut Deuteronomio"
echo
echo -e "$color2 Puede usarse el nombre completo según la siguiente lista :"
echo
echo -e "$color1 genesis, exodo, levitico, numeros, deuteronomio, josue, jueces "
echo -e "rut, 1samuel, 2samuel, 1reyes, 2reyes, 1cronicas, 2cronicas, esdras" 
echo -e "nehemias, ester, job, salmos,  proverbios, eclesiastes, cantares "
echo -e "isaias, jeremias, lamentaciones. ezequiel, daniel, oseas, joel, amos"
echo -e "abdias, jonas, miqueas, nahum, habacuc, sofonias (sophonias), hageo"
echo -e "zacarias, malaquias, mateo, marcos, lucas, juan, hechos, romanos"
echo -e "1corintios, 2corintios,galatas, efesios, filipenses, 1tesalonicenses"
echo -e "2tesalonicenses, 1timoteo, 2timoteo, tito, filemon, hebreos, santiago"
echo -e "1pedro, 2pedro, 1juan, 2juan, 3juan, judas, apocalipsis "
echo
echo -e "                      -*-"
echo
echo -e "$color2 Traducciones :"
echo
echo -e "La versión o traducción de la Biblia que se va a mostrar"
echo -e "puede elegirse de la siguiente tabla: "
echo
echo -e " $color1
 1 ALB  Biblia en albanés         2 LSG Louis Segond
 3 CEI  Conferenza Episcopale Italiana   4 VULGATE Biblia Sacra Vulgata
 5 DNB1930 Det Norsk Bibelselkap 1930    6 RVA Reina-Valera Antigua
 7 SV1917 Svenska 1917                   8 ASV American Standard Version
 9 KJV  King James Version              10 LUTH1545 Luther Bibel 1545
11 DN1933 Dette er Biblen pa dansk      12
13 RUSV  Russian Synodal Version        14 RMNN Romanian
15 YLT  Young's Literal Translation     16 DARBY Darby Translation
17 KAR  Hungarian Kairoli               18 ICELAND Icelandic Bible
19 VIET Vietnamese Bible        20
21 BULG Bulgarian Bible            22 CUV Chinese Union Version (Trad.)
23 HCV  Haitian Creole Version          24 MAORI Maori Bible
25 AA  Joao Ferreira de Almeida Act.    26
27 UKR Ukrainian Bible            28 ALAB Arabic Life Application B.
29 SNC Slovo na cestu (N. Testamento)   30 HTB  Het Boek
31 NIV New International Version 2010   32 BDS  La Bible du Semeur
33 HOF Hoffnung für Alla (N.Testamento) 34 LM La Parola è Vita (N.Testamento)
35 LB  Levande Bibeln (N.Testamento)    36
37 OL  O livro                   38 TLCR Romanian (N.Testamento)
39 SZ  Slovo Zhizny     (N.Testamento)    40 NPK Nádej pre kazdého (N.Testamento)
41 CST Castilian (N.Testamento)        42 NVI Nueva Versión Internacional
43 SND Ang Salita ng Diyos (N.T)        44 SVL Levande Bibeln
45 AMP Amplified Bible            46 CEV Contemporary English Version
47 ESV English Standard Version        48 KJ21 21st Century King James V.
49 NASB New American Standard Bible     50 NKJV New King James Version
51 NLT New Living Translation        52
53 WYC Wycliffe New Testament        54
55 LND La Nuova Diodati            56 REIMER Reimer 2001 (N.Testamento)
57 TLA Traducción en lenguage actual    58 DHH Dios habla hoy
59 LBLA La Biblia de las Américas    60 RVR1969 Reina-Valera 1960
61 RVR1995 Reina-Valera 1995        62 CRO Croatian Bible (N.Testamento)
63 DRA Douay-Rheims 1899 American Edit  64 NIVUK New International Vers. UK
65 MSG The Message            66
67                        68 WHNU 1881 Westcott-Hort New Test.
69 TR1550 1550 Stephanus New Test.    70 TR1894 1894 Scrivener New Testament
71 HLGN  Hiligaynon Bible        72 TNIV Today’s New International Vers.
73 WE Worldwide English (New Testament  74
75 SNT Swahili New Testament        76 NIRV New International Reader's Vers.
77 HCSB Holman Christian Standard Bible 78 NCV  New Century Version
79                     80 CUVS Chinese Union Version (Simplified)
81 WLC The Westminster Leningrad Codex    82 BG1940 1940 Bulgarian Bible
83                     84
85                    86 GNT Good News Translation
87                     88 MVC Mam, Central (N.Testamento)
89                     90 CCO Chinanteco de Comaltepec
91                     92
93                    94 AMU Amuzgo de Guerrero (N.Testamento)
95                     96
97                    98 CKW     Cakchiquel Occidental (N.Test.)
99                        100
101                       102 NIV1984  New Internat. Version 1984   
103 JAC Jacalteco, Oriental (N.T.)     104 KEK Kekchi (N.T.)
105                        106
107 MVJ Mam Todos Santos Chuchumatán   108
109 NGU  Náhuatl de Guerrero  (NT)     110
111 QUT Quiché, Centro Occidental NT   112  
113 USP     Uspanteco (N.T)        122  MNT Macedonian New Testament
"
return
}

if [ $# -lt 1 ]; then uso
exit 1
fi
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
uso
ayuda |more

else

capt=$1
vers=$2
capitulo=$capt%20%20$vers
traduccion=$3
web="http://www.biblegateway.com/passage/?search=$capitulo&version=$traduccion"
browser="lynx -dump -nolist"
$browser $web | sed '1, 40 d'|less

fi

**************

~→ biblia ecc 1:5 6
Eclesiastés 1:5 (Reina-Valera Antigua)

^5Y sale el sol, y pónese el sol, y con deseo vuelve á su lugar donde
torna á nacer.


Reina-Valera Antigua (RVA)





date: 28/11/2010

bloginom - blog gratis, opciones y plantillas exclusivas e personalizables :: nominom © 200