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
rustc --crate-type=staticlib jexl_evaluator.rs
g++ main.cpp -L. -ljexl_evaluator -o main
./main
@fgalan
fgalan / build_and_execute.sh
Last active March 25, 2024 18:05
Embeding Rust in C hello world example
rustc --crate-type=staticlib hello.rs
g++ main.cpp -L. -lhello -o main
./main
@fgalan
fgalan / test-request-simple.js
Created March 23, 2021 09:38
test-request-simple.js
const http = require('http')
const data = JSON.stringify({"id":"E","type":"T","location":{"type":"geo:json","value":{"type":"Point","coordinates":[32.124,-5.218]}},"address":{"type":"String","value":"House"},"TimeInstant":{"type":"DateTime","value":"2021-03-22T08:26:49.566Z"}})
const data2 = JSON.stringify({"id":"E","type":"T","TimeInstant":{"type":"DateTime","value":"2021-03-22T08:26:49.530Z"}})
const options = {
hostname: 'localhost',
port: 1026,
path: '/v2/entities?options=upsert',
@fgalan
fgalan / curl_test4.sh
Created January 29, 2020 16:47
curl_test4.sh
curl localhost:1026/v2/entities -H 'content-type: application/json' -d @- <<EOF
{"contextElements": [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
@fgalan
fgalan / curl_test3.sh
Created January 29, 2020 16:37
curl_test3.sh
curl localhost:1026/v2/entities -H 'content-type: application/json' -d @- <<EOF
{"id": "urn:ngsi-ld:Store:123", "type": "Store", "address": {"type": "PostalAddress", "value": {"streetAddress": "Bornholmer Straße 65", "addressRegion": "Berlin", "addressLocality": "Prenzlauer Berg", "postalCode": "10439"}, "metadata": {"verified": {"value": "true", "type": ": Boolean"}}}, "location": {"type": "geo:json", "value": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point", "coordinates": {"type": "Point
@fgalan
fgalan / curl_test2.sh
Created January 29, 2020 16:13
curl_test2.sh
curl localhost:1026/v2/entities -H 'content-type: application/json' -d @- <<EOF
{"id": "urn:ngsi-ld:Store:123", "type": "Store", "address": {"type": "PostalAddress", "value": {"streetAddress": "Bornholmer Straße 65", "addressRegion": "Berlin", "addressLocality": "Prenzlauer Berg", "postalCode": "18446744073709551615"}, "metadata": {"verified": {"value": "true", "type": ": Boolean"}}}, "location": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "value": {"type": "geo:json", "va
@fgalan
fgalan / curl_test.sh
Created January 29, 2020 15:44
curl_test.sh
curl localhost:1026/v2/entities -H 'content-type: application/json' -d @- <<EOF
{"id": "urn:ngsi-ld:Store:123", "type": "Store", "address": {"type": "PostalAddress", "value": {"streetAddress": "Bornholmer Straße 65", "addressRegion": "Berlin", "addressLocality": "Prenzlauer Berg", "postalCode": "10439"}, "metadata": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"verified": {"ve
@fgalan
fgalan / compare.sh
Created May 29, 2019 06:26
compare.sh
# Use your favorite diff program
DIFF=meld
for file in $(ls cases/3068_cprs_full_functional/*.test)
do
# Remove fwd_v2 prefix
old_file=$(echo $file | awk -F 'fwd_v2_' '{print $2}')
echo $DIFF cases/0787_cprs_full_functional/$old_file $file
$DIFF cases/0787_cprs_full_functional/$old_file $file
done
@fgalan
fgalan / DIFF
Created April 9, 2019 11:16
Fixed JSON Schema for NGSIv2
$ diff -u ngsiv2-draft-schema.orig.json ngsiv2-draft-schema.json
--- ngsiv2-draft-schema.orig.json 2019-04-08 12:23:44.103171653 +0200
+++ ngsiv2-draft-schema.json 2019-04-09 13:05:47.637837620 +0200
@@ -10,26 +10,6 @@
"maxLength": 256,
"pattern": "^[\\w\\-\\.\\{\\}\\$\\+\\*\\[\\]`|~^@!,:\\\\]+$"
},
- "Name": {
- "allOf": [
- {
@fgalan
fgalan / example1.json
Created April 8, 2019 10:17
Examples wrongly identified as invalid with draft NGSIv2 JSON Schema
{
"id": "foo",
"type": "geo:distance",
"A": {
"type": "Number",
"value": 4
}
}