Skip to content

Instantly share code, notes, and snippets.

Avatar

Félix López flopezluis

  • Salamanca - Spain
View GitHub Profile
View EffectiveCommunication.md

#Effective Communication


Prepare the conversation.

  • Why are we having this conversation?
    Your time is valuable, other people's time is valuable. If you need to use this time, the least you can do is to prepare it. Things such as "what do you want to achieve?", "What info you need to give?", and all following...
  • What do you expect from the meeting?
    How many times do you go to a meeting without thinking what's the outcome you want from it?
  • Try to understand the audience.:
  • How can I get to my audience better?.
View benchmark
from time import clock as now
def catastrophic(n):
pat = re.compile('([a|b]+)+c')
text = "%s" %('a' * n)
pat.search(text)
def test(f, *args, **kargs):
start = now()
f(*args, **kargs)
View timeit.py
import timeit
def catastrophic(n):
pat = re.compile('([a|b]+)+c')
text = "%s" %('a' * n)
pat.search(text)
from functools import partial
for i in range(100):
cata = partial(catastrophic, i)
print "The function lasted: %f" %timeit.timeit(cata, number=1)
@flopezluis
flopezluis / vimrc
Last active December 15, 2015 12:59
example to open tabs at start
View vimrc
let i_{1} = "~/Dev/project/x.py"
let i_{2} = "~/Dev/project/x2.py"
let i_{3} = "~/Dev/project/x3.py"
let j = 1
while j<=3
execute "tabnew " i_{j}
let j=j+1
endwhile
@flopezluis
flopezluis / conftest,py
Last active December 14, 2015 23:08
Small example the how I'm using pytest
View conftest,py
@pytest.fixture()
def foo_client(monkeypatch):
def authenticate():
pass
monkeypatch.setattr(FooClient, "authenticate", authenticate)
return FooClient("token", "secret")
View example.py
import logging
import pika
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
class ExampleConsumer(object):
"""This is an example consumer that will handle unexpected interactions
View UnexpectedFrameError
import logging
import sys
import os
import settings
import pika
import re
from threading import Timer
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
@flopezluis
flopezluis / example.py
Created October 31, 2012 18:13
Batching with Pika
View example.py
import logging
import pika
from threading import Timer
BATCH_SIZE = 100
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
@flopezluis
flopezluis / record.py
Created October 6, 2012 06:39
an old script I created to record Vaughan Radio
View record.py
import sys
import time as timer
import urllib
from datetime import datetime, time
import signal
name = ''
def record():
url_stream = urllib.urlopen("http://vaughanradio.streaming-pro.com:8012/;stream.nsv")
f = open("%s_%s.mp3" %(name, datetime.now().strftime("%y-%m-%d")),"wb");
print ('Recording...')
@flopezluis
flopezluis / gist:3255861
Created August 4, 2012 08:21
Bookmark to delete all the queues in a vhost. RabbitMQ
View gist:3255861
//add this to your bookmarks. The default vhost in RabbitMq is "/",
//so you should have as virtualhost %2F, but due to chrome escape it, i used %252f
//i assume you're in the management site (http://www.rabbitmq.com/management.html)
javascript:
vhost="%252f";
var delete_queues = function(name) {
$.ajax({
url:'api/queues/' +vhost+ '/' + name,
type: 'DELETE',
success:function(data) {