Skip to content

Instantly share code, notes, and snippets.

View javipalanca's full-sized avatar

Javi Palanca javipalanca

View GitHub Profile
@javipalanca
javipalanca / fipa.py
Last active October 18, 2017 14:51
aioxmpp example to insert a custom attribute into a <message/>
import asyncio
import aioxmpp
import logging
logging.basicConfig(level=logging.DEBUG)
class Fipa(aioxmpp.xso.XSO):
TAG = ("fipa:x:acl", "fipa-envelope")
performative = aioxmpp.xso.Attr(tag="performative", type_=aioxmpp.xso.String(), default="QUERY")
@javipalanca
javipalanca / gist:77c61d654ce61d4e80a43d18ba556380
Last active November 2, 2017 17:37
logs for a subscribe-subscribed interaction
DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:aioxmpp.callbacks:connecting <bound method SimpleMessageDispatcher._feed of <aioxmpp.dispatcher.SimpleMessageDispatcher object at 0x10e564278>> with mode <bound method AdHocSignal.STRONG of <class 'aioxmpp.callbacks.AdHocSignal'>>
DEBUG:aioxmpp.callbacks:connecting <bound method SimplePresenceDispatcher._feed of <aioxmpp.dispatcher.SimplePresenceDispatcher object at 0x10e564358>> with mode <bound method AdHocSignal.STRONG of <class 'aioxmpp.callbacks.AdHocSignal'>>
DEBUG:aioxmpp.callbacks:connecting <bound method PresenceServer._before_stream_established of <aioxmpp.presence.service.PresenceServer object at 0x10e564470>>
DEBUG:aioxmpp.callbacks:connecting <bound method PresenceManagedClient._update_presence of <aioxmpp.node.PresenceManagedClient object at 0x10df4e2e8>> with mode <bound method AdHocSignal.STRONG of <class 'aioxmpp.callbacks.AdHocSignal'>>
DEBUG:agent1.on_stream_established:connecting <bound method PresenceManagedClient._handle_stream_establish
DEBUG:agent1.StanzaStream:enqueued stanza <presence from=None to='agent2@localhost' id='xrDQt2VgZ8nv3o9g3NgE5' type=<PresenceType.SUBSCRIBE: 'subscribe'>> with token <StanzaToken id=0x000000010d3fee58>
DEBUG:agent1.StanzaStream:forwarding stanza to xmlstream: <presence from=None to='agent2@localhost' id='xrDQt2VgZ8nv3o9g3NgE5' type=<PresenceType.SUBSCRIBE: 'subscribe'>>
DEBUG:agent1.XMLStream:SENT b'<presence to="agent2@localhost" id="xrDQt2VgZ8nv3o9g3NgE5" type="subscribe"/>'
DEBUG:aioopenssl.trace.fd=13:_write_ready: nothing more to write, removing writer
DEBUG:asyncio:poll 9963.207 ms took 1.854 ms: 1 events
DEBUG:agent1.XMLStream:RECV b"<iq id='lx47' type='set'><query ver='107' xmlns='jabber:iq:roster'><item jid='agent2@localhost' ask='subscribe' subscription='none'/></query></iq><presence type='unavailable' to='agent1@localhost' from='agent2@localhost'/>"
DEBUG:agent1.StanzaStream:incoming iq: <iq from=None to=None id='lx47' type=<IQType.SET: 'set'> data=<aioxmpp.roster.xso.Query object at 0x10d3e9a58>>
@javipalanca
javipalanca / agent1.log
Created November 2, 2017 18:58
swift log
<!-- IN 2017-11-02T19:51:01 -->
<presence id='xYId4y1kFCyjBb4Pp6+HK' to='agent1@localhost/bb2623e4-b7a7-45f7-9bda-ae2f46b6c435' from='agent1@localhost/41dff478-dab1-4d88-8e37-05c0ec2cf6e2'/>
<!-- IN 2017-11-02T19:51:06 -->
<iq id='lx57' type='set'><query ver='110' xmlns='jabber:iq:roster'><item jid='agent2@localhost' ask='subscribe' subscription='none'/></query></iq>
<presence type='unavailable' to='agent1@localhost' from='agent2@localhost'/>
<!-- OUT 2017-11-02T19:51:06 -->
<iq id="lx57" type="result"/>
<!-- IN 2017-11-02T19:51:07 -->
<presence id='xrfJJ/hjmoYzcECDglDWy' type='subscribed' to='agent1@localhost' from='agent2@localhost'/>
<iq id='lx59' type='set'><query ver='111' xmlns='jabber:iq:roster'><item jid='agent2@localhost' subscription='to'/></query></iq>
@javipalanca
javipalanca / presence.py
Created November 2, 2017 19:03
presence test
import asyncio
import time
import getpass
from spade.agent import Agent
from spade.behaviour import OneShotBehaviour
import logging
logging.basicConfig(level=logging.DEBUG)
@javipalanca
javipalanca / agent1.log
Created November 2, 2017 21:06
logs of Psi client
<iq id="aaeaa" type="set">
<query xmlns="jabber:iq:roster">
<item jid="agent2@localhost"/>
</query>
</iq>
<presence to="agent2@localhost" type="subscribe">
<nick xmlns="http://jabber.org/protocol/nick">agent1</nick>
</presence>
  • Update HISTORY.rst
  • Commit the changes:
git add HISTORY.rst
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
@javipalanca
javipalanca / location_time.py
Last active April 6, 2020 19:47
Spatial and time queries
def time_interval(t1start, t1end, t2start, t2end):
return (t1start <= t2start <= t1end) or (t2start <= t1start <= t2end)
// Initialize database
GraphDatabaseService graph = new EmbeddedGraphDatabase("db");
SpatialDatabaseService db = new SpatialDatabaseService(graph);
SimplePointLayer layer = db.createSimplePointLayer("neo-text");
// Add locations
for (Coordinate coordinate :
@javipalanca
javipalanca / summary.txt
Created June 23, 2024 10:59
Resumen del último directo de Twitch
En el último episodio del canal de drpalanca, se produjo una intensa aventura en el juego "The Castle". El streamer y los espectadores experimentaron momentos emocionantes mientras exploraban la fortaleza y enfrentaban a criaturas misteriosas. A pesar de las dificultades, lograron resolver un puzzle con la toalla mojada sobre la parabólica, descubriendo que este era el truco clave para avanzar en la historia.
Los espectadores también se deleitaron con una serie de interacciones y descubrimientos sorprendentes. Entre ellos, se encontró una caja llena de cables, un casco que pudo ser útil para resolver el siguiente desafío, y varias piezas interesantes como barra de metal, amuleto de oro, jeringuilla y alambre de cobre.
El punto culminante llegó cuando el streamer descubrió que la llave encontrada abriría una puerta en la parte superior del castillo. La aventura se intensificó aún más con la llegada de un prisionero y el uso de murciélagos mensajeros para enviar mensajes a diferentes lugares.
El equipo logró
@javipalanca
javipalanca / summary.txt
Created June 23, 2024 11:03
Resumen del último directo de Twitch
En el último episodio de drpalanca en Twitch, se produjo una emocionante aventura con misterios y desafíos. El streamer, junto a un grupo de espectadores, exploró una habitación llena de intrincados detalles y secretos ocultos.
El equipo comenzó su búsqueda en la cama, descubriendo un póster que no parecía moverse. Luego se adentraron en el baño, donde encontraron un desagüe que necesitaba ser tapado con algo desconocido. Encontraron una parabólica inmóvil y una puerta cerrada con llave en la terraza.
El streamer propuso pedir pizza para distraer a la posible amenaza, pero luego se topó con un misterioso juego que no proporcionaba direcciones claras, lo que dificultó el avance. El equipo decidió guardar la partida y continuar más tarde.
Durante una pausa, el streamer mencionó que habían conseguido desbloquear varios logros, incluyendo el uso de una toalla mojada para resolver un puzzle en la parabólica. A pesar de las dificultades, la colaboración del equipo permitió avanzar en la aventura.
Finalmente, el