Skip to content

Instantly share code, notes, and snippets.

View javipalanca's full-sized avatar

Javi Palanca javipalanca

View GitHub Profile
@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 :
  • 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 / 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>
@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 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>
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 / 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
@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")