Skip to content

Instantly share code, notes, and snippets.

View awesomebytes's full-sized avatar

Sam Pfeiffer awesomebytes

View GitHub Profile
@awesomebytes
awesomebytes / message_filter_over_rosbag.py
Last active March 15, 2024 13:36
message_filters ApproximateTimeSynchronizer over a rosbag (without roscore or /use_sim_time)
#!/usr/bin/env python
import itertools
import sys
import time
import rospy
import rosbag
import message_filters
"""
Example using a message_filters filter (ApproximateTimeSynchronizer) iterating
@awesomebytes
awesomebytes / nvidia_cuda_fail_workaround.md
Last active May 16, 2023 09:21
Nvidia CUDA driver not working after suspend or hibernation workaround

How to reset the GPU to use CUDA after suspend or hibernation

I needed to do:

sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvm

From the nvidia forums.

I also got the following error fixed (docker-nvidia related) with these commands:

# How to play audio from inside a docker container
```bash
# Run your docker image with
-v /run/user/$UID/pulse/native:/run/user/$UID/pulse/native \
-e PULSE_SERVER=unix:/run/user/$UID/pulse/native
```
And you can try to use `speaker-test`.
This was found here: https://stackoverflow.com/a/28995539

Datestamp

DATESTAMP=$(date +"%Y_%m_%d_%H_%M")
@awesomebytes
awesomebytes / 0001-Apply-https-github.com-PointCloudLibrary-pcl-pull-38.patch
Created September 8, 2021 06:08
Apply https://github.com/PointCloudLibrary/pcl/pull/3853 from Davide Faconti to improve Voxelgrid runtime by 20% to 1.8.1 tag (backport)
From 466e0f57b15e11ab19af900341f98a726ad1bf73 Mon Sep 17 00:00:00 2001
From: Sammy Pfeiffer <sam.pfeiffer@conigital.com>
Date: Wed, 8 Sep 2021 16:06:44 +1000
Subject: [PATCH] Apply https://github.com/PointCloudLibrary/pcl/pull/3853 from
Davide Faconti to improve Voxelgrid runtime by 20% to 1.8.1 tag (backport)
---
filters/include/pcl/filters/impl/voxel_grid.hpp | 7 +++++--
filters/src/voxel_grid.cpp | 6 ++++--
2 files changed, 9 insertions(+), 4 deletions(-)
@awesomebytes
awesomebytes / rostopic_republisher_rate.py
Created August 31, 2021 01:08
Rostopic public republisher (at higher or lower rate)
#!/usr/bin/python2
import rospy
import rostopic
import argparse
import threading
# Borrowed from https://chaonan99.github.io/2018/rostopic-republish/
global g_msg
g_msg = None
function yawAngleFromQ(time, value, v1, v2, v3)
M_PI = 3.14159265358979323846
a = v1
b = v2
c = v3
d = value
aa = a * a
ab = a * b
ac = a * c
@awesomebytes
awesomebytes / razer_15_advanced_ubuntu_18.04.md
Created July 26, 2021 03:56
Razer 15 Advanced (2021) Ubuntu 18.04 installation (working WIFI and Nvidia)
@awesomebytes
awesomebytes / real_time_program_output_parser.py
Created May 28, 2021 01:46
Parse output in real time of any program in Python efficiently
#!/usr/bin/env python
# To make Python 2.7 print an actual function
from __future__ import print_function
import subprocess
# shlex takes care of splitting a string representing a command in words for subprocess
import shlex
import os
class RealTimeProgramOutputParser(object):
@awesomebytes
awesomebytes / install_ubuntu_18.04.05_on_alienware_15_r3_year_2020.md
Last active May 25, 2021 06:39
How to install Ubuntu 18.04.05 on Alienware 15 R3 (2020)

How to install Ubuntu 18.04.05 on Alienware 15 R3 (year 2020 edition)

Let windows install

Just next, next, next filling up your data.

I needed to shutdown the machine on a screen that seemed stuck forever. After starting again it all worked normally and got into Windows.

I found the Dell update application and installed all available updates (as I will probably never boot into Windows again).

Shrink the disk