Skip to content

Instantly share code, notes, and snippets.

View zodman's full-sized avatar
🤗
Code wins arguments!

Andres Vargas zodman

🤗
Code wins arguments!
View GitHub Profile
@zodman
zodman / smtptest.py
Created February 27, 2015 19:38
command-line smtp test mail sender
#!/usr/bin/python
"""smtptest.py: command-line smtp test mail sender
https://github.com/turbodog/python-smtp-mail-sending-tester
Usage: python smtptest.py [options] fromaddress toaddress serveraddress
Examples:
python smtptest.py [email protected] [email protected] mail.example.com
python smtptest.py --debuglevel 1 --usetls -u bob -p xyzzy "Bob <[email protected]>" [email protected] mail.example.com
@zodman
zodman / log
Created June 25, 2014 16:28
django-logging
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
'simple': {
'format': '%(levelname)s %(message)s'
@zodman
zodman / lr.py
Created June 25, 2014 16:19
livereload for django projects
from livereload import Server
import formic
server = Server()
for f in formic.FileSet(
include=["**.py","**.html","**.css","**.js"],
exclude=[
'**sqlite**',
'.**.*sw*',
'**.pyc',
@zodman
zodman / fabfile.py
Created March 5, 2014 21:47
vagrant fabfile
import cuisine
from fabric.api import *
@task
def vagrant():
"""
Vagrant machine environ.
"""
def ssh_config(name=''):
@zodman
zodman / main.py
Created November 11, 2013 12:36
scrapper mcani,e
from webscraping import download, xpath
import sys
D = download.Download()
src = ("crunchy","javascript")
def scrape(html):
for e in xpath.search(html,"//div[@class='release']"):
if "raw" in e.lower():
@zodman
zodman / ajedrez.py
Last active January 10, 2022 23:19
juego de ajedrez en pascal
from colorconsole import terminal
BLANCO = 'blanco'
NEGRO = 'negro'
VACIO = ""
TRenglon = range(0,9)
TColumna = ["A","B","C","D","E","F","G","H"]
screen = terminal.get_terminal()
@zodman
zodman / default.vcl
Created October 24, 2013 20:32
varnish 1.3.x for django bypassing cache on admin
backend default {
.host = "127.0.0.1";
.port = "81";
}
sub vcl_recv {
# if find purge in the url go there and purge
if( req.url ~ "purge" ) {
return (lookup);
@zodman
zodman / t.py
Created September 25, 2013 06:54
memory usage for a process
import os
import psutil
PROCESS = psutil.Process(os.getpid())
MEGA = 10 ** 6
MEGA_STR = ' ' * MEGA
def pmem():
tot, avail, percent, used, free,_,_,_,_ = psutil.virtual_memory()
tot, avail, used, free = tot / MEGA, avail / MEGA, used / MEGA, free / MEGA
@zodman
zodman / README
Last active December 20, 2015 18:09
Determinar ciclo de vida
Requiere que exista el paquete
/usr/bin/dialog
apt-cache search ^dialog
dialog - Muestra cajas de diálogo amigables desde scripts de consola
para ejecutar
git clone https://gist.github.com/6174258.git ciclo_vida_andres
#!/bin/bash
# Daniel Verner
# CarrotPlant LLC
# 2011
# Backup each mysql databases into a different file, rather than one big file
# Optionally files can be gzipped (dbname.gz)
#
# Usage: dump_all_databases [ -u username -o output_dir -z ]
#
# -u username to connect mysql server