Skip to content

Instantly share code, notes, and snippets.

@marianoguerra
marianoguerra / README.rst
Last active April 1, 2024 15:25
MQTT Generator Script

MQTT Generator

A simple python 3 script to generate sensor data from a config file and send it to an MQTT broker.

Usage

Download mqttgen.py and config.json files (click on the Raw button at the top right and then save the content), edit config.json to fit your needs, if you are using it to run the Event Fabric sensors dashboard then don't change the topic in config.json unless you want to change it in the dashboard too.

@marianoguerra
marianoguerra / table2rst.py
Created August 10, 2011 16:14
csv table 2 rst
'''read a csv file representing a table and write a restructured text simple
table'''
import sys
import csv
def get_out(out=None):
'''
return a file like object from different kinds of values
None: returns stdout
string: returns open(path)

Keybase proof

I hereby claim:

  • I am marianoguerra on github.
  • I am marianoguerra (https://keybase.io/marianoguerra) on keybase.
  • I have a public key ASAAz1O8hmNDYf7GWHlLbRsEhxrHNovElDRwYHaNxkMQogo

To claim this, I am signing this object:

@marianoguerra
marianoguerra / appup.md
Last active August 15, 2018 23:29
OTP exml to md translator

appup

Application upgrade file

The application upgrade file defines how an application is upgraded or downgraded in a running system.

This file is used by the functions in

@marianoguerra
marianoguerra / README.rst
Created August 10, 2012 09:04
Jquery 1.8.0 and Jquery UI 1.8.22 dialog buttons bug

this gist is an example to reproduce a bug when using Jquery 1.8.0 and Jquery UI 1.8.22 and trying to set the buttons with an array of objects.

the example works if jquery is 1.7.2 but not with 1.8.0

to test

live test

@marianoguerra
marianoguerra / README.md
Created May 27, 2018 18:53
riak_core_lite metadata refactor notes

Files to delete:

git rm src/hashtree.erl
git rm src/hashtree_tree.erl
git rm src/riak_core_aae_vnode.erl
git rm src/riak_core_broadcast.erl
git rm src/riak_core_broadcast_handler.erl
git rm src/riak_core_entropy_info.erl
git rm src/riak_core_entropy_manager.erl
@marianoguerra
marianoguerra / DocumentationStorageFormat.md
Last active May 27, 2018 10:59
Draft of BEAM interoperability topics
@marianoguerra
marianoguerra / otr.py
Created November 6, 2012 10:36
otr support for sleekxmpp
import pyotr
from sleekxmpp.xmlstream.stanzabase import JID
import logging
log = logging.getLogger(__name__)
from plugin import BasePlugin
import tabs
from tabs import ConversationTab
@marianoguerra
marianoguerra / lasp_example.erl
Created December 31, 2017 16:57
First attempts at using lasp
{ok, {MapId, _, _, _}} = lasp:declare({<<"mymap">>, {state_awmap, [state_mvregister]}}, {state_awmap, [state_mvregister]}).
K1 = <<"key1">>.
V1 = #{what => i_am_a_gmap_value, thing => 42}.
{ok, {MapId1, _, _, _}} = lasp:update(MapId, {apply, K1, {set, erlang:unique_integer([monotonic, positive]), V1}}, self()).
{ok, Res1} = lasp:query(MapId1).
Res1.
% {ok,[{<<"key1">>, {set, ...#{thing => 42,what => i_am_a_gmap_value} ... }}]}
@marianoguerra
marianoguerra / Dockerfile
Created February 27, 2018 13:16
ubuntu:17.10 erlang 20.2
FROM ubuntu:17.10
RUN \
sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
apt-get update && \
apt-get -y upgrade && \
apt-get install -y --no-install-recommends wget build-essential git ca-certificates && \
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && \
dpkg -i erlang-solutions_1.0_all.deb && \
apt-get update && \