Skip to content

Instantly share code, notes, and snippets.

Avatar

Sam Pfeiffer awesomebytes

View GitHub Profile
@awesomebytes
awesomebytes / message_filter_over_rosbag.py
Last active Jun 6, 2022
message_filters ApproximateTimeSynchronizer over a rosbag (without roscore or /use_sim_time)
View message_filter_over_rosbag.py
#!/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 Nov 8, 2021
Nvidia CUDA driver not working after suspend or hibernation workaround
View nvidia_cuda_fail_workaround.md

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:

View Play_audio_docker_container.sh
# 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
View datestamp.md

Datestamp

DATESTAMP=$(date +"%Y_%m_%d_%H_%M")
View 0001-Apply-https-github.com-PointCloudLibrary-pcl-pull-38.patch
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 Aug 31, 2021
Rostopic public republisher (at higher or lower rate)
View rostopic_republisher_rate.py
#!/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
View plotjuggler_yaw_function.lua
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 Jul 26, 2021
Razer 15 Advanced (2021) Ubuntu 18.04 installation (working WIFI and Nvidia)
View razer_15_advanced_ubuntu_18.04.md
@awesomebytes
awesomebytes / real_time_program_output_parser.py
Created May 28, 2021
Parse output in real time of any program in Python efficiently
View real_time_program_output_parser.py
#!/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
How to install Ubuntu 18.04.05 on Alienware 15 R3 (2020)
View install_ubuntu_18.04.05_on_alienware_15_r3_year_2020.md

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