Skip to content

Instantly share code, notes, and snippets.

View andrix's full-sized avatar

Andrés Moreira andrix

View GitHub Profile
@andrix
andrix / keybase.md
Created September 25, 2014 20:07
keybase.md

Keybase proof

I hereby claim:

  • I am andrix on github.
  • I am andresmoreira (https://keybase.io/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:

@andrix
andrix / jlpp
Created December 4, 2014 12:45
#!/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
@andrix
andrix / notifycotiz.py
Created August 29, 2011 20:01
Notificador de cambio de cotización | Brou | Gales
import os
import sys
import time
import urllib
import pynotify
import cPickle
import signal
from scrapy.selector import HtmlXPathSelector
@andrix
andrix / isup.sh
Created December 2, 2011 17:08
isup: simple script that query isup.me and tell you if a site is UP/DOWN (Shell script)
#!/bin/sh
for domain in $*; do
curl "http://www.isup.me/$domain" 2>/dev/null | grep "It's just you" > /dev/null
if [ $? -eq 0 ]; then
echo "$domain: UP"
else
echo "$domain: DOWN"
fi
done
@andrix
andrix / avg.orig.py
Created December 30, 2011 01:03 — forked from rmax/avg.orig.py
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
andrix / .vimrc
Created January 15, 2012 17:33
my 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
andrix / .gvimrc
Created January 15, 2012 17:35
my gvmirc
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'
@andrix
andrix / perf_queues.py
Created August 10, 2012 02:53
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):
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
andrix / iunzip.py
Created July 4, 2011 13:33
python iterable unzip
import itertools
from operator import itemgetter
def iunzip(iterable):
"""Iunzip is the same as zip(*iter) but returns iterators, instead of
expand the iterator. Mostly used for large sequence"""
_tmp, iterable = itertools.tee(iterable, 2)
iters = itertools.tee(iterable, len(_tmp.next()))
return (itertools.imap(itemgetter(i), it) for i, it in enumerate(iters))