Skip to content

Instantly share code, notes, and snippets.

View fgalan's full-sized avatar

Fermín Galán Márquez fgalan

View GitHub Profile
@fgalan
fgalan / ngsi_requests_restclient.json
Created September 3, 2013 10:26
RESTClient requests file to import
{"version test":{"method":"GET","url":"http://orion.lab.fi-ware.eu:1026/version","body":"","overrideMimeType":false,"headers":[["Accept","application/xml"],["X-Auth-Token","G9navVhAoUNU0jrmzcPcxd4FCgAcF9xDKW8v6awQuubUAgjwnsSMAucZM1mFO0-mAzoJZW1bd0hZeqBupfM8wQ"]]},"discoverContextAvailability":{"method":"POST","url":"http://orion.lab.fi-ware.eu:1026/ngsi9/discoverContextAvailability","body":"<?xml version=\"1.0\"?>\n<discoverContextAvailabilityRequest>\n <entityIdList>\n <entityId type=\"Room\" isPattern=\"false\">\n <id>Room1</id>\n </entityId>\n </entityIdList>\n <attributeList>\n <attribute>temperature</attribute>\n </attributeList>\n</discoverContextAvailabilityRequest>","overrideMimeType":false,"headers":[["Content-Type","application/xml"],["X-Auth-Token","G9navVhAoUNU0jrmzcPcxd4FCgAcF9xDKW8v6awQuubUAgjwnsSMAucZM1mFO0-mAzoJZW1bd0hZeqBupfM8wQ"]]},"updateContext":{"method":"POST","url":"http://orion.lab.fi-ware.eu:1026/ngsi10/updateContext","body":"<?xml version=\"1.0\" encoding=\"UT
@fgalan
fgalan / gist:11378281
Created April 28, 2014 17:17
mongoDiscoverContextAvailability.cpp @ IoT integration meeting Madrid April 2014
/*
*
* Copyright 2013 Telefonica Investigacion y Desarrollo, S.A.U
*
* This file is part of Orion Context Broker.
*
* Orion Context Broker is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
@fgalan
fgalan / foo.sh
Last active August 29, 2015 14:11
#!/bin/bash
echo "bar is: -$BAR-"
fermin@oriondeb:~/src/fiware-orion$ mongo orion
MongoDB shell version: 2.4.9
connecting to: orion
> db.dropDatabase()
{ "dropped" : "orion", "ok" : 1 }
> ^C
bye
fermin@oriondeb:~/src/fiware-orion$ (curl localhost:1026/ngsi10/contextEntities/cie_test_1/attributes/test_1 -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d @- ) <<EOF
{"value":"10"}
EOF
@fgalan
fgalan / fix_default_sp.py
Created February 14, 2015 11:44
fix_default_sp.py
#!/usr/bin/python
# -*- coding: latin-1 -*-
# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
#
# This file is part of Orion Context Broker.
#
# Orion Context Broker is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
@fgalan
fgalan / merge_default_sp_dups.py
Last active August 29, 2015 14:15
merge_default_sp_dups.py
#!/usr/bin/python
# -*- coding: latin-1 -*-
# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
#
# This file is part of Orion Context Broker.
#
# Orion Context Broker is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
fermin@debvm:~/src/fiware-orion$ (curl localhost:1026/v1/registry/discoverContextAvailability -s -S --header 'Content-Type: application/xml' -d @- | xmllint --format - ) <<EOF
<?xml version="1.0"?>
<discoverContextAvailabilityRequest>
<entityIdList>
<entityId type="Room" isPattern="false">
<id>Room2</id>
</entityId>
</entityIdList>
<attributeList>
<attribute>temperature</attribute>
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.6" jmeter="2.11 r1554548">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Plan de Pruebas" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="Variables definidas por el Usuario" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
@fgalan
fgalan / wc-test.cpp
Created June 10, 2015 12:09
wc-test.cpp
#include <cstdlib>
#include <iostream>
#include <stdlib.h>
#include "mongo/client/dbclient.h"
#include "mongo/bson/bson.h"
// To build this program:
// g++ wc-test.cpp -pthread -lmongoclient -lboost_thread-mt -lboost_system -lboost_regex -o wc-test
int main() {
@fgalan
fgalan / filter_test.txt
Last active August 29, 2015 14:23
Test FIWARE NGSIv2 query filters with MongoDB shell
# Test populating en1, en2, en3, en4, en5
// status equal to running -> en1, en2
> db.entities.find({"attrs.status.value": {$in: [ "running" ]}}, {"_id.id": 1})
{ "_id" : { "id" : "en1", "type" : "device", "servicePath" : "/" } }
{ "_id" : { "id" : "en2", "type" : "device", "servicePath" : "/" } }
// status equal to running, error -> en1, en2, en4
> db.entities.find({"attrs.status.value": {$in: [ "running", "error" ]}}, {"_id.id": 1})
{ "_id" : { "id" : "en1", "type" : "device", "servicePath" : "/" } }