Skip to content

Instantly share code, notes, and snippets.

Avatar

Adrián López adrianlzt

View GitHub Profile
View main.go
package main
import (
"fmt"
"net"
"os"
"time"
)
var expectedPort = 80
@adrianlzt
adrianlzt / regression.py
Created Apr 22, 2022
Obtener una función polinómica para aproximar un volumen a partir de una presión dadas unas medidas
View regression.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
"""
A partir de una serie de medidas de presión y el correspondiente volumen,
aproximar una función polinómica.
"""
View entendiendo_mds.py
#! /usr/bin/env pytho2
# -*- coding: utf-8 -2-
# vim:fenc=utf-8
#
# Copyright © 2022 adrian <adrian@arco>
#
# Distributed under terms of the MIT license.
"""
Representamos en 2d y 3d un número de puntos que entre ellos siempre están
@adrianlzt
adrianlzt / load_skydive_topology.py
Created Feb 23, 2022
Read a Skydive topology from a json file and import into skydive (extract json file with HTTP GET to /api/topology)
View load_skydive_topology.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Leer la topologia de un fichero JSON y cargarlo en skydive
"""
import json
from tqdm import tqdm
View test_xiaomi_alarm.py
from ble_monitor.ble_parser import BleParser
import struct
class TestXiaomi:
"""Tests for the Xiaomi parser"""
def test_Xiaomi_RTCGQ02LM(self):
"""Simulando el dispositivo y añadiendo algún sensor adicional (switch)"""
data_string = "02" # ext_packet=True si 0x0D
@adrianlzt
adrianlzt / ble_get_services.py
Created Nov 8, 2021
Get services, characteristics and descriptors for a BLE device
View ble_get_services.py
"""
Get services, characteristics and descriptors for a BLE device
"""
import sys
import asyncio
import platform
from bleak import BleakClient
ADDRESS = ( "20:C3:8F:8A:5B:EA")
@adrianlzt
adrianlzt / Pipfile
Last active Nov 5, 2021
Simulator for waveshare gsm hat. Tested against the Civlo85/gsmHat lib. Not complete
View Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pyserial = "*"
requests = "*"
[dev-packages]
@adrianlzt
adrianlzt / README.md
Created Oct 12, 2021
LiFePo4 310Ah/12V + Daly BMS connection and load test
@adrianlzt
adrianlzt / exec_other_ns.go
Created Apr 22, 2021
golang: execute command under different network namespace
View exec_other_ns.go
/*
* Execute a command under a different network namespace
*/
package main
import (
"fmt"
"io/ioutil"
"log"
@adrianlzt
adrianlzt / Makefile
Created Feb 11, 2021
Playbook example using go module
View Makefile
all: build playbook
build:
cd library && go build -o helloworld helloworld_src.go && cd ..
playbook:
DEFAULT_MODULE_PATH=~/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:./modules/ ansible-playbook play.yaml
# vim:ft=make