Skip to content

Instantly share code, notes, and snippets.

@pgorczak
pgorczak / nginx.conf
Last active January 25, 2017 17:48
Demo: serving static content with nginx + mDNS
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y gnuradio-dev \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y git cmake \
&& git clone git://github.com/BastilleResearch/gr-lora.git \
&& cd gr-lora \
&& mkdir build \
&& cd build \
@pgorczak
pgorczak / lte-transport-block-size.md
Last active May 16, 2025 20:13
LTE transport block size table in convenient json (Table 7.1.7.2.1-1 from 3GPP TS 36.213)

LTE transport block size

This is the lookup table linking the transport block size index (determined by modulation and coding scheme) and the number of resource blocks to an LTE transport block size. It's taken from 3GPP [TS 36.213][36.213] (Table 7.1.7.2.1-1) at version 15.0.0. Multiply a TBS by 1000 to get the max throughput in bps.

Heatmap of block sizes

@pgorczak
pgorczak / mininet_mptcp_example.py
Created March 14, 2018 11:13
Bare bones example for multipath TCP with mininet
import subprocess
from time import sleep
from mininet.net import Mininet
from mininet.node import Host, Switch
from mininet.cli import CLI
from mininet.link import TCLink
from mininet.log import setLogLevel
from mininet.topo import Topo
@pgorczak
pgorczak / README.md
Last active March 29, 2018 09:10
Simplest half-duplex serial over Pycom LoRa

Dead simple serial-over-LoRa pipe using Pycom modules.

Note that this example is only half-duplex. You will need to implement some kind of flow control / media access control to be able to use it like a full duplex pipe.

@pgorczak
pgorczak / plot_traffic.py
Created April 12, 2018 15:02
Example for plotting packets/second with scapy and matplotlib
#! /usr/bin/env python
import threading
from scapy.all import *
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.style
from matplotlib import animation
import numpy as np
@pgorczak
pgorczak / ros-mdns
Created June 26, 2018 11:27
A tiny helper for setting up environment variables
# Put this file somewhere on your path
# run `source ros-mdns {master-hostname}`
export ROS_MASTER_URI=http://$1.local:11311
export ROS_HOSTNAME=$(hostname).local
@pgorczak
pgorczak / dragon_pointcloud.py
Created August 16, 2018 16:26
Demo for fast numpy to ROS PointCloud2 conversion. Draws a colorful Dragon Curve :)
import numpy as np
from matplotlib.cm import get_cmap
import rospy
import sensor_msgs.msg as sensor_msgs
import std_msgs.msg as std_msgs
def point_cloud(points, parent_frame):
""" Creates a point cloud message.
@pgorczak
pgorczak / mesh.py
Created October 1, 2018 19:06
Quick example publishing a mesh for mesh_tools (https://github.com/uos/mesh_tools)
import numpy as np
import geometry_msgs.msg as geo_msgs
import rospy
import mesh_msgs.msg as mesh_msgs
def publish_mesh(pub):
mesh = mesh_msgs.TriangleMeshStamped()
@pgorczak
pgorczak / simple-sync.bash
Last active October 9, 2018 15:39
Simplest script that auto-syncs a folder to a remote destination
#!/bin/bash
# Args: source destination
# Needs rsync and inotify-tools
# Hidden files and folders are excluded via regex (inotifywait) and patterns (rsync)
while true; do
rsync -avz --exclude ".*" --exclude ".*/" $1 $2
inotifywait -r -e modify,attrib,close_write,move,create,delete --exclude="\/\." $1
done