Skip to content

Instantly share code, notes, and snippets.

View eliezerfot123's full-sized avatar

Eliezer Romero eliezerfot123

View GitHub Profile
@eliezerfot123
eliezerfot123 / comprobar_url
Last active May 3, 2022 02:57
COMPROBAR QUE UNA WEB ESTE DISPONIBLE EN PYTHON
rewimport httplib
import urlparse
# funcion que se encarga de obtener respuesta del estatus del servidor web
def get_server_status_code(url):
# descarga sólo el encabezado de una URL y devolver el código de estado del servidor.
host, path = urlparse.urlparse(url)[1:3]
try:
conexion = httplib.HTTPConnection(host)
conexion.request('HEAD', path)
@eliezerfot123
eliezerfot123 / generador.py
Last active December 19, 2015 14:49
Generar contraseñas aleatorias...
import string
from random import choice
def generador(n):
return ''.join([choice(string.letters + string.digits) for i in range(n)])
for genera in range(1000):
genera = generador(8)
#el numero significa la base o la longitud que quieres que sea el valor de la clave
print genera(8)
@eliezerfot123
eliezerfot123 / dePython.py
Created August 15, 2013 00:53
Programa que permite leer un archivo que tenga una lista de twitts y publicarlo de manera automatica con ttytter "Herramienta para utilizar el twitter vía consola"
#!/usr/lib/python
# by @eliezerfot123
import random
import os
# Abrimos el archivo donde tenemos los twitts con la función open() de python.
linea=open("archivoDeTwitts.txt","r").readlines()
# Le decimos a python que haga un random en las lineas encontradas y escoja uno.
muestro = linea[random.randint(0, len(linea)-1)]
@eliezerfot123
eliezerfot123 / screenshot_web.py
Created August 27, 2013 14:08
Programa que permite hace una captura de una website...
# -*- coding: utf-8 -*-
import sys
import time
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
class Screenshot(QWebView):
def __init__(self):
self.app = QApplication(sys.argv)
@eliezerfot123
eliezerfot123 / validEmail.py
Last active December 22, 2015 00:38
Como validar un correo Electrónico, usando Expresiones Regulares.
#!/usr/lib/python
import re
correo = 'correo@correo.com'
if re.match('^[(a-z0-9\_\-\.)]+@[(a-z0-9\_\-\.)]+\.[(a-z)]{2,4}$',correo.lower()):
print 'Correo Correcto'
else:
print 'El correo no es correcto...'
@eliezerfot123
eliezerfot123 / bring_html.py
Created September 10, 2013 19:16
Como traer el html de una página web con python
#!/usr/lib/env python
#Utilizamos la libreria de python urllib2
import urllib2
def contenidoPagina(url):
try:
traer = urllib2.urlopen(page)
# leemos el contenido que trae la pagina.
datos = traer.read()
@eliezerfot123
eliezerfot123 / send_sms.py
Created September 11, 2013 15:55
Como enviar mensaje con gammu vía python. Teléfono de prueba ALCATEL 0T-800A
#!/usr/bin/env python
# Ejemplo de como enviar SMS usando gammu y python
import gammu
import sys
# se crea un objeto stateMachine, para hablar con el telefono
sm = gammu.StateMachine()
# Leer la configuracion desde (~/.gammurc)
@eliezerfot123
eliezerfot123 / open_pc.py
Created September 19, 2013 21:28
Entrar a una pc vía ssh y ejecutar comandos
#!/usr/bin/env python
# Librerias necesarias
import paramiko
import os
# Datos para la conexion SSH
ssh_servidor = '10.0.70.44'
ssh_usuario = 'tuusuario'
ssh_clave = 'tucontraseña'
@eliezerfot123
eliezerfot123 / genera_combinaciones.py
Created October 24, 2013 14:01
Programa que genera todas las posibles combinaciones y guardarlo en un archivo. Python
import sys, math
from time import time, localtime, strftime
########################### CONFIGURACION #########################
# LONGITUD DEBE SER MINIMO 8 | CLAVES WPA/2 SON DE MINIMO 8 CARACTERES
LONGITUD = 10
ALFABETO = "qwertyuioplkjhgfdsazxcvbnm"
@eliezerfot123
eliezerfot123 / combox_dependientes.html
Created December 24, 2013 03:19
ComboBox dependientes con ajax y html5.
<html>
<head>
<title>
COMBOBOX
</title>
<script type="text/javascript">
function cargarSelect2(valor) {
var arrayValores=new Array(
new Array(1,1,"opcion1-1"),