This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
import sys | |
from urllib import urlopen | |
def isup(domain): | |
resp = urlopen("http://www.isup.me/%s" % domain).read() | |
return "%s: %s" % (domain, "UP" if re.search("It's just you.", resp, | |
re.DOTALL) else "DOWN") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a pylint configuration file tuned for checking scrapy code | |
[MASTER] | |
# Specify a configuration file. | |
#rcfile= | |
# Profiled execution. | |
profile=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
from collections import deque | |
N = 10000 | |
class FifoMemoryQueue(object): | |
"""Memory FIFO queue.""" | |
def __init__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import time | |
import urllib | |
import pynotify | |
import cPickle | |
import signal | |
from scrapy.selector import HtmlXPathSelector |
NewerOlder