Skip to content

Instantly share code, notes, and snippets.

View agmangas's full-sized avatar

Andrés García Mangas agmangas

View GitHub Profile
@agmangas
agmangas / popen-communicate-wrapper.py
Created December 3, 2018 16:01
Popen.communicate() wrapper function
from subprocess import Popen, PIPE
def _popen_communicate(cmd_args):
"""Takes a list of arguments and executes a command.
Blocks waiting for the execution to finish.
Returns a tuple containing the stdout and stderr."""
process = Popen(cmd_args, stdout=PIPE, stderr=PIPE)
stdout, stderr = process.communicate()
@agmangas
agmangas / can-id-png.md
Last active November 24, 2024 21:26
Relationship between CAN IDs and J1939 PGNs

CAN IDs & J1939 PGNs

Global PGN Example

Original CAN ID:

1    8    F    0    0    1    0    B
0001 1000 1111 0000 0000 0001 0000 1011
@agmangas
agmangas / aa-status.txt
Created October 9, 2018 15:58
aa-status-output
# aa-status
apparmor module is loaded.
115 profiles are loaded.
115 profiles are in enforce mode.
/sbin/dhclient
/usr/lib/NetworkManager/nm-dhcp-client.action
/usr/lib/NetworkManager/nm-dhcp-helper
/usr/lib/connman/scripts/dhclient-script
/usr/lib/snapd/snap-confine
/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
@agmangas
agmangas / fix-sl4g-routing.sh
Last active May 9, 2018 15:25
Docker SL4G Routing Fix
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ]
then echo "## Please run as root"
exit
fi
DOCKER_TABLE="docker"
VPN_GATEWAY_NET="10.5.0.0/16"
VPN_TABLE="alternate"