domingo, 24 de enero de 2021

miércoles, 22 de enero de 2020

Convert Amp to Watts

Creditos: https://www.rapidtables.com/convert/electric/1-amp-to-watt.html

How to convert 1 amp to watts

How to convert electric current of 1 amp (A) to electric power in watts (W).
You can calculate (but not convert) the watts from amps and volts:

1A to watts calculation with voltage of 12V DC

For DC power supply, watts are equal to amps times volts.
watts = amps × volts
watts = 1A × 12V = 12W

1A to watts calculation with voltage of 120V AC

For AC power supply, watts are equal to the power factor times amps times volts.
watts = PF × amps × volts
For resistive load without inductors or capacitors, the power factor is equal to 1:
watts = 1 × 1A × 120V = 120W
For inductive load (like induction motor), the power factor can be approximately equal to 0.8:
watts = 0.8 × 1A × 120V = 96W

1A to watts calculation with voltage of 230V AC

For AC power supply, watts are equal to the power factor times amps times volts.
watts = PF × amps × volts
For resistive load without inductors or capacitors, the power factor is equal to 1:
watts = 1 × 1A × 230V = 230W
For inductive load (like induction motor), the power factor can be approximately equal to 0.8:
watts = 0.8 × 1A × 230V = 184W

viernes, 28 de junio de 2019

Asterisk SIP & IAX2 Reload CRONTAB


En consola del Linux entramos a:

# cd /etc/cron.daily

Creamos script para recargar SIP y IAX2

# nano sip_iax_reload y adicionamos lo siguiente:

#!/bin/bash
/usr/sbin/asterisk -rx "sip reload"
/usr/sbin/asterisk -rx "iax2 reload"
# you may need to change full path to the Asterisk binary

 
Asignamos permisos de Ejecución

# chmod 755 sip_iax_reload


Mikrotik Bandwidth Test

Fuente: https://forum.mikrotik.com/viewtopic.php?t=145303





En Consola de Mikrotik

/tool bandwidth-test 87.121.0.45 user=neterra password=neterra direction=both

q para terminar

lunes, 20 de junio de 2016

Captura de Paquetes


tethereal -a duration:10000 -i eth0 -f "host 192.168.10.10"

jueves, 5 de mayo de 2016

Mikrotik - Blockeo de Videos Youtube

Fuente: http://www.ryohnosuke.com/foros/index.php?threads/14042/


Limitar ancho de banda por contenido en Mikrotik

Ejemplo con Videos de Youtube


/ip firewall mangle

add action=mark-connection chain=prerouting comment="Block Youtube" content=\ youtube new-connection-mark=youkill passthrough=yes
add action=mark-packet chain=prerouting connection-mark=youkill \ new-packet-mark=youdown passthrough=no

/queue tree

add limit-at=1k max-limit=1k name=you_bad packet-mark=youdown parent=LAN03 queue=default




Esto limita la carga de videos " MUY LENTA "

lunes, 10 de agosto de 2015

Generar Claves SSH

Fuente: https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets

Create the RSA Key Pair

The first step is to create the key pair on the client machine (there is a good chance that this will just be your computer):


ssh-keygen -t rsa
 
 
 

Copy to Server

cat ~/.ssh/id_rsa.pub | ssh root@[your.ip.address.here] "cat >> ~/.ssh/authorized_keys"

 

 

 
 
 
 

 

lunes, 15 de junio de 2015

Upgrade/iRedAdmin-Pro/LDAP to 2.1.2

Fuente: http://www.iredmail.org/wiki/index.php?title=Upgrade/iRedAdmin-Pro/LDAP/2.1.1-2.1.2

nano upgrade_iredadmin.sh

# Debian
        export DISTRO='DEBIAN'
        export HTTPD_SERVERROOT='/opt/www'
        export RC_SCRIPT_HTTPD='/etc/init.d/apache2'



Terminal: 
 
# tar xjf /root/iRedAdmin-Pro-LDAP-2.1.2.tar.bz2 -C /tmp/
# cd /tmp/iRedAdmin-Pro-LDAP-2.1.2/tools/
# bash upgrade_iredadmin.sh
# rm -rf /tmp/iRedAdmin-Pro-LDAP-2.1.2/

sábado, 9 de mayo de 2015

Generate Polycom XML directory file from FreePBX DB

Fuente: https://www.snip2code.com/Snippet/388850/Generate-Polycom-XML-directory-file-from


#!/bin/bash

# Author: Thyrus Gorges
# Date: 2015/03/04

#The MIT License (MIT)

#Copyright (c) <2015>

#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:

#The above copyright notice and this permission notice shall be included in
#all copies or substantial portions of the Software.

#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#THE SOFTWARE.


# Build a Polycom Directory XML file
# by pulling the usernames and extensions of all SIP users

# Set so we can loop on newlines instead of spaces
IFS=$'\n'

# MySQL Creds
SQLUSER=
SQLPASS=

# Declare our file
FILE=/tftpboot/000000000000-directory.xml

# Remove old file
rm $FILE

# ReCreate our file
touch $FILE


# Write the header of the file
# Passing the -e option to echo allows us to use tabs
echo -e '' >> $FILE
echo -e '' >> $FILE
echo -e '' >> $FILE
echo -e "\t" >> $FILE


# Query Database
# We pass -N to MySQL so it doens't print headers
for i in $( mysql -u $SQLUSER -p$SQLPASS -N -e "use asterisk; select extension, name from users;" ); do
        # Assign Variables to each field
        EXTEN=`echo $i | cut -f1`
        FN=`echo $i | cut  -f2 | cut -d" " -f1`
        LN=`echo $i | cut -d" " -f2`
        # The item tag is the beginning of a contact
        echo -e "\t\t" >> $FILE
        echo -e "\t\t\t $LN " >> $FILE
        echo -e "\t\t\t $FN " >> $FILE
        echo -e "\t\t\t $EXTEN " >> $FILE
        echo -e "\t\t
" >> $FILE
done

# Write file endings
echo -e "\t
" >> $FILE
echo -e "
" >> $FILE

miércoles, 22 de abril de 2015

Install g729 Elastix

Fuente: http://wiki.kolmisoft.com/index.php/G723/G729_Codec_installation


G729 license installation

These instructions works with Asterisk 1.8.23
Download and execute the register utility to generate a valid license.
 
cd /root
wget http://downloads.digium.com/pub/register/x86-64/register

Change the permissions of the /root/register file to r-x------.
chmod 500 /root/register

Run the register utility and follow the interactive instructions. The registration utility will prompt you for your G.729 license key.
/root/register

Download and execute the benchg729 utility to determine the optimum build.
cd /root
wget http://downloads.digium.com/pub/telephony/codec_g729/benchg729/x86-64/benchg729-1.0.8-x86_64 -O benchg729

Change the permissions of the /root/benchg729 file to r-x------
chmod 500 /root/benchg729

Run the benchg729 utility and record the build that it recommends should be used for your platform.
/root/benchg729

Download and install the codec_g729 binary that is built for your platform from
http://downloads.digium.com/pub/telephony/codec_g729/asterisk-1.8.4/x86-64/
NOTE: Asterisk 1.8.23 requires binaries from exactly this download directory.
Extract downloaded file and copy codec_g729a.so to /var/lib/asterisk/modules.
Move original codec_g729.so to another directory for backup purposes.

Restart Asterisk and check if license is found:
asterisk -rvvv
*CLI> g729 show licenses                                                                           
0/0 encoders/decoders of 26 licensed channels are currently in use                                 

Licenses Found:                                                                                    
Key: G729-EXAMPLE1 -- Host-ID: ex:am:pl:e0:ex:am:pl:e0:ex:am:pl:e0:ex:                             
am:pl:e0:ex:am:pl:e0 -- Channels: 2 (Expires: 2026-09-26) (OK)                                     
Key: G729-EXAMPLE2 -- Host-ID: ex:am:pl:e0:ex:am:pl:e0:ex:am:pl:e0:ex:                             
am:pl:e0:ex:am:pl:e0 -- Channels: 24 (Expires: 2026-09-26) (OK)

jueves, 16 de abril de 2015

Rsync Examples

Origen: http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

1- Copy/Sync Files and Directory Locally

This following command will sync a single file on a local machine from one location to another location. Here in this example, a file name backup.tar needs to be copied or synced to /tmp/backups/ folder.

Copy Files
[root@tecmint]# rsync -zvh backup.tar /tmp/backups/

Copy Directory
[root@tecmint]# rsync -avzh /root/rpmpkgs /tmp/backups/


 2- Copy/Sync Files and Directory to or From a Server

This command will sync a directory from a local machine to a remote machine. For example: There is a folder in your local computer “rpmpkgs” which contains some RPM packages and you want that local directory’s content send to a remote server, you can use following command.

Copy a Directory from Local Server to a Remote Server
[root@tecmint]$ rsync -avz rpmpkgs/ root@192.168.0.101:/home/


Copy/Sync a Remote Directory to a Local Machine
 [root@tecmint]# rsync -avzh root@192.168.0.100:/home/tarunika/rpmpkgs /tmp/myrpms

martes, 20 de enero de 2015

Install Wine on Debian

Fuente: http://ask.xmodulo.com/install-wine-linux.html

Since Wine is included in the default repository of Debian, you can install it with apt-get. However, if you are using 64-bit Debian, you need to enable multi-architecture, as Wine is a 32-bit application.

On 64-bit Debian:
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install wine-bin:i386 
 
On 32-bit Debian:
$ sudo apt-get install wine

domingo, 11 de enero de 2015

Ubuntu Server Grub does not autoboot the default option

Fuente: http://askubuntu.com/questions/214972/grub-does-not-autoboot-the-default-option-after-upgrade-to-12-10

My /etc/default/grub has only these effective options:

GRUB_DEFAULT='Ubuntu'
GRUB_HIDDEN_TIMEOUT=1
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_TERMINAL=console
 
 
 
Add the following to /etc/default/grub

GRUB_RECORDFAIL_TIMEOUT=0
 
Save and run

sudo update-grub
 

viernes, 10 de octubre de 2014

Ubuntu Gnome Edit Network Connection

Con este comando editamos las Conecciones de Red y se configuran los clientes VPN.

nm-connection-editor

martes, 23 de septiembre de 2014

Creating an Application Launcher for GNOME 3 in Ubuntu

Origen: http://stackoverflow.com/questions/12964512/creating-an-application-launcher-for-gnome-3-in-ubuntu

create a file called intellij.desktop in the directory /usr/share/applications/
my file looks like this


[Desktop Entry]
Name=IntelliJ IDEA Community Edition
Comment=Free Java, Groovy, Scala and Android applications development
Exec=/path/to/your/bin/idea.sh
Path=/path/to/your/bin
Terminal=false
Icon=intellij-idea-ce
Type=Application
Categories=Development;IDE

viernes, 22 de agosto de 2014

LDAP Replication with syncrepl on Linux

Fuente Original: http://wiki.unixh4cks.com/index.php/OpenLDAP_:_LDAP_Replication_with_syncrepl_on_Centos_5.x


Configure master (provider)

[root@openldap_a ~]# tail -n 5 /etc/openldap/slapd.conf 

overlay syncprov
syncprov-checkpoint 1 10
syncprov-sessionlog 100

Configure slave (consumer)

[root@openldap_c ~]# tail -n 10 /etc/openldap/slapd.conf 

syncrepl rid=1
        provider=ldap://openldap_a.unixh4cks.com
        type=refreshAndPersist
        searchbase="dc=unixh4cks,dc=com"
        schemachecking=off
        bindmethod=simple
        binddn="cn=Manager,dc=unixh4cks,dc=com"
        credentials=secret
updateref ldap://openldap_a.unixh4cks.com.com/
[root@openldap_c ~]#

martes, 22 de julio de 2014

COMO CALCULAR LA CANTIDAD DE BLOCK

Fuente: http://todo-sobre-construccion.blogspot.com/2011/02/como-calcular-la-cantidad-de-block.html

En este artículo vas a aprender como calcular la cantidad de block que te llevaras en la construcción de un muro.

Primero que nada debes tener o más bien saber cuantos metros cuadrados de muro vas a construir, esto es fácil es solo sacar el área del muro. Por ejemplo:

tenemos 2 muros de 2.5 mts. de largo con una altura de 2 mts. por lo tanto:

Metros de muro:
A1= 2.5 x 2= 5 m2 (m2=metros cuadrados)
A2= 2.5 x 2= 5 m2
Total =10 m2

Ya teniendo los metros cuadrados de muro entonces debemos conocer el área que abarca el block contemplando la junta de mortero.

 Por ejemplo para un block de 15x20x40
Son las medidas del block, el 15 te indica el espesor del block
El 20 te indica el alto del block
Y el 40 te indica el largo del block.

Por lo que si vas a construir con este block las medidas que vas a contemplar para saber cuantos blocks te vas a llevar son el largo y el alto, agregándole 1cm. De más por la junta que lleva en los costados y en la unión de las filas del block. Por lo que tenemos

A block = 0.41x0.21 =0.0861m2/pza.

Entonces divides el área total del muro entre el área del block y obtendrás el número de piezas que vas a necesitar.

Piezas= 10/0.0861 = 116.144 pzas.

Ahora lo que te falta contemplar es el porcentaje de desperdicio que se ocupa entre un 3 y un 5%.

Ahora ocupando un 5% de desperdicio tenemos:

116.144 x 1.05 = 121.95 pzas. Aproximando son 122 pzas.

Y listo tienes la cantidad de piezas a ocupar.

jueves, 26 de junio de 2014

Prevent DoS/Brute-Force attacks with Apache’s mod_evasive

FUENTE: http://www.rosehosting.com/blog/prevent-dosbrute-force-attacks-by-installing-and-configuring-apaches-mod_evasive-in-gentoo-debian-centos-arch-linux-and-ubuntu/#ubuntu-debian

What is mod_evasive?
mod_evasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is also designed to be a detection and network management tool, and can be easily configured to talk to ipchains, firewalls, routers, etc. mod_evasive presently reports abuses via email and syslog facilities.


 UBUNTU / DEBIAN

=> Installation on Debian / Ubuntu

The installation of mod_evasive in a Debian / Ubuntu based VPS is identical. Before we go any steps further with the installation, make sure you have an up-to date system by issuing:
# apt-get update && apt-get upgrade --show-upgraded
Next, install Apache’s module mod_evasive by executing:
# apt-get install libapache2-mod-evasive -y
Once the installation is finished, execute the following commands to configure Apache to use mod_evasive module:
# cat >> /etc/httpd/conf.d/mod_evasive.conf <
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify your@email.com
DOSLogDir /var/log/apache2/evasive
</IfModule>
EOF
# chown www-data: -R /var/log/apache2/
# /etc/init.d/apache2 restart
 

viernes, 23 de mayo de 2014

Don Quijote de la Selva

Don Quijote de la Selva (documental completo): http://youtu.be/knfSRz1hJrM

lunes, 12 de mayo de 2014

Mikrotik Wan FailOver

Texto extraido de: http://www.arg-wireless.com.ar/index.php?topic=1226.0

Failover (Conmutación por error) cuando un enlace deja de funcionar por cualquier motivo y automáticamente cambia al enlace de backup o redundancia para seguir funcionando.

En este caso tendríamos dos proveedores de servicio (Por ejemplo Arnet+Fibertel), y por un X motivo el primer servicio deja de funcionar, automáticamente se redireccionara todo al servicio secundario o backup.

Configuración Funcional a partir de Mikrotik RouterOS v3.30 (Versión Actual v5.24)

Paso a Paso:

Para iniciar con la configuración correspondiente vamos a primero crear reglas de salidas de Internet en IP ► Firewall ► NAT, configuraremos las interfaces correspondientes con las direcciones IP correspondientes.

/ip firewall nat 
add chain=srcnat out-interface="1-DIGICEL" action=masquerade comment="Internet - Proveedor Principal" 
add chain=srcnat out-interface="2-CABLEONDA" action=masquerade comment="Internet - Proveedor Secundario (Backup)"
 
Luego podemos por ejemplo llevar un conteo de las caídas de conexión con
 la opción de enviar un mail si se encuentra la misma (Mails de Alerta),
 configuración para:

Hotmail:
 
/tool e-mail 
set server=65.55.96.11 username="MAIL HOTMAIL" password="CONTRASEÑA" from=
 
Gmail:
 
/tool e-mail 
set server=74.125.134.108 username="MAIL GMAIL" password="CONTRASEÑA" from=
 
Luego continuaremos creando una serie de script, vamos a ir a System ► Scripts ► "+"

Name= ISP1-UP 
Policy= read,write,policy,test 
Source=
     
/ip firewall nat set [find comment="Internet - ISP1"] disabled=no 
/ip firewall nat set [find comment="Internet - ISP2"] disabled yes 
: log info "::::::::::::::: TRAFICO SALIENDO POR PROVEEDOR PRINCIPAL 1 :::::::::::::::" 

 
Name= ISP2-UP 
Policy= read,write,policy,test 
Source= 
 
/ip firewall nat set [find comment="Internet - ISP1"] disabled=yes 
/ip firewall nat set [find comment="Internet - ISP2"] disabled=no 
: log info "::::::::::::::: TRAFICO SALIENDO POR PROVEEDOR SECUNDARIO :::::::::::::::" 
 
Name= ISP1-DOWN 
Policy= read,write,policy,test 
Source= 
 
/ip firewall nat set [find comment="Internet - ISP1"] disabled=yes 
/ip firewall nat set [find comment="Internet - ISP2"] disabled=no 
: log info "::::::::::::::: TRAFICO SALIENDO POR PROVEEDOR SECUNDARIO, PROVEEDOR PRIMARIO FUERA DE SERVICIO :::::::::::::::" 
/tool netwatch set [find comment="SALIDA ISP1"] disabled=yes 
/tool netwatch set [find comment="SALIDA ISP2"] disabled=no 
/tool e-mail send to="DIRECCION DE MAIL" subject="Proveedor 1 Fuera de Servicio" body="Proveedor principal dejo de funcionar" 
:log info "::::::::::::::: ALERTA ENVIADA :::::::::::::::" 
 
Name= ISP2-DOWN 
Policy= read,write,policy,test 
Source= 
 
/ip firewall nat set [find comment="Internet - ISP1"] disabled=no 
/ip firewall nat set [find comment="Internet - ISP2"] disabled=yes 
: log info "::::::::::::::: TRAFICO SALIENDO POR PROVEEDOR PRINCIPAL, PROVEEDOR SECUNDARIO FUERA DE SERVICIO :::::::::::::::" 
/tool netwatch set [find comment="SALIDA ISP2"] disabled=yes 
/tool netwatch set [find comment="SALIDA ISP1"] disabled=no 
/tool e-mail send to="DIRECCION DE MAIL" subject="Proveedor 2 Fuera de Servicio" body="Proveedor 2 Dejo de funcionar" 
:log info "::::::::::::::: ALERTA ENVIADA :::::::::::::::" 
 
Luego para terminar creamos las reglas de Netwatch:
 
/tool netwatch 
add comment="SALIDA ISP1" host=74.125.47.104 down-script="ISP1-DOWN" up-script="ISP1-UP" 
add comment="SALIDA ISP2" host=98.139.183.24 down-script="ISP2-DOWN" up-script="ISP2-UP"