Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@D3f0
D3f0 / -
Created August 28, 2017 17:12
#!/usr/bin/env python
import fileinput
import re
import sys
import binascii
from paho.mqtt.publish import single
# Esto buscan una trama que tenga Payload MARA
regex = re.compile(r'\[(?P<ip>[\d\.]+)\]\s<\w+=[\w_]+>\s[<>]+\s(?P<frame>[\w{2}\s?]+)')
void setup()
{
system("ifconfig eth0 192.168.0.100 netmask 255.255.255.0 up");
}
void loop(){}
@D3f0
D3f0 / Makefile
Last active August 9, 2017 19:04
Start Jupyter notebook in your Django compose project without adding any service
# jupyter must be installed in the container, and if you want fancy tables, pandas too.
# docker exec -u 0 $(docker-compose -f $(COMPOSE_FILE) images -q django) pip install jupyter pandas
start_jupyter: ## Starts a Jupyter
$(eval DJANGO_IMAGE := $(shell docker-compose -f $(COMPOSE_FILE) images -q django))
$(eval DJANGO_CONTAINER := $(shell docker-compose -f $(COMPOSE_FILE) ps -q django))
$(eval POSTGRES_CONTAINER := $(shell docker-compose -f $(COMPOSE_FILE) ps -q postgres))
$(eval ANOTHER_POSTGRES_CONTAINER := $(shell docker-compose -f $(COMPOSE_FILE) ps -q another-postgres))
@docker run --rm \
--volumes-from $(DJANGO_CONTAINER) \
[
{
"id": "36201a11.29adb6",
"type": "mqtt in",
"z": "590fa7d1.dae2c8",
"name": "",
"topic": "outTopic",
"qos": "2",
"broker": "49181d47.366c24",
"x": 259.5,
@D3f0
D3f0 / nodepython.ipynb
Created February 27, 2017 03:31
NodeJS - Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@D3f0
D3f0 / two_tracks.xml
Created February 8, 2017 18:02
melt xml with keyframed audio
<?xml version='1.0' encoding='utf-8'?>
<mlt title="Anonymous Submission" version="6.4.1" root="/tmp" producer="main bin" LC_NUMERIC="es_AR.UTF-8">
<profile width="640" frame_rate_den="1" height="480" display_aspect_num="16" display_aspect_den="9" frame_rate_num="25" colorspace="709" sample_aspect_den="1" description="HD 1080p 25 fps" progressive="1" sample_aspect_num="1"/>
<producer id="1" title="Anonymous Submission" out="2531" in="0">
<property name="length">00:01:41:07</property>
<property name="eof">pause</property>
<property name="resource">/path/to/project/Clap_tap.mp3</property>
<property name="meta.media.nb_streams">1</property>
<property name="meta.media.0.stream.type">audio</property>
<property name="meta.media.0.codec.sample_fmt">s16p</property>
@D3f0
D3f0 / plot.py
Created December 20, 2016 19:39
Plot metl schema XML using Matplotlib to produce a PNG
#!/usr/bin/env python2
'''
Plots a MELT xml schema with matplotlib
'''
from __future__ import print_function
from lxml import etree
import sys
from datetime import datetime, timedelta
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
@D3f0
D3f0 / copy_model.py
Created December 16, 2016 19:09
This will copy models from one DB to another
# Copies a model from one DB to another using Django
# If you're using heroku, you may wanna check https://gist.github.com/D3f0/edd70a6066863ee74674ac5ede838a20
def db_copy(obj, to, *skip, **kwargs):
'''
Copies a model from one database into another.
`obj` is the model that is going to be cloned
`to` is the db definition
`skip` is a list of attribtues that won't be copied
`kwargs is a list of elements that will be overwritten over model data