Skip to content

Instantly share code, notes, and snippets.

View thomasantony's full-sized avatar

Thomas Antony thomasantony

View GitHub Profile
@lashex
lashex / aws-iot-mosquitto
Created May 23, 2016 21:05
Example Mosquitto CLI pub/sub using AWS IoT MQTT endpoint
The Mosquitto Pub CLI
$> mosquitto_pub --cert thing-0.pem --key thing-0.prv --cafile aws-iot-rootCA.crt -h XXXXXXXXYYYYY.iot.us-west-2.amazonaws.com -p 8883 -t 'test/thing' -m "Hello from Mosquitto"
The Mosquitto Sub CLI
$ mosquitto_sub --cert thing-0.pem --key thing-0.prv --cafile aws-iot-rootCA.crt -h XXXXXXXXYYYYY.iot.us-west-2.amazonaws.com -p 8883 -t 'test/+'
@oysstu
oysstu / crc16.py
Last active May 5, 2025 01:16
Implementation of crc16 (CRC-16-CCITT) in python
def crc16(data: bytes, poly=0x8408):
'''
CRC-16-CCITT Algorithm
'''
data = bytearray(data)
crc = 0xFFFF
for b in data:
cur_byte = 0xFF & b
for _ in range(0, 8):
if (crc & 0x0001) ^ (cur_byte & 0x0001):
@FulcronZ
FulcronZ / main.py
Created July 16, 2016 09:24
Python MQTT Logging Handler
"""
MIT License
Copyright (c) 2016 Pipat Methavanitpong
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@plusk01
plusk01 / ros-kinetic-macosx.md
Last active December 26, 2019 02:46
Installing ROS Kinetic on Mac OS X El Capitan (10.11.6) and macOS Sierra

Installing ROS Kinetic on Mac OS X - El Capitan and macOS Sierra

Having rather painlessly installed ROS Indigo on El Capitan using Mike Purvis's script, I attempted to upgrade to ROS Kinetic. This gist outlines the problems I encoutered and how I solved them. Hopefully this guide will help others attempting to install ROS Kinetic / Gazebo 7 on El Capitan.

ROS Install OSX

Start with Mike Purvis's script, which currently is setup to install ROS Indigo. In order to install Kinetic instead of Indigo, make sure to set the ROS_DISTRO environment variable: export ROS_DISTRO=kinetic.

After you get through rosdep errors, it's quickest to just work with the catkin config ... and catkin build ... commands directly. In fact, I found it most helpful to leave my catkin workspace terminal open at ros-install-osx/kinetic_desktop_full_ws and t

@mlsmith
mlsmith / gist:c6f96bf26f91ae03160a60b958d64c8b
Last active October 25, 2019 11:10
Install FFMPEG on Mac OS X with x265
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
# Streaming with FFMPEG
# https://trac.ffmpeg.org/wiki/StreamingGuide
ffmpeg -f avfoundation -i "1:0" -c:v libx265 -preset fast -c:a libfdk_aac -b:a 160k test.mkv
@jmtatsch
jmtatsch / gist:44e7c1a55fc29432254bdc61559d91c7
Last active April 12, 2018 05:10
ROS Kinetic on Sierra Work in Progress
# NOTE: These instructions do not represent a robust, self-troubleshooting install; they
# are definitely not suitable for dumping to a giant script and running as one. If you
# use them, they should be run one at a time, with an eye out for errors or problems
# along the way.
#
# The #1 issue you are likely to encounter is with Homebrew or Python packages whose
# binary components link against system Python. This will result in runtime segfaults,
# especially in rviz. If you suspect this is occurring, you can attempt to remove and
# reinstall the offending packages, or go for the nuclear option--- empty your Cellar
# and site-packages folders and start over with brewed python from the beginning.
@Garrett-R
Garrett-R / gzip_str.py
Last active March 12, 2022 10:17
Demo of how to gzip and gunzip a string in Python 3
"""How to gzip a string.
This works for Python 3.2. For 3.1-, look at the original gist (under "Revisions")
"""
import gzip
def gzip_str(string_: str) -> bytes:
return gzip.compress(string_.encode())
@lukeyeager
lukeyeager / example.py
Last active September 21, 2017 19:38
DetectNet Python Inference
#!/usr/bin/env python2
# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
"""
Classify an image using individual model files
Use this script as an example to build your own tool
"""
import argparse
@bpinaya
bpinaya / CarDetection.py
Created February 22, 2017 23:49
Detectnet on a video video input. Call: python CarDetection.py yourSnap.caffemodel deplot.prototxt input.mp4 output.mp4
# Based on
# https://gist.github.com/lukeyeager/777087991419d98700054cade2f755e6
#--------------------------------------------------------------------
# CarDetection runs Detectnet on a video pipeline (TX1 Tested)
# This might be run only once if no ffmpeg is installed
#import imageio
#imageio.plugins.ffmpeg.download()
import cv2
@csarron
csarron / installTensorFlow1.2Py3OnJetsonTX2.sh
Last active August 9, 2017 08:52
Install TensorFlow 1.2 Python 3 On Jetson TX 2
#!/bin/bash
#install dependencies
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer -y
sudo apt-get install zip unzip autoconf automake libtool curl zlib1g-dev maven -y
sudo apt install python3-numpy python3-dev python3-pip python3-wheel
# install bazel