Skip to content

Instantly share code, notes, and snippets.


Andrés Moreira andrix

View GitHub Profile
View jlpp
#!/usr/bin/env python
import sys, json
import codecs
import gzip
out = codecs.getwriter('utf8')(sys.stdout)
def _get_input():
if len(sys.argv) <= 1:
return sys.stdin

Keybase proof

I hereby claim:

  • I am andrix on github.
  • I am andresmoreira ( on keybase.
  • I have a public key whose fingerprint is 6E28 2A10 9503 D200 54A2 356F 92DD D775 1991 A9FA

To claim this, I am signing this object:

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
qWebSettings = {
QWebSettings.JavascriptEnabled : True,
# Plugins are enabled because we need to render Flash Ads from Google,
# and seems that google sends which plugins we have enabled to serve
andrix /
Created Aug 10, 2012
perf script to test queue performance
import sys
import time
from collections import deque
N = 10000
class FifoMemoryQueue(object):
"""Memory FIFO queue."""
def __init__(self):
View .pylintrc
# This is a pylint configuration file tuned for checking scrapy code
# Specify a configuration file.
# Profiled execution.
View .gvimrc
syntax on
let g:Powerline_symbols = 'fancy'
set guifont=Inconsolata-dz\ for\ Powerline\ 10
set background=dark
colorscheme molokai
set encoding=utf-8
set guioptions='a'
View .vimrc
filetype off
call pathogen#infect()
filetype on
filetype plugin on
filetype plugin indent on
set nocompatible " vi--
set smarttab " tabulacion, indentacion, etc
set shiftwidth=4
andrix /
Created Dec 30, 2011 — forked from rmax/
pythonic vs non-pythonic code
from __future__ import division
def c_avrg(the_dict, exclude):
""" Calculate the average excluding the given element"""
i = 0
total = 0
for e in the_dict:
if e != exclude:
i += 1
total += the_dict[e]
andrix /
Created Dec 2, 2011
isup: simple script that query and tell you if a site is UP/DOWN (Shell script)
for domain in $*; do
curl "$domain" 2>/dev/null | grep "It's just you" > /dev/null
if [ $? -eq 0 ]; then
echo "$domain: UP"
echo "$domain: DOWN"
andrix /
Created Dec 2, 2011
isup: simple script that query and tell you if a site is UP/DOWN
#!/usr/bin/env python
import re
import sys
from urllib import urlopen
def isup(domain):
resp = urlopen("" % domain).read()
return "%s: %s" % (domain, "UP" if"It's just you.", resp,
re.DOTALL) else "DOWN")